[systemd-commits] src/test

David Herrmann dvdhrm at kemper.freedesktop.org
Tue Jul 29 10:19:59 PDT 2014


 src/test/test-barrier.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 359017c1aec9596e9d3c4c19bd62d34a6f3366b8
Author: David Herrmann <dh.herrmann at gmail.com>
Date:   Tue Jul 29 19:14:23 2014 +0200

    barrier: fix race in test-code
    
    The barrier_wait_next_twice* test-cases run:
      Parent:                             Child:
        set_alarm(10)                       sleep_for(1);
        ...                                 set_alarm(1);
        sleep_for(2)                        ...
    
    Therefore, the parent exits after 2+ periods, the client's alarm fires
    after 2+ periods. This race turns out to be lost by the child on other
    machines, so avoid it by increasing the parent's sleep-interval to 4. This
    way, the client has 2 periods to run the barrier test, which is far more
    than enough.

diff --git a/src/test/test-barrier.c b/src/test/test-barrier.c
index ac9dd04..36f2780 100644
--- a/src/test/test-barrier.c
+++ b/src/test/test-barrier.c
@@ -176,7 +176,7 @@ TEST_BARRIER(test_barrier_wait_next_twice,
                 set_alarm(BASE_TIME * 10);
                 assert_se(barrier_place(&b));
                 assert_se(barrier_place(&b));
-                sleep_for(BASE_TIME * 2);
+                sleep_for(BASE_TIME * 4);
         }),
         TEST_BARRIER_WAIT_SUCCESS(pid2));
 
@@ -201,7 +201,7 @@ TEST_BARRIER(test_barrier_wait_next_twice_local,
                 set_alarm(BASE_TIME * 10);
                 assert_se(barrier_place(&b));
                 assert_se(barrier_place(&b));
-                sleep_for(BASE_TIME * 2);
+                sleep_for(BASE_TIME * 4);
         }),
         TEST_BARRIER_WAIT_SUCCESS(pid2));
 



More information about the systemd-commits mailing list