Index: tests/clock/nacl.scons |
diff --git a/tests/clock/nacl.scons b/tests/clock/nacl.scons |
index bc88228a8a8033c1f09d837bb0bff43201c1f650..ccd55a1aab84203ec21787b434f25c8fcc07fc5e 100644 |
--- a/tests/clock/nacl.scons |
+++ b/tests/clock/nacl.scons |
@@ -5,6 +5,8 @@ |
# This is a basic functionality test to exercise the irt plumbing. |
+import platform |
+ |
Import('env') |
time_check = env.File('${SCONSTRUCT_DIR}/tools/time_check.py') |
@@ -51,3 +53,34 @@ node = env.CommandSelLdrTestNacl( |
'--']) |
env.AddNodeToTestSuite(node, ['small_tests'], 'run_clock_get_test') |
+ |
+clock_test_nexe = env.ComponentProgram('clock_test', |
+ 'clock_test.c', |
+ EXTRA_LIBS=['${PTHREAD_LIBS}', |
+ '${NONIRT_LIBS}']) |
+ |
+# On OSX and Windows, we have observed sleep returning early. The |
+# time_slop_args is used in clock_test to permit some extra slop |
+# in the elapsed time (in ms). |
+time_slop_args = [] |
+ |
+# On Linux the older scheduler implementation did not account properly |
+# for the time process spent waiting on the futex in thread join. This |
+# affects the CLOCK_PROCESS/THREAD_CPUTIME_ID clock test and we therefore |
+# disable this test on older kernels. |
+cputime_args = [] |
+ |
+if env.Bit('host_windows') or env.Bit('host_mac'): |
+ time_slop_args += [ '-s', '10' ] |
+elif env.Bit('host_linux'): |
+ kernel_version = map(int, platform.release().split('.', 2)[:2]) |
+ if kernel_version < [3, 0]: |
+ cputime_args += [ '-c' ] |
+ |
+node = env.CommandSelLdrTestNacl( |
+ 'clock_test.out', |
+ clock_test_nexe, |
+ time_slop_args + cputime_args, |
+ size='large') |
+ |
+env.AddNodeToTestSuite(node, ['large_tests'], 'run_clock_test') |