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