aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar David Bremner <bremner@debian.org>2011-12-13 15:56:47 -0400
committerGravatar David Bremner <bremner@debian.org>2011-12-18 06:33:27 -0400
commit451c57d19aeff5420839701460691e8e20d13049 (patch)
tree5c5d7a82e9ba8cfaf9120f405ef6d48efff3ace6 /test
parent6dcd575d7be806dfaac5facba6fb6908a6ae076b (diff)
test: optionally print subtest number
The idea is that $test_count could be used in tests to label intermediate files. The output enabled by this patch (and --debug) helps figure out which OUTPUT.nn file belongs to which test in case several subtests write to OUTPUT.$test_count
Diffstat (limited to 'test')
-rw-r--r--test/test-lib.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 6be93fe3..b5e346c0 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -116,6 +116,16 @@ do
esac
done
+if test -n "$debug"; then
+ print_subtest () {
+ printf " %-4s" "[$((test_count - 1))]"
+ }
+else
+ print_subtest () {
+ true
+ }
+fi
+
if test -n "$color"; then
say_color () {
(
@@ -132,6 +142,7 @@ if test -n "$color"; then
printf " "
printf "$@"
tput sgr0
+ print_subtest
)
}
else
@@ -140,6 +151,7 @@ else
shift
printf " "
printf "$@"
+ print_subtest
}
fi