xref: /xnu-10002.1.13/tests/ipc/waitq.c (revision 1031c584a5e37aff177559b9f69dbd3c8c3fd30a)
1*1031c584SApple OSS Distributions #include <sys/sysctl.h>
2*1031c584SApple OSS Distributions #include <darwintest.h>
3*1031c584SApple OSS Distributions #include <darwintest_utils.h>
4*1031c584SApple OSS Distributions 
5*1031c584SApple OSS Distributions T_GLOBAL_META(
6*1031c584SApple OSS Distributions 	T_META_NAMESPACE("xnu.ipc"),
7*1031c584SApple OSS Distributions 	T_META_RADAR_COMPONENT_NAME("xnu"),
8*1031c584SApple OSS Distributions 	T_META_RADAR_COMPONENT_VERSION("IPC"),
9*1031c584SApple OSS Distributions 	T_META_CHECK_LEAKS(false));
10*1031c584SApple OSS Distributions 
11*1031c584SApple OSS Distributions static int64_t
run_sysctl_test(const char * t,int64_t value)12*1031c584SApple OSS Distributions run_sysctl_test(const char *t, int64_t value)
13*1031c584SApple OSS Distributions {
14*1031c584SApple OSS Distributions 	char name[1024];
15*1031c584SApple OSS Distributions 	int64_t result = 0;
16*1031c584SApple OSS Distributions 	size_t s = sizeof(value);
17*1031c584SApple OSS Distributions 	int rc;
18*1031c584SApple OSS Distributions 
19*1031c584SApple OSS Distributions 	snprintf(name, sizeof(name), "debug.test.%s", t);
20*1031c584SApple OSS Distributions 	rc = sysctlbyname(name, &result, &s, &value, s);
21*1031c584SApple OSS Distributions 	T_ASSERT_POSIX_SUCCESS(rc, "sysctlbyname(%s)", t);
22*1031c584SApple OSS Distributions 	return result;
23*1031c584SApple OSS Distributions }
24*1031c584SApple OSS Distributions 
25*1031c584SApple OSS Distributions T_DECL(waitq_basic, "General waitq test",
26*1031c584SApple OSS Distributions     T_META_RUN_CONCURRENTLY(false))
27*1031c584SApple OSS Distributions {
28*1031c584SApple OSS Distributions 	T_EXPECT_EQ(1ull, run_sysctl_test("waitq_basic", 0), "waitq_basic_test");
29*1031c584SApple OSS Distributions }
30