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 time_test_is_broken_on_this_os=False | 8 time_test_is_broken_on_this_os=False |
9 if 'TRUSTED_ENV' in env and env['TRUSTED_ENV'].Bit('windows'): | 9 if 'TRUSTED_ENV' in env and env['TRUSTED_ENV'].Bit('windows'): |
10 time_test_is_broken_on_this_os=True | 10 time_test_is_broken_on_this_os=True |
11 | 11 |
12 env.ComponentLibrary('syscall_test_framework', ['test.cc']) | 12 env.ComponentLibrary('syscall_test_framework', ['test.cc']) |
13 | 13 |
14 env.ComponentProgram('syscalls.nexe', | 14 syscalls_nexe = env.ComponentProgram('syscalls', |
15 'syscalls.cc', | 15 'syscalls.cc', |
16 EXTRA_LIBS=['pthread']) | 16 EXTRA_LIBS=['pthread']) |
17 | 17 |
18 if not env.Bit('host_windows'): | 18 if not env.Bit('host_windows'): |
19 # Creating a R/W test file in the output directory. | 19 # Creating a R/W test file in the output directory. |
20 # Because this test gets built on one platform and run on another (arm), | 20 # Because this test gets built on one platform and run on another (arm), |
21 # explaining to scons that this file is a dependency of the build and not | 21 # explaining to scons that this file is a dependency of the build and not |
22 # a test is tricky. As a simple work-around, the test inputs have been made | 22 # a test is tricky. As a simple work-around, the test inputs have been made |
23 # a 'default' scons target. | 23 # a 'default' scons target. |
24 # TODO(bradnelson): find a better way to make the plumbing on this work. | 24 # TODO(bradnelson): find a better way to make the plumbing on this work. |
25 inputs = env.Command(env.File('file_ok_rdwr.txt'), env.File('file_ok.txt'), | 25 inputs = env.Command(env.File('file_ok_rdwr.txt'), env.File('file_ok.txt'), |
26 [Copy(env.File('file_ok_rdwr.txt'), env.File('file_ok.txt')), | 26 [Copy(env.File('file_ok_rdwr.txt'), env.File('file_ok.txt')), |
27 Chmod(env.File('file_ok_rdwr.txt'), 0755)]) | 27 Chmod(env.File('file_ok_rdwr.txt'), 0755)]) |
28 Default(inputs) | 28 Default(inputs) |
29 | 29 |
30 # syscalls_test exercise open/read/write, so need filesystem access | 30 # syscalls_test exercise open/read/write, so need filesystem access |
31 # via the debug flag to sel_ldr | 31 # via the debug flag to sel_ldr |
32 node = env.CommandSelLdrTestNacl( | 32 node = env.CommandSelLdrTestNacl( |
33 'syscalls_test.out', | 33 'syscalls_test.out', |
34 command=[env.File('syscalls.nexe'), env.File('file_ok_rdwr.txt')], | 34 syscalls_nexe, |
35 args=[env.File('file_ok_rdwr.txt')], | |
35 stdout_golden=env.File('syscalls.stdout'), | 36 stdout_golden=env.File('syscalls.stdout'), |
36 filter_regex="'^(All tests PASSED)$|^(TEST.*)$'", | 37 filter_regex="'^(All tests PASSED)$|^(TEST.*)$'", |
37 sel_ldr_flags=['-a'], | 38 sel_ldr_flags=['-a'], |
38 ) | 39 ) |
39 env.AddNodeToTestSuite(node, ['small_tests'], 'run_syscall_test') | 40 env.AddNodeToTestSuite(node, ['small_tests'], 'run_syscall_test') |
40 #endif | 41 #endif |
41 | 42 |
42 env.ComponentProgram('getpid_test.nexe', | 43 getpid_test_nexe = env.ComponentProgram('getpid_test', |
43 ['getpid_test.cc'], | 44 ['getpid_test.cc'], |
44 EXTRA_LIBS=['syscall_test_framework']) | 45 EXTRA_LIBS=['syscall_test_framework']) |
45 node = env.CommandSelLdrTestNacl( | 46 node = env.CommandSelLdrTestNacl( |
46 'getpid_test.out', | 47 'getpid_test.out', |
47 command=[env.File('getpid_test.nexe')], | 48 getpid_test_nexe, |
48 ) | 49 ) |
49 env.AddNodeToTestSuite(node, | 50 env.AddNodeToTestSuite(node, |
50 ['small_tests', 'sel_ldr_tests'], | 51 ['small_tests', 'sel_ldr_tests'], |
51 'run_getpid_test') | 52 'run_getpid_test') |
52 | 53 |
53 raw_syscall_objects = env.RawSyscallObjects(['getpid_test.cc']) | 54 raw_syscall_objects = env.RawSyscallObjects(['getpid_test.cc']) |
54 env.ComponentProgram('raw_getpid_test.nexe', | 55 raw_getpid_test_nexe = env.ComponentProgram( |
55 raw_syscall_objects, | 56 'raw_getpid_test', |
56 EXTRA_LIBS=['syscall_test_framework']) | 57 raw_syscall_objects, |
58 EXTRA_LIBS=['syscall_test_framework']) | |
57 | 59 |
58 node = env.CommandSelLdrTestNacl('raw_getpid_test.out', | 60 node = env.CommandSelLdrTestNacl('raw_getpid_test.out', |
59 command=[env.File('raw_getpid_test.nexe')]) | 61 raw_getpid_test_nexe) |
62 | |
60 env.AddNodeToTestSuite(node, | 63 env.AddNodeToTestSuite(node, |
61 ['small_tests', 'sel_ldr_tests'], | 64 ['small_tests', 'sel_ldr_tests'], |
62 'run_raw_getpid_test') | 65 'run_raw_getpid_test') |
63 | 66 |
64 # The next few tests test the exit syscall. | 67 # The next few tests test the exit syscall. |
65 # The first one checks for exit success. | 68 # The first one checks for exit success. |
66 env.ComponentProgram('exit_test.nexe', ['exit_test.cc']) | 69 exit_test_nexe = env.ComponentProgram('exit_test', ['exit_test.cc']) |
67 node = env.CommandSelLdrTestNacl( | 70 node = env.CommandSelLdrTestNacl( |
68 'exit_success_test.out', | 71 'exit_success_test.out', |
69 command=[env.File('exit_test.nexe')], | 72 exit_test_nexe, |
70 exit_status='0', | 73 exit_status='0', |
71 ) | 74 ) |
72 env.AddNodeToTestSuite(node, | 75 env.AddNodeToTestSuite(node, |
73 ['small_tests', 'sel_ldr_tests'], | 76 ['small_tests', 'sel_ldr_tests'], |
74 'run_exit_success_test') | 77 'run_exit_success_test') |
75 | 78 |
76 # The next two test positive and negative return values. | 79 # The next two test positive and negative return values. |
77 node = env.CommandSelLdrTestNacl( | 80 node = env.CommandSelLdrTestNacl( |
78 'exit_one_test.out', | 81 'exit_one_test.out', |
79 command=[env.File('exit_test.nexe'), '1'], | 82 exit_test_nexe, |
83 args=['1'], | |
80 exit_status='1', | 84 exit_status='1', |
81 ) | 85 ) |
82 env.AddNodeToTestSuite(node, | 86 env.AddNodeToTestSuite(node, |
83 ['small_tests', 'sel_ldr_tests'], | 87 ['small_tests', 'sel_ldr_tests'], |
84 'run_exit_one_test') | 88 'run_exit_one_test') |
85 | 89 |
86 # The last one tests some unusually large number. | 90 # The last one tests some unusually large number. |
87 node = env.CommandSelLdrTestNacl( | 91 node = env.CommandSelLdrTestNacl( |
88 'exit_large_test.out', | 92 'exit_large_test.out', |
89 command=[env.File('exit_test.nexe'), '123'], | 93 exit_test_nexe, |
94 args=['123'], | |
90 exit_status='123', | 95 exit_status='123', |
91 ) | 96 ) |
92 env.AddNodeToTestSuite(node, | 97 env.AddNodeToTestSuite(node, |
93 ['small_tests', 'sel_ldr_tests'], | 98 ['small_tests', 'sel_ldr_tests'], |
94 'run_exit_large_test') | 99 'run_exit_large_test') |
95 | 100 |
96 # Test the semaphore system calls. | 101 # Test the semaphore system calls. |
97 env.ComponentProgram('semaphore_tests.nexe', | 102 semaphore_tests_nexe = env.ComponentProgram( |
98 ['semaphore_tests.cc'], | 103 'semaphore_tests', |
Nick Bray
2011/06/23 18:32:24
Wrong indentation level.
4 spaces if using this l
pdox
2011/06/23 20:42:58
Done.
| |
99 EXTRA_LIBS=['pthread', 'syscall_test_framework']) | 104 ['semaphore_tests.cc'], |
105 EXTRA_LIBS=['pthread', 'syscall_test_framework']) | |
106 | |
100 node = env.CommandSelLdrTestNacl( | 107 node = env.CommandSelLdrTestNacl( |
101 'semaphore_tests.out', | 108 'semaphore_tests.out', |
102 command=[env.File('semaphore_tests.nexe')], | 109 semaphore_tests_nexe, |
103 ) | 110 ) |
104 env.AddNodeToTestSuite(node, | 111 env.AddNodeToTestSuite(node, |
105 ['small_tests', 'sel_ldr_tests'], | 112 ['small_tests', 'sel_ldr_tests'], |
106 'run_semaphore_tests') | 113 'run_semaphore_tests') |
107 | 114 |
108 env.ComponentProgram('mem_test.nexe', | 115 mem_test_nexe = env.ComponentProgram('mem_test', |
109 ['mem_test.cc'], | 116 ['mem_test.cc'], |
110 EXTRA_LIBS=['syscall_test_framework']) | 117 EXTRA_LIBS=['syscall_test_framework']) |
111 node = env.CommandSelLdrTestNacl('mem_test.out', | 118 node = env.CommandSelLdrTestNacl('mem_test.out', |
112 command=[env.File('mem_test.nexe')]) | 119 mem_test_nexe) |
113 env.AddNodeToTestSuite(node, | 120 env.AddNodeToTestSuite(node, |
114 ['small_tests', 'sel_ldr_tests'], | 121 ['small_tests', 'sel_ldr_tests'], |
115 'run_mem_test') | 122 'run_mem_test') |
116 | 123 |
117 env.ComponentProgram('sysbrk_test.nexe', | 124 sysbrk_test_nexe = env.ComponentProgram('sysbrk_test', |
118 ['sysbrk_test.cc'], | 125 ['sysbrk_test.cc'], |
119 EXTRA_LIBS=['syscall_test_framework', 'nacl']) | 126 EXTRA_LIBS=['syscall_test_framework', |
127 'nacl']) | |
120 | 128 |
121 node = env.CommandSelLdrTestNacl('sysbrk_test.out', | 129 node = env.CommandSelLdrTestNacl('sysbrk_test.out', |
122 command=[env.File('sysbrk_test.nexe')]) | 130 sysbrk_test_nexe) |
123 env.AddNodeToTestSuite(node, | 131 env.AddNodeToTestSuite(node, |
124 ['small_tests', 'sel_ldr_tests'], | 132 ['small_tests', 'sel_ldr_tests'], |
125 'run_sysbrk_test') | 133 'run_sysbrk_test') |
126 | 134 |
127 # These are timing tests, so we only run on real hardware | 135 # These are timing tests, so we only run on real hardware |
128 is_on_vm = env.Bit('running_on_vm') | 136 is_on_vm = env.Bit('running_on_vm') |
129 | 137 |
130 # additions to add syscall tests 40-42 | 138 # additions to add syscall tests 40-42 |
131 env.ComponentProgram('timefuncs_test.nexe', | 139 timefuncs_test_nexe = env.ComponentProgram( |
132 ['timefuncs_test.cc'], | 140 'timefuncs_test', |
Nick Bray
2011/06/23 18:32:24
Bad spacing.
pdox
2011/06/23 20:42:58
Done.
| |
133 EXTRA_LIBS=['pthread', 'syscall_test_framework']) | 141 ['timefuncs_test.cc'], |
142 EXTRA_LIBS=['pthread', 'syscall_test_framework']) | |
134 node = env.CommandSelLdrTestNacl( | 143 node = env.CommandSelLdrTestNacl( |
135 'timefuncs_test.out', | 144 'timefuncs_test.out', |
136 command=[env.File('timefuncs_test.nexe')] | 145 timefuncs_test_nexe) |
137 ) | |
138 | 146 |
139 env.AddNodeToTestSuite(node, | 147 env.AddNodeToTestSuite(node, |
140 ['small_tests', 'sel_ldr_tests'], | 148 ['small_tests', 'sel_ldr_tests'], |
141 'run_timefuncs_test', | 149 'run_timefuncs_test', |
142 is_broken=is_on_vm or time_test_is_broken_on_this_os | 150 is_broken=is_on_vm or time_test_is_broken_on_this_os |
143 ) | 151 ) |
144 | 152 |
145 raw_syscall_timefunc_objects = env.RawSyscallObjects(['timefuncs_test.cc']) | 153 raw_syscall_timefunc_objects = env.RawSyscallObjects(['timefuncs_test.cc']) |
146 env.ComponentProgram('raw_timefuncs_test.nexe', | 154 raw_timefuncs_test_nexe = env.ComponentProgram( |
147 raw_syscall_timefunc_objects, | 155 'raw_timefuncs_test', |
Nick Bray
2011/06/23 18:32:24
Bad spacing
pdox
2011/06/23 20:42:58
Done.
| |
148 EXTRA_LIBS=['syscall_test_framework']) | 156 raw_syscall_timefunc_objects, |
157 EXTRA_LIBS=['syscall_test_framework']) | |
149 | 158 |
150 node = env.CommandSelLdrTestNacl('raw_timefuncs_test.out', | 159 node = env.CommandSelLdrTestNacl('raw_timefuncs_test.out', |
151 command=[env.File('raw_timefuncs_test.nexe')]) | 160 raw_timefuncs_test_nexe) |
152 env.AddNodeToTestSuite(node, | 161 env.AddNodeToTestSuite(node, |
153 ['small_tests', 'sel_ldr_tests'], | 162 ['small_tests', 'sel_ldr_tests'], |
154 'run_raw_timefuncs_test', | 163 'run_raw_timefuncs_test', |
155 is_broken=is_on_vm or time_test_is_broken_on_this_os) | 164 is_broken=is_on_vm or time_test_is_broken_on_this_os) |
OLD | NEW |