summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-06-18 10:18:31 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2015-06-18 10:25:08 +0200
commitfd23f9c9a70e1214507641d327da40d1688b74d7 (patch)
tree632e9e613f58f4c5068ab6105fcb783f25dd3829
parent575ee5e4f76c28c91828637de17e9a5a0da9523d (diff)
test: disable test-barrier by default
The test-barrier binary uses real-time alarms and timeouts to test for races in the thread-barrier implementation. Hence, if your system is under high load and your scheduler decides to not run test-barrier for >BASE_TIME, then the tests are likely to fail. Two options: 1) Increase BASE_TIME. This will make the test take significantly longer for no real good. Furthermore, it is still not guaranteed that the task is scheduled. 2) Don't rely on real-time timers, but use explicit synchronization. This would basically test one barrier implementation with another.. kinda ironic.. but maybe something worth looking into. 3) Disable test-barrier by default. This patch chooses option 3) and makes sure test-barrier only runs if you pass any argument. Side note: test-barrier is written in a way that if it fails under load, but does not on idle systems, then it is very _unlikely_ that the barrier implementation is the culprit. Hence, it makes little sense to run it under load, anyway. It will not improve the test coverage of barrier.c, but rather the coverage of the test itself.
-rw-r--r--src/test/test-barrier.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test-barrier.c b/src/test/test-barrier.c
index 2d109a30e7..f37cb49c85 100644
--- a/src/test/test-barrier.c
+++ b/src/test/test-barrier.c
@@ -438,6 +438,16 @@ TEST_BARRIER(test_barrier_pending_exit,
TEST_BARRIER_WAIT_SUCCESS(pid2));
int main(int argc, char *argv[]) {
+ /*
+ * This test uses real-time alarms and sleeps to test for CPU races
+ * explicitly. This is highly fragile if your system is under load. We
+ * already increased the BASE_TIME value to make the tests more robust,
+ * but that just makes the test take significantly longer. Hence,
+ * disable the test by default, so it will not break CI.
+ */
+ if (argc < 2)
+ return EXIT_TEST_SKIP;
+
log_parse_environment();
log_open();