]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD: try to make eventfd2 testcase deterministic
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 20 Aug 2023 07:04:17 +0000 (09:04 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 20 Aug 2023 07:04:17 +0000 (09:04 +0200)
Add a sleep to give child 1 a chance to run.
Flush stdout every time.

memcheck/tests/freebsd/eventfd2.c
memcheck/tests/freebsd/eventfd2.stdout.exp

index 8e2309f96de253836166f0c048e3361b36e4bd10..d620907c9da35068a93565747bb1ec027d8324ac 100644 (file)
@@ -18,6 +18,7 @@ static void xsem_wait(int fd)
 
    fprintf(stdout, "wait completed on %d: count=%" PRIu64 "\n",
            fd, cntr);
+   fflush(stdout);
 }
 
 static void xsem_post(int fd, int count)
@@ -38,21 +39,27 @@ static void sem_player(int fd1, int fd2)
     * (also xsem_wait above)
     */
    fprintf(stdout, "posting 1 on %d\n", fd1);
+   fflush(stdout);
    xsem_post(fd1, 1);
 
    fprintf(stdout, "waiting on %d\n", fd2);
+   fflush(stdout);
    xsem_wait(fd2);
 
    fprintf(stdout, "posting 1 on %d\n", fd1);
+   fflush(stdout);
    xsem_post(fd1, 1);
 
    fprintf(stdout, "waiting on %d\n", fd2);
+   fflush(stdout);
    xsem_wait(fd2);
 
    fprintf(stdout, "posting 5 on %d\n", fd1);
+   fflush(stdout);
    xsem_post(fd1, 5);
 
    fprintf(stdout, "waiting 5 times on %d\n", fd2);
+   fflush(stdout);
    xsem_wait(fd2);
    xsem_wait(fd2);
    xsem_wait(fd2);
@@ -88,6 +95,7 @@ int main(int argc, char **argv)
       sem_player(fd1, fd2);
       exit(0);
    }
+   sleep(1);
    if ((cpid_waiter = fork()) == 0) {
       sem_player(fd2, fd1);
       exit(0);
index 6a2cd1944e283d78784a5d4f8b387171d4b559f0..00ecdcaca7c23b7731bc5a4cbeaca6ea49925a36 100644 (file)
@@ -1,26 +1,26 @@
 posting 1 on 3
 waiting on 4
+posting 1 on 4
 wait completed on 4: count=1
+waiting on 3
 posting 1 on 3
 waiting on 4
-wait completed on 4: count=1
-posting 5 on 3
-waiting 5 times on 4
-wait completed on 4: count=1
-wait completed on 4: count=1
-wait completed on 4: count=1
-wait completed on 4: count=1
-wait completed on 4: count=1
-posting 1 on 4
-waiting on 3
 wait completed on 3: count=1
 posting 1 on 4
+wait completed on 4: count=1
 waiting on 3
 wait completed on 3: count=1
+posting 5 on 3
 posting 5 on 4
+waiting 5 times on 4
+wait completed on 4: count=1
 waiting 5 times on 3
+wait completed on 4: count=1
 wait completed on 3: count=1
+wait completed on 4: count=1
 wait completed on 3: count=1
+wait completed on 4: count=1
 wait completed on 3: count=1
+wait completed on 4: count=1
 wait completed on 3: count=1
 wait completed on 3: count=1