chiark / gitweb /
test-barrier: add checks after the barrier constructor
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Fri, 3 Oct 2014 01:58:51 +0000 (03:58 +0200)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Fri, 3 Oct 2014 02:04:42 +0000 (04:04 +0200)
Coverity seems to think that we can later end up with the "them"
fd having a negative value. Even after a succesful barrier_create.
Add some test to verify that the constructor went well. If coverity
still complains then it must mean that it thinks the the value is
overwritten later.

src/test/test-barrier.c

index 36f27809cad60ec67c70ad47c0173844bb643624..cb75f7314d98d6d700c3c1a4b559ba64e63a3eeb 100644 (file)
@@ -64,6 +64,10 @@ static void sleep_for(usec_t usecs) {
                 pid_t pid1, pid2;                                       \
                                                                         \
                 assert_se(barrier_create(&b) >= 0);                     \
+                assert_se(b.me > 0);                                    \
+                assert_se(b.them > 0);                                  \
+                assert_se(b.pipe[0] > 0);                               \
+                assert_se(b.pipe[1] > 0);                               \
                                                                         \
                 pid1 = fork();                                          \
                 assert_se(pid1 >= 0);                                   \