Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/rump/rumpkern Disable module autoload so that it won't...
details: https://anonhg.NetBSD.org/src/rev/daa6045f5ca4
branches: trunk
changeset: 754469:daa6045f5ca4
user: pooka <pooka%NetBSD.org@localhost>
date: Sat May 01 11:20:21 2010 +0000
description:
Disable module autoload so that it won't foil our module unload test.
diffstat:
tests/rump/rumpkern/t_modcmd.c | 59 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 58 insertions(+), 1 deletions(-)
diffs (87 lines):
diff -r f134d48e95fc -r daa6045f5ca4 tests/rump/rumpkern/t_modcmd.c
--- a/tests/rump/rumpkern/t_modcmd.c Sat May 01 11:13:01 2010 +0000
+++ b/tests/rump/rumpkern/t_modcmd.c Sat May 01 11:20:21 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_modcmd.c,v 1.5 2010/03/05 18:49:30 pooka Exp $ */
+/* $NetBSD: t_modcmd.c,v 1.6 2010/05/01 11:20:21 pooka Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <sys/mount.h>
+#include <sys/sysctl.h>
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
@@ -59,6 +60,58 @@
"a module (vfs/tmpfs) is possible");
}
+static int
+disable_autoload(void)
+{
+ struct sysctlnode q, ans[256];
+ int mib[3];
+ size_t alen;
+ unsigned i;
+ bool no;
+
+ mib[0] = CTL_KERN;
+ mib[1] = CTL_QUERY;
+ alen = sizeof(ans);
+
+ memset(&q, 0, sizeof(q));
+ q.sysctl_flags = SYSCTL_VERSION;
+
+ if (rump_sys___sysctl(mib, 2, ans, &alen, &q, sizeof(q)) == -1)
+ return -1;
+
+ for (i = 0; i < __arraycount(ans); i++)
+ if (strcmp("module", ans[i].sysctl_name) == 0)
+ break;
+ if (i == __arraycount(ans)) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ mib[1] = ans[i].sysctl_num;
+ mib[2] = CTL_QUERY;
+
+ if (rump_sys___sysctl(mib, 3, ans, &alen, &q, sizeof(q)) == -1)
+ return errno;
+
+ for (i = 0; i < __arraycount(ans); i++)
+ if (strcmp("autoload", ans[i].sysctl_name) == 0)
+ break;
+ if (i == __arraycount(ans)) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ mib[2] = ans[i].sysctl_num;
+
+ no = false;
+ alen = 0;
+ if (rump_sys___sysctl(mib, 3, NULL, &alen, &no, sizeof(no)) == -1)
+ return errno;
+
+ return 0;
+
+}
+
#define TMPFSMODULE "librumpfs_tmpfs.so"
ATF_TC_BODY(cmsg_modcmd, tc)
{
@@ -68,6 +121,10 @@
int i, rv, loop = 0;
rump_init();
+
+ if (disable_autoload() == -1)
+ atf_tc_fail_errno("count not disable module autoload");
+
memset(&args, 0, sizeof(args));
args.ta_version = TMPFS_ARGS_VERSION;
args.ta_root_mode = 0777;
Home |
Main Index |
Thread Index |
Old Index