| OLD | NEW |
| 1 # -*- python -*- | 1 # -*- python -*- |
| 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 Import('env') | 6 Import('env') |
| 7 | 7 |
| 8 trusted_env = env.get('TRUSTED_ENV') | 8 trusted_env = env.get('TRUSTED_ENV') |
| 9 if trusted_env is None: | 9 if trusted_env is None: |
| 10 Return() | 10 Return() |
| 11 | 11 |
| 12 env.ComponentProgram('crash_test.nexe', 'crash_test.c') | 12 crash_test_nexe = env.ComponentProgram('crash_test', 'crash_test.c') |
| 13 env.ComponentProgram('crash_in_syscall.nexe', 'crash_in_syscall.c', | 13 crash_in_syscall_nexe = env.ComponentProgram('crash_in_syscall', |
| 14 EXTRA_LIBS=['imc_syscalls']) | 14 'crash_in_syscall.c', |
| 15 EXTRA_LIBS=['imc_syscalls']) |
| 15 nodes = [] | 16 nodes = [] |
| 16 | 17 |
| 17 # Test that crashes in untrusted code are recognised as such. | 18 # Test that crashes in untrusted code are recognised as such. |
| 18 nodes.append(env.CommandSelLdrTestNacl( | 19 nodes.append(env.CommandSelLdrTestNacl( |
| 19 'untrusted_crash_test.out', command=[env.File('crash_test.nexe')], | 20 'untrusted_crash_test.out', |
| 21 crash_test_nexe, |
| 20 sel_ldr_flags=['-S'], | 22 sel_ldr_flags=['-S'], |
| 21 exit_status='untrusted_segfault', | 23 exit_status='untrusted_segfault', |
| 22 using_nacl_signal_handler='1')) | 24 using_nacl_signal_handler='1')) |
| 23 | 25 |
| 24 # Test that crashes in trusted code are recognised as such. | 26 # Test that crashes in trusted code are recognised as such. |
| 25 # This test covers crashes that occur outside of a syscall handler, | 27 # This test covers crashes that occur outside of a syscall handler, |
| 26 # before the NaClApp is set up. | 28 # before the NaClApp is set up. |
| 27 nodes.append(env.CommandSelLdrTestNacl( | 29 nodes.append(env.CommandSelLdrTestNacl( |
| 28 'trusted_crash_test.out', command=[env.File('crash_test.nexe')], | 30 'trusted_crash_test.out', |
| 31 crash_test_nexe, |
| 29 sel_ldr_flags=['-S'], | 32 sel_ldr_flags=['-S'], |
| 30 osenv='NACL_CRASH_TEST=1', | 33 osenv='NACL_CRASH_TEST=1', |
| 31 exit_status='trusted_segfault', | 34 exit_status='trusted_segfault', |
| 32 using_nacl_signal_handler='1')) | 35 using_nacl_signal_handler='1')) |
| 33 | 36 |
| 34 # This tests a crash that occurs inside a syscall handler. | 37 # This tests a crash that occurs inside a syscall handler. |
| 35 nodes.append(env.CommandSelLdrTestNacl( | 38 nodes.append(env.CommandSelLdrTestNacl( |
| 36 'crash_in_syscall_test.out', | 39 'crash_in_syscall_test.out', |
| 37 command=[env.File('crash_in_syscall.nexe')], | 40 crash_in_syscall_nexe, |
| 38 sel_ldr_flags=['-S'], | 41 sel_ldr_flags=['-S'], |
| 39 # Ultimately this should be recognised as a crash caused by | 42 # Ultimately this should be recognised as a crash caused by |
| 40 # untrusted code. | 43 # untrusted code. |
| 41 # See http://code.google.com/p/nativeclient/issues/detail?id=579 | 44 # See http://code.google.com/p/nativeclient/issues/detail?id=579 |
| 42 exit_status='trusted_segfault', | 45 exit_status='trusted_segfault', |
| 43 using_nacl_signal_handler='1')) | 46 using_nacl_signal_handler='1')) |
| 44 | 47 |
| 45 env.AddNodeToTestSuite(nodes, ['small_tests'], 'run_signal_handler_test', | 48 env.AddNodeToTestSuite(nodes, ['small_tests'], 'run_signal_handler_test', |
| 46 is_broken=env.IsRunningUnderValgrind()) | 49 is_broken=env.IsRunningUnderValgrind()) |
| OLD | NEW |