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 # This is a basic functionality test to exercise the irt plumbing. | 6 # This is a basic functionality test to exercise the irt plumbing. |
7 | 7 |
| 8 import platform |
| 9 |
8 Import('env') | 10 Import('env') |
9 | 11 |
10 time_check = env.File('${SCONSTRUCT_DIR}/tools/time_check.py') | 12 time_check = env.File('${SCONSTRUCT_DIR}/tools/time_check.py') |
11 | 13 |
12 if env.Bit('tests_use_irt'): | 14 if env.Bit('tests_use_irt'): |
13 clock_irt_test_nexe = env.ComponentProgram('clock_irt_test', | 15 clock_irt_test_nexe = env.ComponentProgram('clock_irt_test', |
14 'clock_irt_test.c', | 16 'clock_irt_test.c', |
15 EXTRA_LIBS=['${NONIRT_LIBS}'], | 17 EXTRA_LIBS=['${NONIRT_LIBS}'], |
16 ) | 18 ) |
17 | 19 |
(...skipping 26 matching lines...) Expand all Loading... |
44 node = env.CommandSelLdrTestNacl( | 46 node = env.CommandSelLdrTestNacl( |
45 'clock_get_test.out', | 47 'clock_get_test.out', |
46 clock_get_test_nexe, | 48 clock_get_test_nexe, |
47 wrapper_program_prefix = [ | 49 wrapper_program_prefix = [ |
48 '${PYTHON}', time_check, '-S', | 50 '${PYTHON}', time_check, '-S', |
49 '-r', | 51 '-r', |
50 '"Realtime\sclock\svalue[^\d]*(\d+\.\d*|\d*\.\d+)"', | 52 '"Realtime\sclock\svalue[^\d]*(\d+\.\d*|\d*\.\d+)"', |
51 '--']) | 53 '--']) |
52 | 54 |
53 env.AddNodeToTestSuite(node, ['small_tests'], 'run_clock_get_test') | 55 env.AddNodeToTestSuite(node, ['small_tests'], 'run_clock_get_test') |
| 56 |
| 57 clock_test_nexe = env.ComponentProgram('clock_test', |
| 58 'clock_test.c', |
| 59 EXTRA_LIBS=['${PTHREAD_LIBS}', |
| 60 '${NONIRT_LIBS}']) |
| 61 |
| 62 # On OSX and Windows, we have observed sleep returning early. The |
| 63 # time_slop_args is used in clock_test to permit some extra slop |
| 64 # in the elapsed time (in ms). |
| 65 time_slop_args = [] |
| 66 |
| 67 # On Linux the older scheduler implementation did not account properly |
| 68 # for the time process spent waiting on the futex in thread join. This |
| 69 # affects the CLOCK_PROCESS/THREAD_CPUTIME_ID clock test and we therefore |
| 70 # disable this test on older kernels. |
| 71 cputime_args = [] |
| 72 |
| 73 if env.Bit('host_windows') or env.Bit('host_mac'): |
| 74 time_slop_args += [ '-s', '10' ] |
| 75 elif env.Bit('host_linux'): |
| 76 kernel_version = map(int, platform.release().split('.', 2)[:2]) |
| 77 if kernel_version < [3, 0]: |
| 78 cputime_args += [ '-c' ] |
| 79 |
| 80 node = env.CommandSelLdrTestNacl( |
| 81 'clock_test.out', |
| 82 clock_test_nexe, |
| 83 time_slop_args + cputime_args, |
| 84 size='large') |
| 85 |
| 86 env.AddNodeToTestSuite(node, ['large_tests'], 'run_clock_test') |
OLD | NEW |