Chromium Code Reviews| 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..ea8a3464733dcd493b286d8656580e7f01dc945c 100644 |
| --- a/tests/exception_test/exception_test.c |
| +++ b/tests/exception_test/exception_test.c |
| @@ -182,8 +182,16 @@ void exception_handler_wrapped(struct NaClSignalContext *entry_regs) { |
| assert(frame_base % STACK_ALIGNMENT == 0); |
| char *frame_top = (char *) (frame_base + kArgSizeOnStack + |
| sizeof(struct CombinedContext)); |
| - /* Check that no more than the stack alignment size is wasted. */ |
| - assert(stack_top - STACK_ALIGNMENT < frame_top); |
| + if (NONSFI_MODE) { |
|
Mark Seaborn
2014/09/30 01:12:01
Would you mind undoing these changes in this file
Junichi Uekawa
2014/09/30 01:19:07
I've removed the changes related to making the tes
|
| + /* |
| + * Non-SFI mode exception stack will have ucontext_t and |
| + * siginfo_t, which would be anywhere from 400 bytes to 1.5k |
| + */ |
| + assert(stack_top - 1500 < frame_top); |
| + } else { |
| + /* Check that no more than the stack alignment size is wasted. */ |
| + assert(stack_top - STACK_ALIGNMENT < frame_top); |
| + } |
| assert(frame_top <= stack_top); |
| #if defined(__x86_64__) |
| @@ -200,12 +208,15 @@ void test_exception_stack_with_size(char *stack, size_t stack_size) { |
| printf("failed to set exception handler\n"); |
| exit(4); |
| } |
| +#if !NONSFI_MODE |
| + /* TODO(uekawa): Implement set_stack for Non-SFI mode. */ |
| 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; |
| +#endif |
| char crash_stack[0x1000]; |
| RegsFillTestValues(&g_regs_at_crash, /* seed= */ 0); |
| @@ -314,7 +325,7 @@ void test_catching_various_exception_types(void) { |
| exit(1); |
| } |
| -#if defined(__i386__) || defined(__x86_64__) |
| +#if !NONSFI_MODE && (defined(__i386__) || defined(__x86_64__)) |
| printf("Testing hlt...\n"); |
| if (!setjmp(g_jmp_buf)) { |
| __asm__("hlt"); |
| @@ -340,7 +351,7 @@ void test_catching_various_exception_types(void) { |
| } |
| -#if defined(__i386__) || defined(__x86_64__) |
| +#if !NONSFI_MODE && (defined(__i386__) || defined(__x86_64__)) |
| int get_x86_direction_flag(void); |
| @@ -396,15 +407,21 @@ 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) { |
| + /* TODO(uekawa): Implement set_stack for Non-SFI mode. */ |
| + RUN_TEST(test_exception_stack_alignments); |
| + /* NACL_SYSCALL not supported on nonsfi mode */ |
| + RUN_TEST(test_getting_previous_handler); |
| + /* Those handlers are not invalid in NonSFI NaCl. */ |
| + 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): Implement for Non-SFI mode. */ |
| RUN_TEST(test_get_x86_direction_flag); |
| RUN_TEST(test_unsetting_x86_direction_flag); |
| #endif |