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