xref: /xnu-10063.121.3/tests/readonly_proc_tests.c (revision 2c2f96dc2b9a4408a43d3150ae9c105355ca3daa) !
1*2c2f96dcSApple OSS Distributions #include <darwintest.h>
2*2c2f96dcSApple OSS Distributions #include <sys/sysctl.h>
3*2c2f96dcSApple OSS Distributions 
4*2c2f96dcSApple OSS Distributions T_GLOBAL_META(
5*2c2f96dcSApple OSS Distributions 	T_META_NAMESPACE("xnu.bsd"),
6*2c2f96dcSApple OSS Distributions 	T_META_RADAR_COMPONENT_NAME("xnu"),
7*2c2f96dcSApple OSS Distributions 	T_META_RADAR_COMPONENT_VERSION("bsd"),
8*2c2f96dcSApple OSS Distributions 	T_META_OWNER("chrisjd")
9*2c2f96dcSApple OSS Distributions 	);
10*2c2f96dcSApple OSS Distributions 
11*2c2f96dcSApple OSS Distributions T_DECL(readonly_proc_tests, "invoke the read-only proc unit test",
12*2c2f96dcSApple OSS Distributions     T_META_ASROOT(true), T_META_REQUIRES_SYSCTL_EQ("kern.development", 1))
13*2c2f96dcSApple OSS Distributions {
14*2c2f96dcSApple OSS Distributions 	int64_t result = 0;
15*2c2f96dcSApple OSS Distributions 	int64_t value = 0;
16*2c2f96dcSApple OSS Distributions 	size_t s = sizeof(value);
17*2c2f96dcSApple OSS Distributions 	int ret;
18*2c2f96dcSApple OSS Distributions 	ret = sysctlbyname("debug.test.readonly_proc_test", &result, &s, &value, sizeof(value));
19*2c2f96dcSApple OSS Distributions 	T_ASSERT_POSIX_SUCCESS(ret, "sysctlbyname(\"debug.test.readonly_proc_test\"");
20*2c2f96dcSApple OSS Distributions 	T_EXPECT_EQ(1ull, result, "run readonly proc test");
21*2c2f96dcSApple OSS Distributions }
22