[PATCH] tests: verify that all patterns match.

Andreas Schwab schwab at suse.de
Mon Mar 16 15:02:06 UTC 2015


* tests/ipc_msg.test: Count matches to verify that all patterns match.
* tests/ipc_sem.test: Likewise.
* tests/ipc_shm.test: Likewise.
* tests/stat32-v.test: Likewise.
* tests/stat64-v.test: Likewise.
---
 tests/ipc_msg.test  | 6 ++++--
 tests/ipc_sem.test  | 4 +++-
 tests/ipc_shm.test  | 6 ++++--
 tests/stat32-v.test | 4 +++-
 tests/stat64-v.test | 4 +++-
 5 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/tests/ipc_msg.test b/tests/ipc_msg.test
index b1ebe6d..e0d27ed 100755
--- a/tests/ipc_msg.test
+++ b/tests/ipc_msg.test
@@ -16,9 +16,11 @@ OUT="$LOG.out"
 	fi
 }
 
-args="-eipc ./ipc_msg $f"
+args="-eipc ./ipc_msg"
 $STRACE -o "$LOG" $args > "$OUT" &&
-LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+exp_lines=$(wc -l < "$OUT") &&
+matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+test $exp_lines -eq $matched_lines || {
 	cat "$OUT" "$LOG"
 	fail_ "$STRACE $args output mismatch"
 }
diff --git a/tests/ipc_sem.test b/tests/ipc_sem.test
index b8fa545..ef957c3 100755
--- a/tests/ipc_sem.test
+++ b/tests/ipc_sem.test
@@ -18,7 +18,9 @@ OUT="$LOG.out"
 
 args='-eipc ./ipc_sem'
 $STRACE -o "$LOG" $args > "$OUT" &&
-LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+exp_lines=$(wc -l < "$OUT") &&
+matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+test $exp_lines -eq $matched_lines || {
 	cat "$OUT" "$LOG"
 	fail_ "$STRACE $args output mismatch"
 }
diff --git a/tests/ipc_shm.test b/tests/ipc_shm.test
index b09dc2b..de8b47c 100755
--- a/tests/ipc_shm.test
+++ b/tests/ipc_shm.test
@@ -16,9 +16,11 @@ OUT="$LOG.out"
 	fi
 }
 
-args="-eipc ./ipc_shm $f"
+args="-eipc ./ipc_shm"
 $STRACE -o "$LOG" $args > "$OUT" &&
-LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+exp_lines=$(wc -l < "$OUT") &&
+matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+test $exp_lines -eq $matched_lines || {
 	cat "$OUT" "$LOG"
 	fail_ "$STRACE $args output mismatch"
 }
diff --git a/tests/stat32-v.test b/tests/stat32-v.test
index 7f8cb4a..67eb5ed 100755
--- a/tests/stat32-v.test
+++ b/tests/stat32-v.test
@@ -33,7 +33,9 @@ touch -t 0102030405 $sample
 for f in $sample . /dev/null; do
 	args="-v -efile ./stat32 $f"
 	$STRACE -o "$LOG" $args > "$OUT" &&
-	LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+	exp_lines=$(wc -l < "$OUT") &&
+	matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+	test $exp_lines -eq $matched_lines || {
 		cat "$OUT" "$LOG"
 		fail_ "$STRACE $args output mismatch"
 	}
diff --git a/tests/stat64-v.test b/tests/stat64-v.test
index f03254a..785403d 100755
--- a/tests/stat64-v.test
+++ b/tests/stat64-v.test
@@ -27,7 +27,9 @@ touch -d '1970-01-01 -42 seconds' $sample
 for f in $sample . /dev/null; do
 	args="-v -efile ./stat $f"
 	$STRACE -o "$LOG" $args > "$OUT" &&
-	LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+	exp_lines=$(wc -l < "$OUT") &&
+	matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+	test $exp_lines -eq $matched_lines || {
 		cat "$OUT" "$LOG"
 		fail_ "$STRACE $args output mismatch"
 	}
-- 
2.3.3


-- 
Andreas Schwab, SUSE Labs, schwab at suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




More information about the Strace-devel mailing list