From fd2e00a020abf421072835e0564155d9583ff57f Mon Sep 17 00:00:00 2001 From: Ayrton Munoz Date: Tue, 15 Oct 2024 15:03:41 -0400 Subject: [PATCH] Remove needless macro defines and add missing headers --- misc/test_runner/include/ia2_test_runner.h | 3 +++ tests/destructors/main.c | 2 +- tests/heap_two_keys/main.c | 2 +- tests/heap_two_keys/plugin.c | 1 + tests/mmap_loop/main.c | 2 +- tests/protected_threads/main.c | 2 +- tests/read_config/main.c | 2 +- tests/recursion/main.c | 2 +- tests/ro_sharing/main.c | 2 +- tests/should_segfault/main.c | 4 ++-- tests/should_segfault/print_secret.c | 1 + tests/sighandler/lib.c | 2 +- tests/sighandler/main.c | 2 +- tests/threads/main.c | 2 +- tests/three_keys_minimal/main.c | 2 +- tests/tls_protected/main.c | 2 +- tests/trusted_direct/main.c | 2 +- tests/trusted_indirect/main.c | 2 +- tests/two_keys_minimal/main.c | 2 +- tests/two_shared_ranges/main.c | 2 +- tests/untrusted_indirect/main.c | 2 +- 21 files changed, 24 insertions(+), 19 deletions(-) diff --git a/misc/test_runner/include/ia2_test_runner.h b/misc/test_runner/include/ia2_test_runner.h index d3bb7b85d..c7e217b51 100644 --- a/misc/test_runner/include/ia2_test_runner.h +++ b/misc/test_runner/include/ia2_test_runner.h @@ -1,6 +1,9 @@ #pragma once #include #include +#include +#include +#include struct fake_criterion_test { void (*test)(void); diff --git a/tests/destructors/main.c b/tests/destructors/main.c index 6d6ba2d88..9f99a5c71 100644 --- a/tests/destructors/main.c +++ b/tests/destructors/main.c @@ -5,7 +5,7 @@ #include #include #include "plugin.h" -#define IA2_DEFINE_TEST_HANDLER + // This test uses two protection keys diff --git a/tests/heap_two_keys/main.c b/tests/heap_two_keys/main.c index d902075a7..66ceab222 100644 --- a/tests/heap_two_keys/main.c +++ b/tests/heap_two_keys/main.c @@ -9,7 +9,7 @@ RUN: sh -c 'if [ ! -s "heap_two_keys_call_gates_0.ld" ]; then echo "No link args #include #include #include "plugin.h" -#define IA2_DEFINE_TEST_HANDLER + // This test uses two protection keys diff --git a/tests/heap_two_keys/plugin.c b/tests/heap_two_keys/plugin.c index 4e8a5955b..1d0951808 100644 --- a/tests/heap_two_keys/plugin.c +++ b/tests/heap_two_keys/plugin.c @@ -1,6 +1,7 @@ /* RUN: cat heap_two_keys_call_gates_1.ld | FileCheck --check-prefix=LINKARGS %s */ +#include #include #include #include "exported_fn.h" diff --git a/tests/mmap_loop/main.c b/tests/mmap_loop/main.c index 48eda97b7..17ef469fb 100644 --- a/tests/mmap_loop/main.c +++ b/tests/mmap_loop/main.c @@ -8,7 +8,7 @@ RUN: sh -c 'if [ ! -s "mmap_loop_call_gates_0.ld" ]; then echo "No link args as #include #include -#define IA2_DEFINE_TEST_HANDLER + /* diff --git a/tests/protected_threads/main.c b/tests/protected_threads/main.c index 906f5e992..f4b512e2e 100644 --- a/tests/protected_threads/main.c +++ b/tests/protected_threads/main.c @@ -7,7 +7,7 @@ RUN: sh -c 'if [ ! -s "protected_threads_call_gates_0.ld" ]; then echo "No link #include #include #include -#define IA2_DEFINE_TEST_HANDLER + #include #include diff --git a/tests/read_config/main.c b/tests/read_config/main.c index 9a37af621..b0ee39e81 100644 --- a/tests/read_config/main.c +++ b/tests/read_config/main.c @@ -14,7 +14,7 @@ RUN: cat main.c | FileCheck --match-full-lines --check-prefix=REWRITER %s // need wrapped function pointer definitions. For now just hack around this by // including plugin.h (which does include the output header) before core.h. #include "core.h" -#define IA2_DEFINE_TEST_HANDLER + /* diff --git a/tests/recursion/main.c b/tests/recursion/main.c index 6ea345116..67a934261 100644 --- a/tests/recursion/main.c +++ b/tests/recursion/main.c @@ -7,7 +7,7 @@ RUN: cat recursion_call_gates_2.ld | FileCheck --check-prefix=LINKARGS %s #include #include -#define IA2_DEFINE_TEST_HANDLER + INIT_RUNTIME(2); diff --git a/tests/ro_sharing/main.c b/tests/ro_sharing/main.c index 987279c7c..b1aaa0f73 100644 --- a/tests/ro_sharing/main.c +++ b/tests/ro_sharing/main.c @@ -6,7 +6,7 @@ RUN: sh -c 'if [ ! -s "ro_sharing_call_gates_0.ld" ]; then echo "No link args as #include #include #include -#define IA2_DEFINE_TEST_HANDLER + // This test checks that all RO data mapped in from executable files is shared. diff --git a/tests/should_segfault/main.c b/tests/should_segfault/main.c index b526e194c..71b077276 100644 --- a/tests/should_segfault/main.c +++ b/tests/should_segfault/main.c @@ -7,7 +7,7 @@ RUN: sh -c 'if [ ! -s "should_segfault_call_gates_0.ld" ]; then echo "No link ar #include #include #include -#define IA2_DEFINE_TEST_HANDLER + INIT_RUNTIME(1); @@ -30,4 +30,4 @@ Test(should_segfault, main) { Test(should_segfault, early_fault, .exit_code = 255) { do_early_fault(); print_secret(); -} \ No newline at end of file +} diff --git a/tests/should_segfault/print_secret.c b/tests/should_segfault/print_secret.c index 92d31b250..1b86cba92 100644 --- a/tests/should_segfault/print_secret.c +++ b/tests/should_segfault/print_secret.c @@ -5,6 +5,7 @@ RUN: cat should_segfault_call_gates_1.ld | FileCheck --check-prefix=LINKARGS %s #include #include #include +#include #include "print_secret.h" diff --git a/tests/sighandler/lib.c b/tests/sighandler/lib.c index f9d46941a..e35eefc35 100644 --- a/tests/sighandler/lib.c +++ b/tests/sighandler/lib.c @@ -7,7 +7,7 @@ RUN: cat sighandler_call_gates_1.ld | FileCheck --check-prefix=LINKARGS %s #include #include -#define IA2_DEFINE_TEST_HANDLER + #define IA2_COMPARTMENT 2 diff --git a/tests/sighandler/main.c b/tests/sighandler/main.c index ac5b98c90..f3f18cbf9 100644 --- a/tests/sighandler/main.c +++ b/tests/sighandler/main.c @@ -7,7 +7,7 @@ We need this because lib.c uses LINKARGS checks but not this file. #include #include #include -#define IA2_DEFINE_TEST_HANDLER + #include diff --git a/tests/threads/main.c b/tests/threads/main.c index a5f4bc092..f9f77d773 100644 --- a/tests/threads/main.c +++ b/tests/threads/main.c @@ -9,7 +9,7 @@ RUN: sh -c 'if [ ! -s "threads_call_gates_0.ld" ]; then echo "No link args as ex #include #include #include -#define IA2_DEFINE_TEST_HANDLER + #include diff --git a/tests/three_keys_minimal/main.c b/tests/three_keys_minimal/main.c index 3ec379acf..e13278fd6 100644 --- a/tests/three_keys_minimal/main.c +++ b/tests/three_keys_minimal/main.c @@ -10,7 +10,7 @@ INIT_RUNTIME(3); #include #include -#define IA2_DEFINE_TEST_HANDLER + void main_noop(void) { diff --git a/tests/tls_protected/main.c b/tests/tls_protected/main.c index 800959ec1..5f9319ce1 100644 --- a/tests/tls_protected/main.c +++ b/tests/tls_protected/main.c @@ -5,7 +5,7 @@ #include #include #include -#define IA2_DEFINE_TEST_HANDLER + #include diff --git a/tests/trusted_direct/main.c b/tests/trusted_direct/main.c index 420a5edf2..87ff0bdde 100644 --- a/tests/trusted_direct/main.c +++ b/tests/trusted_direct/main.c @@ -9,7 +9,7 @@ RUN: cat trusted_direct_call_gates_0.ld | FileCheck --check-prefix=LINKARGS %s #include #include "plugin.h" -#define IA2_DEFINE_TEST_HANDLER + // This test checks that an untrusted library can call a trusted main binary. An diff --git a/tests/trusted_indirect/main.c b/tests/trusted_indirect/main.c index a081743f4..8ca0d80c2 100644 --- a/tests/trusted_indirect/main.c +++ b/tests/trusted_indirect/main.c @@ -6,7 +6,7 @@ RUN: sh -c 'if [ ! -s "trusted_indirect_call_gates_0.ld" ]; then echo "No link a #include "rand_op.h" #include -#define IA2_DEFINE_TEST_HANDLER + /* diff --git a/tests/two_keys_minimal/main.c b/tests/two_keys_minimal/main.c index f45bda940..76d26ff3a 100644 --- a/tests/two_keys_minimal/main.c +++ b/tests/two_keys_minimal/main.c @@ -11,7 +11,7 @@ RUN: cat two_keys_minimal_call_gates_2.ld | FileCheck --check-prefix=LINKARGS %s #include #include #include "plugin.h" -#define IA2_DEFINE_TEST_HANDLER + // This test uses two protection keys diff --git a/tests/two_shared_ranges/main.c b/tests/two_shared_ranges/main.c index f28500de6..b3e4027e3 100644 --- a/tests/two_shared_ranges/main.c +++ b/tests/two_shared_ranges/main.c @@ -9,7 +9,7 @@ RUN: cat two_shared_ranges_call_gates_2.ld | FileCheck --check-prefix=LINKARGS % #include #include #include "plugin.h" -#define IA2_DEFINE_TEST_HANDLER + // This test uses two protection keys diff --git a/tests/untrusted_indirect/main.c b/tests/untrusted_indirect/main.c index 5aef33494..ae72570ab 100644 --- a/tests/untrusted_indirect/main.c +++ b/tests/untrusted_indirect/main.c @@ -6,7 +6,7 @@ RUN: sh -c 'if [ ! -s "untrusted_indirect_call_gates_0.ld" ]; then echo "No link #include #include "foo.h" #include -#define IA2_DEFINE_TEST_HANDLER + INIT_RUNTIME(1);