From f6e5bc68d294cc67f1e7f4db043d2531d4cfec80 Mon Sep 17 00:00:00 2001 From: Raghavendra Talur Date: Mon, 8 Feb 2016 12:13:54 +0530 Subject: tests: Add mechanism for disabled tests Requirements: Should be able to skip tests from run-tests.sh run. Should be granular enough to disable on subset of OSes. Solution: Tests can have special comment lines with some comma separated values within them. Key names used to determine test status are G_TESTDEF_TEST_STATUS_CENTOS6 G_TESTDEF_TEST_STATUS_NETBSD7 Some examples: G_TESTDEF_TEST_STATUS_CENTOS6=BAD_TEST,BUG=123456 G_TESTDEF_TEST_STATUS_NETBSD7=KNOWN_ISSUE,BUG=4444444 G_TESTDEF_TEST_STATUS_CENTOS6=BAD_TEST,BUG=123456;555555 You can change status of test to enabled or delete the line only if all the bugs are closed or modified or if the patch fixes it. Change-Id: Idee21fecaa5837fd4bd06e613f5c07a024f7b0c2 BUG: 1295704 Signed-off-by: Raghavendra Talur Reviewed-on: http://review.gluster.org/13393 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Rajesh Joseph Reviewed-by: Kaushal M --- tests/include.rc | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'tests/include.rc') diff --git a/tests/include.rc b/tests/include.rc index 21a69465797..b46a7b2fde4 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -156,12 +156,13 @@ function test_header() function test_footer() { RET=$? - local err=$1 + local lineno=$1 + local err=$2 if [ $RET -eq 0 ]; then - echo "ok $t"; + echo "ok $t, LINENUM:$lineno"; else - echo "not ok $t $err"; + echo "not ok $t $err, LINENUM:$lineno"; # With DEBUG, this was already printed out, so skip it. if [ x"$DEBUG" = x"0" ]; then echo "FAILED COMMAND: $saved_cmd" @@ -178,8 +179,9 @@ function test_footer() function test_expect_footer() { - local e=$1 - local a=$2 + local lineno=$1 + local e=$2 + local a=$3 local err="" if ! [[ "$a" =~ $e ]]; then @@ -187,7 +189,7 @@ function test_expect_footer() fi [[ "$a" =~ $e ]]; - test_footer "$err"; + test_footer "$lineno" "$err"; } function _EXPECT() @@ -204,16 +206,17 @@ function _EXPECT() a=$("$@" | tail -1) if [ "x$e" = "x" ] ; then - test_expect_footer "x$e" "x$a"; + test_expect_footer "$TESTLINE" "x$e" "x$a"; else - test_expect_footer "$e" "$a"; + test_expect_footer "$TESTLINE" "$e" "$a"; fi } function test_expect_not_footer() { - local e=$1 - local a=$2 + local lineno=$1 + local e=$2 + local a=$3 local err="" if [[ "$a" =~ $e ]]; then @@ -221,7 +224,7 @@ function test_expect_not_footer() fi ! [[ "$a" =~ "$e" ]]; - test_footer "$err"; + test_footer "$lineno" "$err"; } function _EXPECT_NOT() @@ -238,9 +241,9 @@ function _EXPECT_NOT() a=$("$@" | tail -1) if [ "x$e" = "x" ] ; then - test_expect_not_footer "x$e" "x$a"; + test_expect_not_footer "$TESTLINE" "x$e" "x$a"; else - test_expect_not_footer "$e" "$a"; + test_expect_not_footer "$TESTLINE" "$e" "$a"; fi } @@ -255,7 +258,7 @@ function _EXPECT_KEYWORD() shift; "$@" | tail -1 | grep -q "$e" - test_footer; + test_footer "$TESTLINE"; } function _TEST() @@ -273,7 +276,7 @@ function _TEST() eval "$@" >/dev/null $redirect - test_footer; + test_footer "$TESTLINE"; } function _EXPECT_WITHIN() @@ -308,9 +311,9 @@ function _EXPECT_WITHIN() done if [ "x$e" = "x" ] ; then - test_expect_footer "x$e" "x$a"; + test_expect_footer "$TESTLINE" "x$e" "x$a"; else - test_expect_footer "$e" "$a"; + test_expect_footer "$TESTLINE" "$e" "$a"; fi } -- cgit