Index: tests/exception_test/exception_test.c |
diff --git a/tests/exception_test/exception_test.c b/tests/exception_test/exception_test.c |
index b00d3a40a7e51a235b88777619ec269947818276..4adc77251f27049ea5c848e6da8d19da4a37bc77 100644 |
--- a/tests/exception_test/exception_test.c |
+++ b/tests/exception_test/exception_test.c |
@@ -122,6 +122,7 @@ void simple_exception_handler(struct NaClExceptionContext *regs) { |
void exception_handler(struct NaClExceptionContext *context); |
REGS_SAVER_FUNC_NOPROTO(exception_handler, exception_handler_wrapped); |
+__attribute__((__used__)) |
Junichi Uekawa
2014/09/09 12:23:58
inline assembly is something external in pexe, so
|
void exception_handler_wrapped(struct NaClSignalContext *entry_regs) { |
struct NaClExceptionContext *context = |
(struct NaClExceptionContext *) RegsGetArg1(entry_regs); |
@@ -200,12 +201,15 @@ void test_exception_stack_with_size(char *stack, size_t stack_size) { |
printf("failed to set exception handler\n"); |
exit(4); |
} |
- if (0 != nacl_exception_set_stack(stack, stack_size)) { |
- printf("failed to set alt stack\n"); |
- exit(5); |
+ if (!NONSFI_MODE) { |
+ /* TODO(uekawa): Implement set_stack on Non-SFI NaCl. */ |
+ if (0 != nacl_exception_set_stack(stack, stack_size)) { |
+ printf("failed to set alt stack\n"); |
+ exit(5); |
+ } |
+ g_registered_stack = stack; |
+ g_registered_stack_size = stack_size; |
} |
- g_registered_stack = stack; |
- g_registered_stack_size = stack_size; |
char crash_stack[0x1000]; |
RegsFillTestValues(&g_regs_at_crash, /* seed= */ 0); |
@@ -326,6 +330,8 @@ void test_catching_various_exception_types(void) { |
exit(1); |
} |
printf("Testing integer division by zero...\n"); |
+#if !NONSFI_MODE |
+ /* TODO(uekawa): Enable on Non-SFI NaCl. */ |
if (!setjmp(g_jmp_buf)) { |
uint32_t result; |
__asm__ volatile("idivb %1" |
@@ -334,13 +340,15 @@ void test_catching_various_exception_types(void) { |
exit(1); |
} |
#endif |
+#endif |
/* Clear the jmp_buf to prevent it from being reused accidentally. */ |
memset(g_jmp_buf, 0, sizeof(g_jmp_buf)); |
} |
-#if defined(__i386__) || defined(__x86_64__) |
+#if !NONSFI_MODE && (defined(__i386__) || defined(__x86_64__)) |
+/* TODO(uekawa): Enable on Non-SFI NaCl */ |
int get_x86_direction_flag(void); |
@@ -396,15 +404,22 @@ void run_test(const char *test_name, void (*test_func)(void)) { |
int TestMain(void) { |
RUN_TEST(test_exceptions_minimally); |
- RUN_TEST(test_exception_stack_alignments); |
- RUN_TEST(test_getting_previous_handler); |
- RUN_TEST(test_invalid_handlers); |
+ if (!NONSFI_MODE) { |
+ /* |
+ * The following tests are for SFI invariants which do not hold |
+ * true for Non-SFI mode. |
+ */ |
+ RUN_TEST(test_exception_stack_alignments); |
+ RUN_TEST(test_getting_previous_handler); |
+ RUN_TEST(test_invalid_handlers); |
+ } |
/* pthread_join() is broken under qemu-arm. */ |
if (getenv("UNDER_QEMU_ARM") == NULL) |
RUN_TEST(test_exceptions_on_non_main_thread); |
RUN_TEST(test_catching_various_exception_types); |
-#if defined(__i386__) || defined(__x86_64__) |
+#if !NONSFI_MODE && (defined(__i386__) || defined(__x86_64__)) |
+ /* TODO(uekawa): Enable these test for Non-SFI mode too. */ |
RUN_TEST(test_get_x86_direction_flag); |
RUN_TEST(test_unsetting_x86_direction_flag); |
#endif |