xref: /xnu-10002.1.13/tests/vm/vm_sysctl_tests.c (revision 1031c584a5e37aff177559b9f69dbd3c8c3fd30a)
1 #include <sys/sysctl.h>
2 #include <signal.h>
3 #include <darwintest.h>
4 #include <darwintest_utils.h>
5 
6 T_GLOBAL_META(
7 	T_META_NAMESPACE("xnu.vm"),
8 	T_META_RADAR_COMPONENT_NAME("xnu"),
9 	T_META_RADAR_COMPONENT_VERSION("VM"),
10 	T_META_ASROOT(YES));
11 
12 static int64_t
run_sysctl_test(const char * t,int64_t value)13 run_sysctl_test(const char *t, int64_t value)
14 {
15 	char name[1024];
16 	int64_t result = 0;
17 	size_t s = sizeof(value);
18 	int rc;
19 
20 	snprintf(name, sizeof(name), "debug.test.%s", t);
21 	rc = sysctlbyname(name, &result, &s, &value, s);
22 	T_ASSERT_POSIX_SUCCESS(rc, "sysctlbyname(%s)", t);
23 	return result;
24 }
25 
26 T_DECL(vm_map_non_aligned,
27     "Test that we can destroy map unaligned mappings (rdar://88969652)",
28     T_META_RUN_CONCURRENTLY(true))
29 {
30 	T_EXPECT_EQ(1ull, run_sysctl_test("vm_map_non_aligned", 0), "vm_map_non_aligned");
31 }
32