From 83005f5c8de788f3b2fec9b186a766814004895d Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 17 Nov 2018 01:52:51 +0300 Subject: Print id of failed test --- tests/test/script/builtin/sed.testscript | 16 ++++++++ tests/test/script/runner/cleanup.testscript | 20 ++++++++++ tests/test/script/runner/exit.testscript | 60 +++++++++++++++++++++++----- tests/test/script/runner/expr.testscript | 4 +- tests/test/script/runner/pipe.testscript | 2 + tests/test/script/runner/redirect.testscript | 12 ++++++ tests/test/script/runner/regex.testscript | 6 +++ tests/test/script/runner/set.testscript | 11 +++++ tests/test/script/runner/status.testscript | 3 ++ 9 files changed, 123 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/test/script/builtin/sed.testscript b/tests/test/script/builtin/sed.testscript index 9db7cb4..6e504e5 100644 --- a/tests/test/script/builtin/sed.testscript +++ b/tests/test/script/builtin/sed.testscript @@ -23,6 +23,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: missing script + info: test id: 1 EOE : missed-val @@ -31,6 +32,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: missing script + info: test id: 1 EOE : empty @@ -39,6 +41,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: empty script + info: test id: 1 EOE : multiple @@ -47,6 +50,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: multiple scripts + info: test id: 1 EOE : invalid @@ -55,6 +59,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: only 's' command supported + info: test id: 1 EOE } @@ -86,6 +91,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr %sed: unable to edit '.+/1/f': .+% + info: test id: 1 EOE : empty @@ -94,6 +100,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: invalid path '' + info: test id: 1 EOE } @@ -103,6 +110,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: unexpected argument + info: test id: 1 EOE } @@ -124,6 +132,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: no delimiter for 's' command + info: test id: 1 EOE : invalid @@ -132,6 +141,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: invalid delimiter for 's' command + info: test id: 1 EOE } @@ -144,6 +154,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: unterminated 's' command regex + info: test id: 1 EOE : empty @@ -152,6 +163,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: empty regex in 's' command + info: test id: 1 EOE : invalid @@ -163,6 +175,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr %sed: invalid regex.*% + info: test id: 1 EOE } @@ -172,6 +185,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: unterminated 's' command replacement + info: test id: 1 EOE : invalid-flags @@ -180,6 +194,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: invalid 's' command flag 'a' + info: test id: 1 EOE } @@ -307,6 +322,7 @@ testscript:1:1: error: sed exit code 1 != 0 info: stderr: test/1/stderr sed: -i option specified while reading from stdin + info: test id: 1 EOE : edit diff --git a/tests/test/script/runner/cleanup.testscript b/tests/test/script/runner/cleanup.testscript index 7ea1acd..63fe459 100644 --- a/tests/test/script/runner/cleanup.testscript +++ b/tests/test/script/runner/cleanup.testscript @@ -49,6 +49,7 @@ b += --no-column : $c <'$* &a' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup file test/1/a does not exist + info: test id: 1 EOE : out-wd @@ -57,6 +58,7 @@ b += --no-column : $c <'$* &../../a' && $b 2>>/EOE != 0 testscript:1: error: file cleanup ../../a is out of working directory test/ + info: test id: 1 EOE : in-wd @@ -66,6 +68,7 @@ b += --no-column : $c <'$* &../a' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup file test/a does not exist + info: test id: 1 EOE : not-file @@ -74,6 +77,7 @@ b += --no-column : $c <'$* -d a &a' && $b 2>>/~%EOE% != 0 %error: unable to remove file test/1/a: .+% + info: test id: 1 EOE } @@ -105,6 +109,7 @@ b += --no-column : $c <'$* &a/' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup directory test/1/a/ does not exist + info: test id: 1 EOE : out-wd @@ -113,6 +118,7 @@ b += --no-column : $c <'$* &../../a/' && $b 2>>/EOE != 0 testscript:1: error: directory cleanup ../../a/ is out of working directory test/ + info: test id: 1 EOE : in-wd @@ -122,6 +128,7 @@ b += --no-column : $c <'$* &../a/' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup directory test/a/ does not exist + info: test id: 1 EOE : not-empty @@ -138,6 +145,7 @@ b += --no-column testscript:2: error: registered for cleanup directory test/1/a/ is not empty %.%{10} and 2 more file(s) + info: test id: 1 EOE : dir @@ -145,6 +153,7 @@ b += --no-column $c <'$* -d a/b' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup directory test/1/ is not empty a/ + info: test id: 1 EOE } @@ -154,6 +163,7 @@ b += --no-column : $c <'$* -f a &a/' && $b 2>>/~%EOE% != 0 %error: unable to remove directory test/1/a/: .+% + info: test id: 1 EOE } @@ -180,6 +190,7 @@ b += --no-column testscript:1: error: registered for cleanup directory test/1/a/ is not empty c info: wildcard: 'test/1/a/***/' + info: test id: 1 EOE } @@ -202,6 +213,7 @@ b += --no-column : $c <'$* &a/***' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup directory test/1/a/ does not exist + info: test id: 1 EOE : out-wd @@ -210,6 +222,7 @@ b += --no-column : $c <'$* &../../a/***' && $b 2>>/EOE != 0 testscript:1: error: wildcard cleanup ../../a/*** is out of working directory test/ + info: test id: 1 EOE : in-wd @@ -220,6 +233,7 @@ b += --no-column : $c <'$* &../a/***' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup directory test/a/ does not exist + info: test id: 1 EOE : not-dir @@ -228,6 +242,7 @@ b += --no-column : $c <'$* -f a &a/***' && $b 2>>/~%EOE% != 0 %error: unable to remove directory test/1/a/: .*% + info: test id: 1 EOE } } @@ -257,6 +272,7 @@ b += --no-column : $c <'$* &a/**/' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup wildcard test/1/a/**/ doesn't match any directory + info: test id: 1 EOE : not-dir @@ -265,6 +281,7 @@ b += --no-column : $c <'$* -f a &a/**/' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup wildcard test/1/a/**/ doesn't match any directory + info: test id: 1 EOE : not-empty @@ -275,6 +292,7 @@ b += --no-column testscript:1: error: registered for cleanup directory test/1/a/b/ is not empty d info: wildcard: 'test/1/a/**/' + info: test id: 1 EOE } @@ -331,6 +349,7 @@ EOI $c <'$* -o foo >=a &!a' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup directory test/1/ is not empty a + info: test id: 1 EOE : explicit-overwrite @@ -343,4 +362,5 @@ $* -o foo >=a EOO testscript:2: error: registered for cleanup directory test/1/ is not empty a + info: test id: 1 EOE diff --git a/tests/test/script/runner/exit.testscript b/tests/test/script/runner/exit.testscript index 9329ae4..38fd8e0 100644 --- a/tests/test/script/runner/exit.testscript +++ b/tests/test/script/runner/exit.testscript @@ -4,6 +4,8 @@ .include ../common.testscript +empty_id = '' + : special : { @@ -14,12 +16,14 @@ : $c <'exit | cat' && $b 2>>EOE != 0 testscript:1:1: error: exit builtin must be the only pipe command + info: test id: 1 EOE : from : $c <'echo "foo" | exit' && $b 2>>EOE != 0 testscript:1:1: error: exit builtin must be the only pipe command + info: test id: 1 EOE } @@ -30,18 +34,21 @@ : $c <'exit >EOE != 0 testscript:1:1: error: exit builtin stdin cannot be redirected + info: test id: 1 EOE : stdout : $c <'exit >foo' && $b 2>>EOE != 0 testscript:1:1: error: exit builtin stdout cannot be redirected + info: test id: 1 EOE : stderr : $c <'exit 2>foo' && $b 2>>EOE != 0 testscript:1:1: error: exit builtin stderr cannot be redirected + info: test id: 1 EOE } @@ -49,6 +56,7 @@ : $c <'exit != 0' && $b 2>>EOE != 0 testscript:1:1: error: exit builtin exit code cannot be non-zero + info: test id: 1 EOE } @@ -63,12 +71,14 @@ : $c <'exit "foo"' && $b 2>>EOE != 0 testscript:1:1: error: foo + info: test id: 1 EOE : unexpected : $c <'exit "foo" "bar"' && $b 2>>EOE != 0 testscript:1:1: error: unexpected argument + info: test id: 1 EOE } @@ -101,13 +111,16 @@ : not executed. If they were, there would be a diagnostics printed to : stderr regarding non-existent file. : - $c <>EOO 2>'testscript:1:1: error: message' != 0 + $c <>EOO 2>>EOE != 0 echo foo >| &b && exit 'message' && echo bar >| echo baz >|; echo boz >| EOI foo EOO + testscript:1:1: error: message + info: test id: 1 + EOE } : command-if @@ -130,7 +143,7 @@ : failure : - $c <'testscript:2:3: error: message' != 0 + $c <>EOE != 0 if true exit 'message' echo foo >| @@ -139,6 +152,9 @@ end echo baz >| EOI + testscript:2:3: error: message + info: test id: 1 + EOE } : else-clause @@ -158,7 +174,7 @@ : failure : - $c <'testscript:4:3: error: message' != 0 + $c <>EOE != 0 if false echo foo >| else @@ -167,6 +183,9 @@ end echo baz >| EOI + testscript:4:3: error: message + info: test id: 1 + EOE } } @@ -189,7 +208,7 @@ : failure : - $c <'testscript:1:1: error: message' != 0 + $c <>EOE != 0 if exit 'message' echo foo >| else @@ -197,6 +216,9 @@ end; echo baz >| EOI + testscript:1:1: error: message + info: test id: 1 + EOE } : elif @@ -216,7 +238,7 @@ : failure : - $c <'testscript:2:1: error: message' != 0 + $c <>EOE != 0 if false elif exit 'message' echo foo >| @@ -225,6 +247,9 @@ end; echo baz >| EOI + testscript:2:1: error: message + info: test id: 1 + EOE } } @@ -249,7 +274,7 @@ : failure : - $c <'testscript:1:1: error: message' != 0 + $c <>"EOE" != 0 if exit 'message' { echo foo >| @@ -259,6 +284,9 @@ echo bar >| } EOI + testscript:1:1: error: message + info: test id: $empty_id + EOE } : elif @@ -282,7 +310,7 @@ : failure : - $c <'testscript:4:1: error: message' != 0 + $c <>"EOE" != 0 if false { } @@ -295,6 +323,9 @@ echo bar >| } EOI + testscript:4:1: error: message + info: test id: $empty_id + EOE } } @@ -325,7 +356,7 @@ : and cleanups are also not executed (they would fail due to non-existent : file 'a'). : - $c <'testscript:2:2: error: message' != 0 + $c <>"EOE" != 0 +true &a +exit 'message' @@ -333,6 +364,9 @@ -touch b/c EOI + testscript:2:2: error: message + info: test id: $empty_id + EOE } : inner-scope @@ -362,7 +396,7 @@ : as well as the independent inner scope (remember the sequential : execution). : - $c <'testscript:3:1: error: message' != 0 + $c <>EOE != 0 +true &a exit 'message' @@ -371,6 +405,9 @@ -touch b/c EOI + testscript:3:1: error: message + info: test id: 3 + EOE } : teardown @@ -390,11 +427,14 @@ : : Test that cleanups are not executed. : - $c <'testscript:2:2: error: message' != 0 + $c <>"EOE" != 0 -true &a -exit 'message' -echo foo >| EOI + testscript:2:2: error: message + info: test id: $empty_id + EOE } } } diff --git a/tests/test/script/runner/expr.testscript b/tests/test/script/runner/expr.testscript index 36c15fd..b8dbfdc 100644 --- a/tests/test/script/runner/expr.testscript +++ b/tests/test/script/runner/expr.testscript @@ -21,7 +21,7 @@ true = '$* >| -o' false = '$* -s 1 >| -o' - bf = $b 2>/~'%.+/driver(\.exe)? exit code 1 != 0%' + bf = $b 2>- : true : @@ -510,6 +510,7 @@ /.{7} -X +2 + info: test id: 1 EOE : non-trailing @@ -518,5 +519,6 @@ /.{7} -X +2 + info: test id: 1 EOE } diff --git a/tests/test/script/runner/pipe.testscript b/tests/test/script/runner/pipe.testscript index 7ef5893..ac23645 100644 --- a/tests/test/script/runner/pipe.testscript +++ b/tests/test/script/runner/pipe.testscript @@ -19,6 +19,7 @@ $c <'$* -o foo | cat >foo' && $b : process-to-builtin $c <'$* -o foo -s 1 | $* -i 1 >foo -s 2' && $b 2>>/~%EOE% != 0 %testscript:1:1: error: .+ exit code 2 != 0% info: stdout: test/1/stdout-2 + info: test id: 1 EOE : stderr @@ -31,5 +32,6 @@ $c <'$* -o foo | cat >foo' && $b : process-to-builtin %.{3} -baz +foo + info: test id: 1 EOE } diff --git a/tests/test/script/runner/redirect.testscript b/tests/test/script/runner/redirect.testscript index 7e4e42d..f752403 100644 --- a/tests/test/script/runner/redirect.testscript +++ b/tests/test/script/runner/redirect.testscript @@ -99,6 +99,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. %@@ \.*% -bar +foo + info: test id: 1 EOE $c <'$* -i 2 foo' && $b : inerr @@ -115,6 +116,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. -foo +foo \ No newline at end of file + info: test id: 1 EOE : no-newline-fail2 @@ -125,6 +127,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. -foo \ No newline at end of file +foo + info: test id: 1 EOE : merge @@ -162,6 +165,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. info: stdout: test/1/stdout info: stdout regex: test/1/stdout.regex fooo + info: test id: 1 EOE : portable-path-failure @@ -178,6 +182,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. info: stdout regex: test/1/stdout.regex info: stdin: test/1/stdin foo + info: test id: 1 EOE cat test/1/stdout.regex >"%bar$psr%" @@ -189,6 +194,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. info: stdout regex: test/1/stdout.regex info: stdin: test/1/stdin foo + info: test id: 1 EOE cat test/1/stdout.regex >:"%bar$psr%" } @@ -303,6 +309,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. -foo +foo \ No newline at end of file + info: test id: 1 EOE : no-newline-fail2 @@ -319,6 +326,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. -foo \ No newline at end of file +foo + info: test id: 1 EOE : no-newline-empty @@ -371,6 +379,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. info: expected stdout: test/1/stdout.orig info: stdout diff: test/1/stdout.diff info: stdin: test/1/stdin + info: test id: 1 EOE : portable-path @@ -445,6 +454,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. info: stdout: test/1/stdout info: stdout regex: test/1/stdout.regex foo + info: test id: 1 EOE : mismatch-icase @@ -458,6 +468,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. info: stdout: test/1/stdout info: stdout regex: test/1/stdout.regex-i foo + info: test id: 1 EOE } } @@ -501,6 +512,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. %@@ \.*% -foo +bar + info: test id: 1 EOE } diff --git a/tests/test/script/runner/regex.testscript b/tests/test/script/runner/regex.testscript index 46b1872..ee4b25e 100644 --- a/tests/test/script/runner/regex.testscript +++ b/tests/test/script/runner/regex.testscript @@ -35,6 +35,7 @@ $c <'cat ~/foo[/' && $b 2>>~/EOE/ != 0 /testscript:1:12: error: invalid stdout regex redirect.*/ info: regex: '/foo[/' + info: test id: 1 EOE : no-match @@ -45,6 +46,7 @@ info: stdout regex: test/1/stdout.regex info: stdin: test/1/stdin foo + info: test id: 1 EOE } @@ -129,6 +131,7 @@ EOI testscript:2:1: error: invalid syntax character 'x' in stdout regex redirect info: regex line: '/x' + info: test id: 1 EOE : invalid-char-regex @@ -140,6 +143,7 @@ EOI /testscript:2:1: error: invalid char-regex in stdout regex redirect.*/ info: regex line: '/foo[/' + info: test id: 1 EOE : invalid-line-regex @@ -152,6 +156,7 @@ EOI %testscript:4:1: error: invalid stdout regex redirect.*% info: stdout regex: test/1/stdout.regex + info: test id: 1 EOE : no-match @@ -170,6 +175,7 @@ info: stdout regex: test/1/stdout.regex info: stdin: test/1/stdin foo + info: test id: 1 EOE } } diff --git a/tests/test/script/runner/set.testscript b/tests/test/script/runner/set.testscript index b10ce1e..62f5b24 100644 --- a/tests/test/script/runner/set.testscript +++ b/tests/test/script/runner/set.testscript @@ -11,6 +11,7 @@ : $c <'set foo | cat >bar' && $b 2>>EOE != 0 testscript:1:1: error: set builtin must be the last pipe command + info: test id: 1 EOE : redirecting @@ -20,12 +21,14 @@ : $c <'set foo >bar' && $b 2>>EOE != 0 testscript:1:1: error: set builtin stdout cannot be redirected + info: test id: 1 EOE : stderr : $c <'set foo 2>bar' && $b 2>>EOE != 0 testscript:1:1: error: set builtin stderr cannot be redirected + info: test id: 1 EOE } @@ -33,6 +36,7 @@ : $c <'set foo == 1' && $b 2>>EOE != 0 testscript:1:1: error: set builtin exit code cannot be non-zero + info: test id: 1 EOE } @@ -43,24 +47,28 @@ : $c <'set -e' && $b 2>>EOE != 0 testscript:1:1: error: missing variable name + info: test id: 1 EOE : unexpected : $c <'set foo bar baz' && $b 2>>EOE != 0 testscript:1:1: error: unexpected argument + info: test id: 1 EOE : empty-attrs : $c <"set '' baz" && $b 2>>EOE != 0 testscript:1:1: error: empty variable attributes + info: test id: 1 EOE : empty-var : $c <"set ''" && $b 2>>EOE != 0 testscript:1:1: error: empty variable name + info: test id: 1 EOE } @@ -256,6 +264,7 @@ EOI :1:1: error: expected '[' instead of 'x' testscript:1:1: info: while parsing attributes 'x' + info: test id: 1 EOE : unknown @@ -265,6 +274,7 @@ EOI :1:1: error: unknown value attribute x testscript:1:1: info: while parsing attributes '[x]' + info: test id: 1 EOE : junk @@ -274,5 +284,6 @@ EOI :1:10: error: trailing junk after ']' testscript:1:1: info: while parsing attributes '[string] x' + info: test id: 1 EOE } diff --git a/tests/test/script/runner/status.testscript b/tests/test/script/runner/status.testscript index 1689a69..0532ed3 100644 --- a/tests/test/script/runner/status.testscript +++ b/tests/test/script/runner/status.testscript @@ -17,6 +17,7 @@ b += --no-column : $c <'$* -s 1 == 0' && $b 2>>/~%EOE%d != 0 %testscript:1: error: ../../../../driver(.exe)? exit code 1 != 0% + info: test id: 1 EOE } @@ -31,6 +32,7 @@ b += --no-column : $c <'$* -s 1 != 1' && $b 2>>/~%EOE% != 0 %testscript:1: error: ../../../../driver(.exe)? exit code 1 == 1% + info: test id: 1 EOE } @@ -40,6 +42,7 @@ $c <'$* -s 1 -e "Error"' && $b 2>>/~%EOE% != 0 %testscript:1: error: ../../../driver(.exe)? exit code 1 != 0% info: stderr: test/1/stderr Error + info: test id: 1 EOE #\ -- cgit v1.1