From 9d6fab69105d866786d26d3d09158163ab5189c5 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 9 Mar 2015 18:39:07 -0400 Subject: 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 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/9842 Reviewed-by: Dan Lambright Tested-by: Gluster Build System --- tests/utils/testn.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 tests/utils/testn.sh (limited to 'tests/utils') 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 -- cgit