]>
Commit | Line | Data |
---|---|---|
39037602 A |
1 | #include <darwintest.h> |
2 | #include <uuid/uuid.h> | |
3 | #include <System/sys/proc_uuid_policy.h> | |
4 | #include <stdint.h> | |
5 | ||
cb323159 A |
6 | T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true)); |
7 | ||
39037602 A |
8 | #define NUM_PROC_UUID_POLICY_FLAGS 4 |
9 | ||
813fb2f6 | 10 | T_DECL(proc_uuid_policy_26567533, "Tests passing a NULL uuid in (uap->uuid).", T_META_LTEPHASE(LTE_POSTINIT)) |
39037602 A |
11 | { |
12 | int i, ret; | |
13 | uuid_t null_uuid; | |
14 | memset(null_uuid, 0, sizeof(uuid_t)); | |
15 | ||
813fb2f6 A |
16 | uint32_t policy_flags[] = { |
17 | PROC_UUID_POLICY_FLAGS_NONE, | |
18 | PROC_UUID_NO_CELLULAR, | |
19 | PROC_UUID_NECP_APP_POLICY, | |
20 | PROC_UUID_ALT_DYLD_POLICY | |
39037602 | 21 | }; |
813fb2f6 | 22 | |
39037602 A |
23 | for (i = 0; i < NUM_PROC_UUID_POLICY_FLAGS; i++) { |
24 | T_LOG("Testing policy add with flag value 0x%x", policy_flags[i]); | |
25 | ||
26 | /* Since UUID is null, this call should fail with errno = EINVAL. */ | |
27 | ret = proc_uuid_policy(PROC_UUID_POLICY_OPERATION_ADD, null_uuid, sizeof(uuid_t), policy_flags[i]); | |
28 | ||
29 | T_ASSERT_TRUE(ret == -1, "proc_uuid_policy returned %d", ret); | |
30 | T_WITH_ERRNO; | |
31 | T_ASSERT_TRUE(errno = EINVAL, "errno is %d", errno); | |
32 | } | |
33 | ||
34 | for (i = 0; i < NUM_PROC_UUID_POLICY_FLAGS; i++) { | |
35 | T_LOG("Testing policy remove with flag value 0x%x", policy_flags[i]); | |
36 | ||
37 | /* Since UUID is null, this call should fail with errno = EINVAL. */ | |
38 | ret = proc_uuid_policy(PROC_UUID_POLICY_OPERATION_REMOVE, null_uuid, sizeof(uuid_t), policy_flags[i]); | |
39 | ||
40 | T_ASSERT_TRUE(ret == -1, "proc_uuid_policy returned %d", ret); | |
41 | T_WITH_ERRNO; | |
42 | T_ASSERT_TRUE(errno = EINVAL, "errno is %d", errno); | |
43 | } | |
39037602 | 44 | } |