Module Name:    src
Committed By:   pgoyette
Date:           Sun Dec 27 06:36:36 UTC 2015

Modified Files:
        src/tests/rump/modautoload: Makefile t_modautoload.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/rump/modautoload/Makefile \
    src/tests/rump/modautoload/t_modautoload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/rump/modautoload/Makefile
diff -u src/tests/rump/modautoload/Makefile:1.2 src/tests/rump/modautoload/Makefile:1.3
--- src/tests/rump/modautoload/Makefile:1.2	Mon Mar 10 22:38:53 2014
+++ src/tests/rump/modautoload/Makefile	Sun Dec 27 06:36:36 2015
@@ -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 @@ LDADD+=		-lrumpuser -lpthread
 
 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>
Index: src/tests/rump/modautoload/t_modautoload.c
diff -u src/tests/rump/modautoload/t_modautoload.c:1.2 src/tests/rump/modautoload/t_modautoload.c:1.3
--- src/tests/rump/modautoload/t_modautoload.c:1.2	Mon Mar 10 22:38:53 2014
+++ src/tests/rump/modautoload/t_modautoload.c	Sun Dec 27 06:36:36 2015
@@ -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 @@ ATF_TC_HEAD(modautoload, tc)
 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 @@ mountkernfs(void)
 
 	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");
 }

Reply via email to