Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/rump/modautoload When MODULAR kernels grew a MODULAR_D...



details:   https://anonhg.NetBSD.org/src/rev/ef56b876a059
branches:  trunk
changeset: 812680:ef56b876a059
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Dec 27 06:36:36 2015 +0000

description:
When MODULAR kernels grew a MODULAR_DEFAULT_AUTOLOAD option, (in rev 1.98
of src/sys/kern/kern_module.c), the default was "off" for all kernels
including rump kernels.  While many (most?) kernel config files were
updated to include the new option, rump kernels weren't so lucky.  Thus,
rump kernels still had autoload disabled.

This commit uses rump_sysctl to change the module_autoload_on value to
true (ie, enabled) before trying to test if autoloading actually works.

For now, I am _not_ changing the default for all rump kernels.  I'll
leave that for another day, after all appropriate discussion has occurred.

diffstat:

 tests/rump/modautoload/Makefile        |  11 ++++++++++-
 tests/rump/modautoload/t_modautoload.c |  14 +++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

diffs (64 lines):

diff -r ae4c6c3a00fc -r ef56b876a059 tests/rump/modautoload/Makefile
--- a/tests/rump/modautoload/Makefile   Sun Dec 27 06:24:25 2015 +0000
+++ b/tests/rump/modautoload/Makefile   Sun Dec 27 06:36:36 2015 +0000
@@ -1,10 +1,12 @@
-#      $NetBSD: Makefile,v 1.2 2014/03/10 22:38:53 pooka Exp $
+#      $NetBSD: Makefile,v 1.3 2015/12/27 06:36:36 pgoyette Exp $
 #
 
 TESTSDIR=      ${TESTSBASE}/rump/modautoload
 
 TESTS_C=       t_modautoload
 
+SRCS.t_modautoload+=   t_modautoload.c
+
 # Note: we link the rump kernel into the application to make this work
 # on amd64.  This is the reason we keep this test in its own
 # subdirectory -- otherwise the LDADD lines would get a little hairy.
@@ -16,4 +18,11 @@
 
 WARNS= 4
 
+# To include a rump version of sysctlbyname()
+
+.PATH:         ${NETBSDSRCDIR}/lib/libc/gen
+SRCS.t_modautoload+=           sysctlbyname.c
+SRCS.t_modautoload+=           sysctlgetmibinfo.c
+CPPFLAGS+=     -DRUMP_ACTION
+
 .include <bsd.test.mk>
diff -r ae4c6c3a00fc -r ef56b876a059 tests/rump/modautoload/t_modautoload.c
--- a/tests/rump/modautoload/t_modautoload.c    Sun Dec 27 06:24:25 2015 +0000
+++ b/tests/rump/modautoload/t_modautoload.c    Sun Dec 27 06:36:36 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_modautoload.c,v 1.2 2014/03/10 22:38:53 pooka Exp $  */
+/*     $NetBSD: t_modautoload.c,v 1.3 2015/12/27 06:36:36 pgoyette Exp $       */
 
 #include <sys/types.h>
 #include <sys/mount.h>
@@ -33,6 +33,9 @@
 static void
 mountkernfs(void)
 {
+       bool old_autoload, new_autoload;
+       size_t old_len, new_len;
+       int error;
 
        if (!rump_nativeabi_p())
                atf_tc_skip("host kernel modules not supported");
@@ -41,6 +44,15 @@
 
        if (rump_sys_mkdir("/kern", 0777) == -1)
                atf_tc_fail_errno("mkdir /kern");
+
+       new_autoload = new_verbose = true;
+       new_len = sizeof(new_autoload);
+       error = sysctlbyname("kern.module.autoload",
+                                 &old_autoload, &old_len,
+                                 &new_autoload, new_len);
+       if (error != 0)
+               atf_tc_fail_errno("could not enable module autoload");
+
        if (rump_sys_mount(MOUNT_KERNFS, "/kern", 0, NULL, 0) == -1)
                atf_tc_fail_errno("could not mount kernfs");
 }



Home | Main Index | Thread Index | Old Index