From c9ca5f61d87cb0578d32981b2ee32118d934ce21 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sun, 21 Aug 2011 23:15:45 +0200 Subject: [PATCH] tap/awk: correctly extract message from SKIP plans * lib/tap-driver.sh (/^1\.\.0+[ \t]*#/): Add a forgotten `?' to the regex used to extract the skip message from a "1..0" TAP plan. * tests/planskip.test: Check for the just-fixed bug. * tests/tap-planskip-unplanned-corner.test: Don't be too strict w.r.t. the formatting of the "skip whole test" message, to avoid failing due to bugs irrelevant for this test (like the one just fixed). --- ChangeLog | 11 +++++++++++ lib/tap-driver.sh | 4 ++-- tests/tap-planskip-unplanned-corner.test | 3 ++- tests/tap-planskip.test | 4 ++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 80889c9ea..738e10ff8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-08-21 Stefano Lattarini + + tap/awk: correctly extract message from SKIP plans + * lib/tap-driver.sh (/^1\.\.0+[ \t]*#/): Add a forgotten `?' to + the regex used to extract the skip message from a "1..0" TAP plan. + * tests/planskip.test: Check for the just-fixed bug. + * tests/tap-planskip-unplanned-corner.test: Don't be too strict + w.r.t. the formatting of the "skip whole test" message, to avoid + failing due to bugs irrelevant for this test (like the one just + fixed). + 2011-08-21 Stefano Lattarini tap/awk: support colorized output diff --git a/lib/tap-driver.sh b/lib/tap-driver.sh index 28eacb7be..dd2b92945 100755 --- a/lib/tap-driver.sh +++ b/lib/tap-driver.sh @@ -23,7 +23,7 @@ # bugs to or send patches to # . -scriptversion=2011-08-21.16; # UTC +scriptversion=2011-08-21.21; # UTC # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. @@ -502,7 +502,7 @@ BEGIN { # leading and trailing whitespace. This is a little more tricky in # thruth, since we want to also strip a potential leading "SKIP" # string from the message. - sub("^[^#]*#[ \\t]*(SKIP[: \\t][ \\t]*)", "") + sub("^[^#]*#[ \\t]*(SKIP[: \\t][ \\t]*)?", "") sub("[ \\t]*$", ""); handle_tap_plan(0, $0) next diff --git a/tests/tap-planskip-unplanned-corner.test b/tests/tap-planskip-unplanned-corner.test index cf9f49eb3..4e825d5b7 100755 --- a/tests/tap-planskip-unplanned-corner.test +++ b/tests/tap-planskip-unplanned-corner.test @@ -38,7 +38,8 @@ cat stdout count_test_results total=5 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=3 -grep '^SKIP: foo\.test$' stdout +# Don't be too strict w.r.t. the format of the "skip whole test" message. +grep '^SKIP: foo\.test$' stdout || grep '^SKIP: foo\.test [^0-9]' stdout grep '^ERROR: foo\.test 1 # UNPLANNED$' stdout grep '^ERROR: foo\.test - too many tests run (expected 0, got 1)$' stdout grep '^SKIP: bar\.test 1 # SKIP$' stdout diff --git a/tests/tap-planskip.test b/tests/tap-planskip.test index 574819bb6..35f797603 100755 --- a/tests/tap-planskip.test +++ b/tests/tap-planskip.test @@ -63,6 +63,10 @@ cat stdout count_test_results total=6 pass=0 fail=0 xpass=0 xfail=0 skip=6 error=0 +# Look for a regression where the "1..0" wasn't being stripped from the +# SKIP message. +$FGREP '1..0' stdout && Exit 1 + grep '^SKIP: foo\.test$' stdout grep '^SKIP: bar\.test$' stdout grep '^SKIP: baz\.test' stdout # Deliberately laxer, see above for why. -- 2.47.2