|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 2ad8887a12aeff9108606bb31e1557103a3b95df Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Fri, 3 Oct 2014 03:58:51 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] test-barrier: add checks after the barrier constructor
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Coverity seems to think that we can later end up with the "them"
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
fd having a negative value. Even after a succesful barrier_create.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Add some test to verify that the constructor went well. If coverity
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
still complains then it must mean that it thinks the the value is
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
overwritten later.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/test/test-barrier.c | 4 ++++
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 4 insertions(+)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/test/test-barrier.c b/src/test/test-barrier.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 36f27809ca..cb75f7314d 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/test/test-barrier.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/test/test-barrier.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -64,6 +64,10 @@ static void sleep_for(usec_t usecs) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
pid_t pid1, pid2; \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
\
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert_se(barrier_create(&b) >= 0); \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(b.me > 0); \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(b.them > 0); \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(b.pipe[0] > 0); \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ assert_se(b.pipe[1] > 0); \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
\
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
pid1 = fork(); \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
assert_se(pid1 >= 0); \
|