summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2015-03-09 18:39:07 -0400
committerVijay Bellur <vbellur@redhat.com>2015-03-10 07:48:12 -0700
commit9d6fab69105d866786d26d3d09158163ab5189c5 (patch)
tree8dec1658b24882f731b7b261f3c8b11fed5b54f7 /tests
parentb832e35493aca8c49359b1db4bd7ae3afbcdd2cb (diff)
tests: add a helper script to identify line-numbers and commands of test-cases
Use the tests/utils/testn.sh after a regression test failed to identify what command/line number belongs to the test-number. Jenkins will have something like this in the console output: Test Summary Report ------------------- ./tests/bugs/quota/bug-1087198.t Failed test: 18 Call the script like: $ ./tests/utils/testn.sh ./tests/bugs/quota/bug-1087198.t 18 56 TEST grep -e "\"Usage crossed.... BUG: 1200174 Change-Id: I661c1178d7f5bc50fd40679232c65734c2bc5477 Original-author: Pranith Kumar K <pkarampu@redhat.com> Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/9842 Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/utils/testn.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/utils/testn.sh b/tests/utils/testn.sh
new file mode 100755
index 00000000000..079351d8529
--- /dev/null
+++ b/tests/utils/testn.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+#
+# Use this script to identify the command and line-number of test-cases.
+#
+
+if [ -z "${1}" -a -z "${2}" ]
+then
+ echo "Usage: ${0} path/to/test/case.t testnumber"
+ exit 1
+elif [ -z "${2}" ]
+then
+ echo "ERROR: The second parameter to ${0} should be a number."
+ exit 2
+fi
+
+awk '{print FNR " " $0}' ${1} | egrep '^[[:digit:]]+[[:space:]]*(EXPECT|TEST|EXPECT_WITHIN|EXPECT_KEYWORD)' | sed -n ${2}p