1 #include <darwintest.h>
3 #include <System/sys/proc_uuid_policy.h>
6 #define NUM_PROC_UUID_POLICY_FLAGS 4
8 T_DECL(proc_uuid_policy_26567533
, "Tests passing a NULL uuid in (uap->uuid).", T_META_LTEPHASE(LTE_POSTINIT
))
12 memset(null_uuid
, 0, sizeof(uuid_t
));
14 uint32_t policy_flags
[] = {
15 PROC_UUID_POLICY_FLAGS_NONE
,
16 PROC_UUID_NO_CELLULAR
,
17 PROC_UUID_NECP_APP_POLICY
,
18 PROC_UUID_ALT_DYLD_POLICY
21 for (i
= 0; i
< NUM_PROC_UUID_POLICY_FLAGS
; i
++) {
22 T_LOG("Testing policy add with flag value 0x%x", policy_flags
[i
]);
24 /* Since UUID is null, this call should fail with errno = EINVAL. */
25 ret
= proc_uuid_policy(PROC_UUID_POLICY_OPERATION_ADD
, null_uuid
, sizeof(uuid_t
), policy_flags
[i
]);
27 T_ASSERT_TRUE(ret
== -1, "proc_uuid_policy returned %d", ret
);
29 T_ASSERT_TRUE(errno
= EINVAL
, "errno is %d", errno
);
32 for (i
= 0; i
< NUM_PROC_UUID_POLICY_FLAGS
; i
++) {
33 T_LOG("Testing policy remove with flag value 0x%x", policy_flags
[i
]);
35 /* Since UUID is null, this call should fail with errno = EINVAL. */
36 ret
= proc_uuid_policy(PROC_UUID_POLICY_OPERATION_REMOVE
, null_uuid
, sizeof(uuid_t
), policy_flags
[i
]);
38 T_ASSERT_TRUE(ret
== -1, "proc_uuid_policy returned %d", ret
);
40 T_ASSERT_TRUE(errno
= EINVAL
, "errno is %d", errno
);