commit 39b748a4a1daa597a6979d62ea8911b8c052eac1
parent 95f41c6fb3cb361ecdff79b32ef9175988889e90
Author: Kyle Milz <kyle@0x30.net>
Date: Tue, 23 Aug 2016 23:13:40 -0600
t: refactor test to fail easier
Diffstat:
4 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/src/dump_main.cc b/src/dump_main.cc
@@ -78,7 +78,7 @@ main(int argc, char *argv[])
if (tflag) {
for (int i = 0; i < 60; i++)
- f.total_execs();
+ std::cout << f.total_execs() << std::endl;
}
if (sarg) {
diff --git a/t/rt_dynamic.sh b/t/rt_dynamic.sh
@@ -1,13 +0,0 @@
-#
-# Test that we can count an executing program as its running.
-#
-echo 1..2
-. test/project.sh
-
-./program 45 &
-pid=$!
-
-test_total_execs 2
-
-kill -USR1 $pid
-wait
diff --git a/t/rt_exectotals.sh b/t/rt_exectotals.sh
@@ -0,0 +1,17 @@
+#
+# Test that we can count an executing program as its running.
+#
+echo 1..3
+. test/project.sh
+
+./program 45 &
+pid=$!
+
+$TEST_TOOLS/citrun-dump -t > execs.out
+[ `grep -c "." execs.out` -eq 60 ] && echo ok 2 - citrun-dump -t output enough lines
+
+sort -n execs.out > execs.sorted
+test_diff 3 "executions strictly increasing" execs.sorted execs.out
+
+kill -USR1 $pid
+wait
diff --git a/test/utils.sh b/test/utils.sh
@@ -14,17 +14,6 @@ cd $tmpdir
echo "ok 1 - tmp dir created"
#
-# Run citrun-dump -t 60 times and check that each time was greater than the last
-#
-function test_total_execs
-{
- $TEST_TOOLS/citrun-dump -t > execs.out
-
- sort -n execs.out > execs.sorted
- test_diff ${1} "executions strictly increasing" execs.sorted execs.out
-}
-
-#
# Differences two instrumented files. Knocks the header off of the "*.citrun"
# file.
#