| OLD | NEW |
| 1 # -*- python -*- | 1 # -*- python -*- |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 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 multiprocessing | 6 import multiprocessing |
| 7 import os | 7 import os |
| 8 | 8 |
| 9 Import('env') | 9 Import('env') |
| 10 | 10 |
| 11 time_test_is_broken_on_this_os=False | 11 time_test_is_broken_on_this_os=False |
| 12 if 'TRUSTED_ENV' in env and env['TRUSTED_ENV'].Bit('windows'): | 12 if 'TRUSTED_ENV' in env and env['TRUSTED_ENV'].Bit('windows'): |
| 13 time_test_is_broken_on_this_os=True | 13 time_test_is_broken_on_this_os=True |
| 14 | 14 |
| 15 env.ComponentLibrary('syscall_test_framework', ['test.cc']) | 15 env.ComponentLibrary('syscall_test_framework', ['test.cc']) |
| 16 | 16 |
| 17 syscalls_nexe = env.ComponentProgram('syscalls', | 17 syscalls_nexe = env.ComponentProgram('syscalls', |
| 18 'syscalls.cc', | 18 'syscalls.cc', |
| 19 EXTRA_LIBS=['${PTHREAD_LIBS}', | 19 EXTRA_LIBS=['${PTHREAD_LIBS}', |
| 20 '${NONIRT_LIBS}']) | 20 '${NONIRT_LIBS}']) |
| 21 | 21 |
| 22 if not env.Bit('host_windows'): | 22 # Creating a R/W test file in the output directory. |
| 23 # Creating a R/W test file in the output directory. | 23 # Because this test gets built on one platform and run on another (arm), |
| 24 # Because this test gets built on one platform and run on another (arm), | 24 # explaining to scons that this file is a dependency of the build and not |
| 25 # explaining to scons that this file is a dependency of the build and not | 25 # a test is tricky. As a simple work-around, the test inputs have been made |
| 26 # a test is tricky. As a simple work-around, the test inputs have been made | 26 # a 'default' scons target. |
| 27 # a 'default' scons target. | 27 # TODO(bradnelson): find a better way to make the plumbing on this work. |
| 28 # TODO(bradnelson): find a better way to make the plumbing on this work. | 28 inputs = env.Command(env.File('file_ok_rdwr.txt'), env.File('file_ok.txt'), |
| 29 inputs = env.Command(env.File('file_ok_rdwr.txt'), env.File('file_ok.txt'), | 29 [Copy(env.File('file_ok_rdwr.txt'), env.File('file_ok.txt')), |
| 30 [Copy(env.File('file_ok_rdwr.txt'), env.File('file_ok.txt')), | 30 Chmod(env.File('file_ok_rdwr.txt'), 0755)]) |
| 31 Chmod(env.File('file_ok_rdwr.txt'), 0755)]) | 31 Default(inputs) |
| 32 Default(inputs) | |
| 33 | 32 |
| 34 # syscalls_test exercise open/read/write, so need filesystem access | 33 # syscalls_test exercise open/read/write, so need filesystem access |
| 35 # via the debug flag to sel_ldr | 34 # via the debug flag to sel_ldr |
| 36 node = env.CommandSelLdrTestNacl( | 35 node = env.CommandSelLdrTestNacl( |
| 37 'syscalls_test.out', | 36 'syscalls_test.out', |
| 38 syscalls_nexe, | 37 syscalls_nexe, |
| 39 args=[env.File('file_ok_rdwr.txt')], | 38 args=[env.File('file_ok_rdwr.txt')], |
| 40 stdout_golden=env.File('syscalls.stdout'), | 39 stdout_golden=env.File('syscalls.stdout'), |
| 41 filter_regex="'^(All tests PASSED)$|^(TEST.*)$'", | 40 sel_ldr_flags=['-a']) |
| 42 sel_ldr_flags=['-a'], | 41 env.AddNodeToTestSuite(node, ['small_tests'], 'run_syscall_test') |
| 43 ) | |
| 44 env.AddNodeToTestSuite(node, ['small_tests'], 'run_syscall_test') | |
| 45 | 42 |
| 46 # getpid() works with nacl-glibc, but only via the IRT (there is no | 43 # getpid() works with nacl-glibc, but only via the IRT (there is no |
| 47 # direct syscall version). | 44 # direct syscall version). |
| 48 getpid_is_broken = env.Bit('nacl_glibc') and not env.Bit('tests_use_irt') | 45 getpid_is_broken = env.Bit('nacl_glibc') and not env.Bit('tests_use_irt') |
| 49 | 46 |
| 50 getpid_test_nexe = env.ComponentProgram('getpid_test', | 47 getpid_test_nexe = env.ComponentProgram('getpid_test', |
| 51 ['getpid_test.cc'], | 48 ['getpid_test.cc'], |
| 52 EXTRA_LIBS=['syscall_test_framework', | 49 EXTRA_LIBS=['syscall_test_framework', |
| 53 '${NONIRT_LIBS}']) | 50 '${NONIRT_LIBS}']) |
| 54 node = env.CommandSelLdrTestNacl( | 51 node = env.CommandSelLdrTestNacl( |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 240 |
| 244 node = env.CommandSelLdrTestNacl( | 241 node = env.CommandSelLdrTestNacl( |
| 245 'filepos_test.out', | 242 'filepos_test.out', |
| 246 filepos_nexe, | 243 filepos_nexe, |
| 247 ['-t', env.MakeTempDir(prefix='tmp_syscalls')], | 244 ['-t', env.MakeTempDir(prefix='tmp_syscalls')], |
| 248 sel_ldr_flags=['-a']) | 245 sel_ldr_flags=['-a']) |
| 249 | 246 |
| 250 env.AddNodeToTestSuite(node, | 247 env.AddNodeToTestSuite(node, |
| 251 ['small_tests', 'sel_ldr_tests'], | 248 ['small_tests', 'sel_ldr_tests'], |
| 252 'run_filepos_test') | 249 'run_filepos_test') |
| OLD | NEW |