| 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 # The test works with PNaCl-ARM but not with PNaCl-x86, because the | 8 # The test works with PNaCl-ARM but not with PNaCl-x86, because the |
| 9 # assembler #defines __arm__ rather than __i386__ or __x86_64__ even | 9 # assembler #defines __arm__ rather than __i386__ or __x86_64__ even |
| 10 # when we are targetting x86. | 10 # when we are targetting x86. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 asm_env.Append(ASFLAGS=['-arch', '${TARGET_FULLARCH}']) | 34 asm_env.Append(ASFLAGS=['-arch', '${TARGET_FULLARCH}']) |
| 35 | 35 |
| 36 template_obj = asm_env.ComponentObject(GetTemplate(env)) | 36 template_obj = asm_env.ComponentObject(GetTemplate(env)) |
| 37 | 37 |
| 38 prog_env = env.Clone() | 38 prog_env = env.Clone() |
| 39 | 39 |
| 40 if env.Bit('bitcode'): | 40 if env.Bit('bitcode'): |
| 41 prog_env.AddBiasForPNaCl() | 41 prog_env.AddBiasForPNaCl() |
| 42 prog_env.Append(LINKFLAGS=['--pnacl-allow-native']) | 42 prog_env.Append(LINKFLAGS=['--pnacl-allow-native']) |
| 43 | 43 |
| 44 dynamic_load_test_nexe_name = ('dynamic_load_test_%s.nexe' % | 44 dynamic_load_test_nexe_name = ('dynamic_load_test_%s' % |
| 45 env.get('TARGET_FULLARCH')) | 45 env.get('TARGET_FULLARCH')) |
| 46 dynamic_load_test_nexe = prog_env.ComponentProgram( | 46 dynamic_load_test_nexe = prog_env.ComponentProgram( |
| 47 dynamic_load_test_nexe_name, | 47 dynamic_load_test_nexe_name, |
| 48 ['dynamic_load_test.c', | 48 ['dynamic_load_test.c', |
| 49 template_obj], | 49 template_obj], |
| 50 EXTRA_LIBS=[ | 50 EXTRA_LIBS=[ |
| 51 'testrunner', | 51 'testrunner', |
| 52 'nacl_dyncode', | 52 'nacl_dyncode', |
| 53 'srpc', | 53 'srpc', |
| 54 'imc_syscalls', | 54 'imc_syscalls', |
| 55 'platform', | 55 'platform', |
| 56 'gio', | 56 'gio', |
| 57 'pthread']) | 57 'pthread']) |
| 58 env.Publish(dynamic_load_test_nexe_name, 'run', ['dynamic_load_test.nmf']) | 58 env.Publish(dynamic_load_test_nexe_name, 'run', ['dynamic_load_test.nmf']) |
| 59 | 59 |
| 60 dynamic_modify_test_nexe_name = ('dynamic_modify_test_%s.nexe' % | 60 dynamic_modify_test_nexe_name = ('dynamic_modify_test_%s' % |
| 61 env.get('TARGET_FULLARCH')) | 61 env.get('TARGET_FULLARCH')) |
| 62 dynamic_modify_test_nexe = prog_env.ComponentProgram( | 62 dynamic_modify_test_nexe = prog_env.ComponentProgram( |
| 63 dynamic_modify_test_nexe_name, | 63 dynamic_modify_test_nexe_name, |
| 64 ['dynamic_modify_test.c', | 64 ['dynamic_modify_test.c', |
| 65 template_obj], | 65 template_obj], |
| 66 EXTRA_LIBS=[ | 66 EXTRA_LIBS=[ |
| 67 'testrunner', | 67 'testrunner', |
| 68 'nacl_dyncode', | 68 'nacl_dyncode', |
| 69 'srpc', | 69 'srpc', |
| 70 'imc_syscalls', | 70 'imc_syscalls', |
| 71 'platform', | 71 'platform', |
| 72 'gio', | 72 'gio', |
| 73 'pthread']) | 73 'pthread']) |
| 74 env.Publish(dynamic_modify_test_nexe_name, 'run', ['dynamic_modify_test.nmf']) | 74 env.Publish(dynamic_modify_test_nexe_name, 'run', ['dynamic_modify_test.nmf']) |
| 75 | 75 |
| 76 prog_env.ComponentProgram('write_to_dyncode.nexe', | 76 write_to_dyncode_nexe = prog_env.ComponentProgram('write_to_dyncode', |
| 77 ['write_to_dyncode.c']) | 77 ['write_to_dyncode.c']) |
| 78 | 78 |
| 79 prog_env.ComponentProgram('dyncode_disabled_test.nexe', | 79 dyncode_disabled_test_nexe = prog_env.ComponentProgram( |
| 80 ['dyncode_disabled_test.c'], | 80 'dyncode_disabled_test', |
| 81 EXTRA_LIBS=['nacl_dyncode']) | 81 ['dyncode_disabled_test.c'], |
| 82 EXTRA_LIBS=['nacl_dyncode']) |
| 82 | 83 |
| 83 prog_env.ComponentProgram('debug_mode_test.nexe', | 84 debug_mode_test_nexe = prog_env.ComponentProgram('debug_mode_test', |
| 84 ['debug_mode_test.c', | 85 ['debug_mode_test.c', |
| 85 template_obj], | 86 template_obj], |
| 86 EXTRA_LIBS=['nacl_dyncode']) | 87 EXTRA_LIBS=['nacl_dyncode']) |
| 87 | 88 |
| 88 prog_env.ComponentProgram('dyncode_demand_alloc_test.nexe', | 89 dyncode_demand_alloc_test_nexe = prog_env.ComponentProgram( |
| 89 ['dyncode_demand_alloc_test.c'], | 90 'dyncode_demand_alloc_test', |
| 90 EXTRA_LIBS=['nacl_dyncode']) | 91 ['dyncode_demand_alloc_test.c'], |
| 92 EXTRA_LIBS=['nacl_dyncode']) |
| 91 | 93 |
| 92 tests = [ | 94 tests = [ |
| 93 prog_env.CommandSelLdrTestNacl( | 95 prog_env.CommandSelLdrTestNacl( |
| 94 'dynamic_load_test.out', | 96 'dynamic_load_test.out', |
| 95 command=[dynamic_load_test_nexe], | 97 dynamic_load_test_nexe, |
| 96 # We need to set this because the test needs to behave | 98 # We need to set this because the test needs to behave |
| 97 # differently in the plugin, but the plugin does not provide a | 99 # differently in the plugin, but the plugin does not provide a |
| 98 # way to distinguish itself. TODO(mseaborn): Fix that. | 100 # way to distinguish itself. TODO(mseaborn): Fix that. |
| 99 # See http://code.google.com/p/nativeclient/issues/detail?id=889 | 101 # See http://code.google.com/p/nativeclient/issues/detail?id=889 |
| 100 sel_ldr_flags=['-E', 'NACL_SRPC_STANDALONE=1'], | 102 sel_ldr_flags=['-E', 'NACL_SRPC_STANDALONE=1'], |
| 101 ), | 103 ), |
| 102 prog_env.CommandSelLdrTestNacl( | 104 prog_env.CommandSelLdrTestNacl( |
| 103 'write_to_dyncode.out', | 105 'write_to_dyncode.out', |
| 104 command=[prog_env.File('write_to_dyncode.nexe')], | 106 write_to_dyncode_nexe, |
| 105 exit_status='untrusted_segfault', | 107 exit_status='untrusted_segfault', |
| 106 stdout_golden=prog_env.File('write_to_dyncode.stdout'), | 108 stdout_golden=prog_env.File('write_to_dyncode.stdout'), |
| 107 ), | 109 ), |
| 108 prog_env.CommandSelLdrTestNacl( | 110 prog_env.CommandSelLdrTestNacl( |
| 109 'dyncode_disabled_test.out', | 111 'dyncode_disabled_test.out', |
| 110 command=[prog_env.File('dyncode_disabled_test.nexe')], | 112 dyncode_disabled_test_nexe, |
| 111 osenv='NACL_DISABLE_DYNAMIC_LOADING=1', | 113 osenv='NACL_DISABLE_DYNAMIC_LOADING=1', |
| 112 ), | 114 ), |
| 113 prog_env.CommandSelLdrTestNacl( | 115 prog_env.CommandSelLdrTestNacl( |
| 114 'debug_mode_test.out', | 116 'debug_mode_test.out', |
| 117 debug_mode_test_nexe, |
| 115 # NOTE: the data we are loading does not pass the validator | 118 # NOTE: the data we are loading does not pass the validator |
| 116 sel_ldr_flags=["-c"], | 119 sel_ldr_flags=["-c"], |
| 117 command=[prog_env.File('debug_mode_test.nexe')], | |
| 118 ), | 120 ), |
| 119 # This tests, from untrusted code, that dyncode pages are | 121 # This tests, from untrusted code, that dyncode pages are |
| 120 # inaccessible before they are allocated. | 122 # inaccessible before they are allocated. |
| 121 prog_env.CommandSelLdrTestNacl( | 123 prog_env.CommandSelLdrTestNacl( |
| 122 'dyncode_demand_alloc_test.out', | 124 'dyncode_demand_alloc_test.out', |
| 123 command=[prog_env.File('dyncode_demand_alloc_test.nexe')], | 125 dyncode_demand_alloc_test_nexe, |
| 124 exit_status='untrusted_segfault', | 126 exit_status='untrusted_segfault', |
| 125 stdout_golden=prog_env.File('dyncode_demand_alloc_test.stdout'), | 127 stdout_golden=prog_env.File('dyncode_demand_alloc_test.stdout'), |
| 126 ), | 128 ), |
| 127 ] | 129 ] |
| 128 if not prog_env.Bit('target_arm'): | 130 if not prog_env.Bit('target_arm'): |
| 129 tests.append(prog_env.CommandSelLdrTestNacl( | 131 tests.append(prog_env.CommandSelLdrTestNacl( |
| 130 'dynamic_modify_test.out', | 132 'dynamic_modify_test.out', |
| 131 command=[dynamic_modify_test_nexe], | 133 dynamic_modify_test_nexe, |
| 132 sel_ldr_flags=['-E', 'NACL_SRPC_STANDALONE=1'])) | 134 sel_ldr_flags=['-E', 'NACL_SRPC_STANDALONE=1'])) |
| 133 | 135 |
| 134 # TODO(kcc): non-standard linking options confuse Valgrind debug info reader. | 136 # TODO(kcc): non-standard linking options confuse Valgrind debug info reader. |
| 135 # See http://code.google.com/p/nativeclient/issues/detail?id=1606 | 137 # See http://code.google.com/p/nativeclient/issues/detail?id=1606 |
| 136 is_broken = prog_env.IsRunningUnderValgrind() | 138 is_broken = prog_env.IsRunningUnderValgrind() |
| 137 prog_env.AddNodeToTestSuite(tests, | 139 prog_env.AddNodeToTestSuite(tests, |
| 138 ['small_tests', 'sel_ldr_tests'], | 140 ['small_tests', 'sel_ldr_tests'], |
| 139 'run_dynamic_load_test', | 141 'run_dynamic_load_test', |
| 140 is_broken=is_broken) | 142 is_broken=is_broken) |
| OLD | NEW |