OLD | NEW |
1 # -*- python -*- | 1 # -*- python -*- |
2 # Copyright 2010 The Native Client Authors. All rights reserved. | 2 # Copyright 2010 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can | 3 # Use of this source code is governed by a BSD-style license that can |
4 # be found in the LICENSE file. | 4 # be found in the LICENSE file. |
5 | 5 |
6 | 6 |
7 Import('env') | 7 Import('env') |
8 | 8 |
9 # TODO(robertm): explore if/why this overly restrictive guard is necessary | 9 # TODO(robertm): explore if/why this overly restrictive guard is necessary |
10 if env.Bit('bitcode'): | 10 if env.Bit('bitcode'): |
11 Return() | 11 Return() |
12 | 12 |
13 # TODO(mseaborn): Extend the ARM validator to support this. | 13 # TODO(mseaborn): Extend the ARM validator to support this. |
14 if env.Bit('build_arm'): | 14 if env.Bit('build_arm'): |
15 Return() | 15 Return() |
16 | 16 |
17 if 'TRUSTED_ENV' not in env: | 17 if 'TRUSTED_ENV' not in env: |
18 Return() | 18 Return() |
19 | 19 |
20 stubout_tool = env['TRUSTED_ENV'].File( | 20 stubout_tool = env['TRUSTED_ENV'].File( |
21 '${STAGING_DIR}/${PROGPREFIX}ncval_stubout${PROGSUFFIX}') | 21 '${STAGING_DIR}/${PROGPREFIX}ncval_stubout${PROGSUFFIX}') |
22 | 22 |
23 env.ComponentProgram('partly_invalid.nexe', 'partly_invalid.c') | 23 partly_invalid_nexe = env.ComponentProgram('partly_invalid', 'partly_invalid.c') |
| 24 partly_invalid_stubout_nexe = env.File('partly_invalid_stubout${PROGSUFFIX}') |
24 | 25 |
25 node = env.Command( | 26 node = env.Command( |
26 target='partly_invalid_stubout.nexe', | 27 target=partly_invalid_stubout_nexe, |
27 source=[stubout_tool, | 28 source=[stubout_tool, partly_invalid_nexe], |
28 env.File('partly_invalid.nexe')], | |
29 action=[Action('${SOURCES[0]} ${SOURCES[1]} -o $TARGET')]) | 29 action=[Action('${SOURCES[0]} ${SOURCES[1]} -o $TARGET')]) |
30 # This alias is to ensure this test works with built_elsewhere=1, | 30 # This alias is to ensure this test works with built_elsewhere=1, |
31 # because with that option CommandSelLdrTestNacl() assumes all its | 31 # because with that option CommandSelLdrTestNacl() assumes all its |
32 # inputs have already been built (which is not necessarily a good | 32 # inputs have already been built (which is not necessarily a good |
33 # idea, but apparently true for all other cases so far). | 33 # idea, but apparently true for all other cases so far). |
34 env.Alias('all_test_programs', node) | 34 env.Alias('all_test_programs', node) |
35 | 35 |
36 nodes = [] | 36 nodes = [] |
37 | 37 |
38 # Without any debug flags, the executable fails validation. | 38 # Without any debug flags, the executable fails validation. |
39 nodes.append(env.CommandSelLdrTestNacl( | 39 nodes.append(env.CommandSelLdrTestNacl( |
40 'partly_invalid_1.out', command=[env.File('partly_invalid.nexe')], | 40 'partly_invalid_1.out', partly_invalid_nexe, |
41 exit_status='1')) | 41 exit_status='1')) |
42 | 42 |
43 # With "-c", the executable runs to completion but is not safe. | 43 # With "-c", the executable runs to completion but is not safe. |
44 nodes.append(env.CommandSelLdrTestNacl( | 44 nodes.append(env.CommandSelLdrTestNacl( |
45 'partly_invalid_2.out', command=[env.File('partly_invalid.nexe')], | 45 'partly_invalid_2.out', partly_invalid_nexe, |
46 stdout_golden=env.File('without_stubout.stdout'), | 46 stdout_golden=env.File('without_stubout.stdout'), |
47 sel_ldr_flags=['-c'])) | 47 sel_ldr_flags=['-c'])) |
48 | 48 |
49 # With "-s", the executable runs part way but then faults. | 49 # With "-s", the executable runs part way but then faults. |
50 nodes.append(env.CommandSelLdrTestNacl( | 50 nodes.append(env.CommandSelLdrTestNacl( |
51 'partly_invalid_3.out', command=[env.File('partly_invalid.nexe')], | 51 'partly_invalid_3.out', partly_invalid_nexe, |
52 stdout_golden=env.File('with_stubout.stdout'), | 52 stdout_golden=env.File('with_stubout.stdout'), |
53 sel_ldr_flags=['-s'], | 53 sel_ldr_flags=['-s'], |
54 exit_status='untrusted_sigill')) | 54 exit_status='untrusted_sigill')) |
55 | 55 |
56 # Using the standalone ncval_stubout tool to rewrite the executable | 56 # Using the standalone ncval_stubout tool to rewrite the executable |
57 # offline should be equivalent to using sel_ldr's "-s" option. | 57 # offline should be equivalent to using sel_ldr's "-s" option. |
58 nodes.append(env.CommandSelLdrTestNacl( | 58 nodes.append(env.CommandSelLdrTestNacl( |
59 'partly_invalid_stubout.out', | 59 'partly_invalid_stubout.out', |
60 command=[env.File('partly_invalid_stubout.nexe')], | 60 partly_invalid_stubout_nexe, |
61 stdout_golden=env.File('with_stubout.stdout'), | 61 stdout_golden=env.File('with_stubout.stdout'), |
62 exit_status='untrusted_sigill')) | 62 exit_status='untrusted_sigill')) |
63 | 63 |
64 env.AddNodeToTestSuite(nodes, ['small_tests'], 'run_stubout_mode_test') | 64 env.AddNodeToTestSuite(nodes, ['small_tests'], 'run_stubout_mode_test') |
OLD | NEW |