static void test_optab(void) { static const struct entry t[] = { #include "../optab.h" }; printf("Testing optab...\n"); #define I2S(I) audit_operator_to_symbol(I) TEST_I2S(0); #undef I2S }
static void test_msg_typetab(void) { static const struct entry t[] = { #include "../msg_typetab.h" }; printf("Testing msg_typetab...\n"); #define I2S(I) audit_msg_type_to_name(I) #define S2I(S) audit_name_to_msg_type(S) TEST_I2S(0); TEST_S2I(-1); #undef I2S #undef S2I }
static void test_fieldtab(void) { static const struct entry t[] = { #include "../fieldtab.h" }; printf("Testing fieldtab...\n"); #define I2S(I) audit_field_to_name(I) #define S2I(S) audit_name_to_field(S) TEST_I2S(strcmp(t[i].s, "loginuid") == 0); TEST_S2I(-1); #undef I2S #undef S2I }
static void test_x86_64_table(void) { static const struct entry t[] = { #include "../x86_64_table.h" }; printf("Testing x86_64_table...\n"); #define I2S(I) audit_syscall_to_name((I), MACH_86_64) #define S2I(S) audit_name_to_syscall((S), MACH_86_64) TEST_I2S(0); TEST_S2I(-1); #undef I2S #undef S2I }
static void test_i386_table(void) { static const struct entry t[] = { #include "../i386_table.h" }; printf("Testing i386_table...\n"); #define I2S(I) audit_syscall_to_name((I), MACH_X86) #define S2I(S) audit_name_to_syscall((S), MACH_X86) TEST_I2S(strcmp(t[i].s, "madvise1") == 0); TEST_S2I(-1); #undef I2S #undef S2I }
static void test_errtab(void) { static const struct entry t[] = { #include "../errtab.h" }; printf("Testing errtab...\n"); #define I2S(I) audit_errno_to_name(I) #define S2I(S) audit_name_to_errno(S) TEST_I2S(strcmp(t[i].s, "EWOULDBLOCK") == 0 || strcmp(t[i].s, "EDEADLOCK") == 0); TEST_S2I(0); #undef I2S #undef S2I }
static void test_machinetab(void) { static const struct entry t[] = { #include "../machinetab.h" }; printf("Testing machinetab...\n"); #define I2S(I) audit_machine_to_name(I) #define S2I(S) audit_name_to_machine(S) TEST_I2S(t[i].s[0] == 'i' && t[i].s[1] >= '4' && t[i].s[1] <= '6' && strcmp(t[i].s + 2, "86") == 0); TEST_S2I(-1); #undef I2S #undef S2I }