[Bug 236841] Check geom_nop.ko module for sys/geom/class/nop/nop_test
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Thu Mar 28 01:52:57 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236841
--- Comment #3 from Enji Cooper <ngie at FreeBSD.org> ---
Ok, this partly boils down to a change introduced in r274631...
$ git diff 2cfe78eed8ed3^..2cfe78eed8ed3
diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c
index 8c15c2143e1e..5d23d933ec94 100644
--- a/sbin/geom/core/geom.c
+++ b/sbin/geom/core/geom.c
@@ -640,6 +640,11 @@ get_class(int *argc, char ***argv)
#endif /* !STATIC_GEOM_CLASSES */
set_class_name();
+
+ /* If we can't load or list, it's not a class. */
+ if (!std_available("load") && !std_available("list"))
+ errx(EXIT_FAILURE, "Invalid class name.");
+
if (*argc < 1)
usage();
}
... and this code:
1318 if (sysctlbyname("kern.module_path", paths, &len, NULL, 0) < 0)
1319 err(EXIT_FAILURE, "sysctl(kern.module_path)");
1320 for (p = strtok(paths, ";"); p != NULL; p = strtok(NULL, ";")) {
1321 snprintf(name, sizeof(name), "%s/geom_%s.ko", p,
class_name);
1322 /*
1323 * If geom_<name>.ko file exists, "load" command is
available.
1324 */
1325 if (stat(name, &sb) == 0)
1326 return (1);
1327 }
1328 return (0);
If the module doesn't exist, it will fail with `EXIT_FAILURE`.
Why doesn't the test get skipped though?
It looks like all of the load_gnop calls are kosher:
$ grep -c load_gnop tests/sys/geom/class/nop/nop_test.sh
8
$ grep -c atf_add_test_case tests/sys/geom/class/nop/nop_test.sh
7
$
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-testing
mailing list