Skip to content

Commit

Permalink
Remove needless macro defines and add missing headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ayrtonm committed Oct 22, 2024
1 parent 7079d5b commit fe54d5f
Show file tree
Hide file tree
Showing 21 changed files with 24 additions and 19 deletions.
3 changes: 3 additions & 0 deletions misc/test_runner/include/ia2_test_runner.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#pragma once
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>

struct fake_criterion_test {
void (*test)(void);
Expand Down
2 changes: 1 addition & 1 deletion tests/destructors/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <unistd.h>
#include <ia2.h>
#include "plugin.h"
#define IA2_DEFINE_TEST_HANDLER



// This test uses two protection keys
Expand Down
2 changes: 1 addition & 1 deletion tests/heap_two_keys/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN: sh -c 'if [ ! -s "heap_two_keys_call_gates_0.ld" ]; then echo "No link args
#include <ia2.h>
#include <ia2_allocator.h>
#include "plugin.h"
#define IA2_DEFINE_TEST_HANDLER



// This test uses two protection keys
Expand Down
1 change: 1 addition & 0 deletions tests/heap_two_keys/plugin.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
RUN: cat heap_two_keys_call_gates_1.ld | FileCheck --check-prefix=LINKARGS %s
*/
#include <ia2_test_runner.h>
#include <stdio.h>
#include <ia2.h>
#include "exported_fn.h"
Expand Down
2 changes: 1 addition & 1 deletion tests/mmap_loop/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN: sh -c 'if [ ! -s "mmap_loop_call_gates_0.ld" ]; then echo "No link args as
#include <stdio.h>
#include <ia2_test_runner.h>

#define IA2_DEFINE_TEST_HANDLER



/*
Expand Down
2 changes: 1 addition & 1 deletion tests/protected_threads/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN: sh -c 'if [ ! -s "protected_threads_call_gates_0.ld" ]; then echo "No link
#include <pthread.h>
#include <string.h>
#include <sys/wait.h>
#define IA2_DEFINE_TEST_HANDLER

#include <ia2_test_runner.h>

#include <unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion tests/read_config/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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



/*
Expand Down
2 changes: 1 addition & 1 deletion tests/recursion/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN: cat recursion_call_gates_2.ld | FileCheck --check-prefix=LINKARGS %s

#include <ia2.h>
#include <stdio.h>
#define IA2_DEFINE_TEST_HANDLER



INIT_RUNTIME(2);
Expand Down
2 changes: 1 addition & 1 deletion tests/ro_sharing/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN: sh -c 'if [ ! -s "ro_sharing_call_gates_0.ld" ]; then echo "No link args as
#include <plugin.h>
#include <ia2.h>
#include <stdio.h>
#define IA2_DEFINE_TEST_HANDLER



// This test checks that all RO data mapped in from executable files is shared.
Expand Down
4 changes: 2 additions & 2 deletions tests/should_segfault/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN: sh -c 'if [ ! -s "should_segfault_call_gates_0.ld" ]; then echo "No link ar
#include <stdint.h>
#include <print_secret.h>
#include <ia2.h>
#define IA2_DEFINE_TEST_HANDLER



INIT_RUNTIME(1);
Expand All @@ -30,4 +30,4 @@ Test(should_segfault, main) {
Test(should_segfault, early_fault, .exit_code = 255) {
do_early_fault();
print_secret();
}
}
1 change: 1 addition & 0 deletions tests/should_segfault/print_secret.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RUN: cat should_segfault_call_gates_1.ld | FileCheck --check-prefix=LINKARGS %s
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <signal.h>
#include "print_secret.h"


Expand Down
2 changes: 1 addition & 1 deletion tests/sighandler/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN: cat sighandler_call_gates_1.ld | FileCheck --check-prefix=LINKARGS %s
#include <ia2.h>
#include <ia2_test_runner.h>

#define IA2_DEFINE_TEST_HANDLER



#define IA2_COMPARTMENT 2
Expand Down
2 changes: 1 addition & 1 deletion tests/sighandler/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ We need this because lib.c uses LINKARGS checks but not this file.
#include <stddef.h>
#include <signal.h>
#include <ia2.h>
#define IA2_DEFINE_TEST_HANDLER


#include <ia2_test_runner.h>

Expand Down
2 changes: 1 addition & 1 deletion tests/threads/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN: sh -c 'if [ ! -s "threads_call_gates_0.ld" ]; then echo "No link args as ex
#include <pthread.h>
#include <string.h>
#include <sys/wait.h>
#define IA2_DEFINE_TEST_HANDLER


#include <unistd.h>

Expand Down
2 changes: 1 addition & 1 deletion tests/three_keys_minimal/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ INIT_RUNTIME(3);
#include <ia2_compartment_init.inc>
#include <threads.h>

#define IA2_DEFINE_TEST_HANDLER



void main_noop(void) {
Expand Down
2 changes: 1 addition & 1 deletion tests/tls_protected/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <unistd.h>
#define IA2_DEFINE_TEST_HANDLER


#include <threads.h>

Expand Down
2 changes: 1 addition & 1 deletion tests/trusted_direct/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN: cat trusted_direct_call_gates_0.ld | FileCheck --check-prefix=LINKARGS %s

#include <ia2.h>
#include "plugin.h"
#define IA2_DEFINE_TEST_HANDLER



// This test checks that an untrusted library can call a trusted main binary. An
Expand Down
2 changes: 1 addition & 1 deletion tests/trusted_indirect/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ia2.h>
#define IA2_DEFINE_TEST_HANDLER



/*
Expand Down
2 changes: 1 addition & 1 deletion tests/two_keys_minimal/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN: cat two_keys_minimal_call_gates_2.ld | FileCheck --check-prefix=LINKARGS %s
#include <unistd.h>
#include <ia2.h>
#include "plugin.h"
#define IA2_DEFINE_TEST_HANDLER



// This test uses two protection keys
Expand Down
2 changes: 1 addition & 1 deletion tests/two_shared_ranges/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN: cat two_shared_ranges_call_gates_2.ld | FileCheck --check-prefix=LINKARGS %
#include <unistd.h>
#include <ia2.h>
#include "plugin.h"
#define IA2_DEFINE_TEST_HANDLER



// This test uses two protection keys
Expand Down
2 changes: 1 addition & 1 deletion tests/untrusted_indirect/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN: sh -c 'if [ ! -s "untrusted_indirect_call_gates_0.ld" ]; then echo "No link
#include <stdint.h>
#include "foo.h"
#include <ia2.h>
#define IA2_DEFINE_TEST_HANDLER



INIT_RUNTIME(1);
Expand Down

0 comments on commit fe54d5f

Please sign in to comment.