From 7cf026b8989a71a0d0e775e21e697ba9f1bee987 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 30 Jan 2017 23:31:45 +0300 Subject: Move builtin and runner tests to '$c ... && $b' pattern --- tests/test/script/builtin/cat.test | 31 +++--- tests/test/script/builtin/echo.test | 18 +++- tests/test/script/builtin/mkdir.test | 24 ++--- tests/test/script/builtin/rm.test | 33 +++---- tests/test/script/builtin/rmdir.test | 33 +++---- tests/test/script/builtin/test.test | 30 ++---- tests/test/script/builtin/touch.test | 21 ++-- tests/test/script/runner/cleanup.test | 81 +++++----------- tests/test/script/runner/redirect.test | 170 +++++++++------------------------ tests/test/script/runner/regex.test | 87 +++++------------ tests/test/script/runner/status.test | 18 ++-- 11 files changed, 180 insertions(+), 366 deletions(-) (limited to 'tests') diff --git a/tests/test/script/builtin/cat.test b/tests/test/script/builtin/cat.test index 442ef00..33515bc 100644 --- a/tests/test/script/builtin/cat.test +++ b/tests/test/script/builtin/cat.test @@ -6,7 +6,7 @@ : in : -$c <>EOO foo bar @@ -15,11 +15,10 @@ foo bar EOO EOI -$b : dash : -$c <>EOO foo bar @@ -28,11 +27,10 @@ foo bar EOO EOI -$b : file : -$c <=out; foo bar @@ -42,11 +40,10 @@ foo bar EOO EOI -$b : in-repeat : -$c <>EOO foo bar @@ -55,25 +52,31 @@ foo bar EOO EOI -$b : non-existent : -$c <>/~%EOE% != 0 %cat: unable to print '.+/test/cat/non-existent/test/1/in': .+% EOE EOI -$b : empty-path : : Cat an empty path. : -$c <"cat: invalid path ''" == 1 EOI -$b -# @@ When piping is ready test cat on a big file to test it is asynchronous. -# +: big +: +: Cat a big file (about 3MB) to test that the builtin is asynchronous. +: +{ + s="------------------------------------------------------------------------" + s="$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s" + s="$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s" + s="$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s" + $c <"cat <'$s' | cat >'$s'" && $b +} diff --git a/tests/test/script/builtin/echo.test b/tests/test/script/builtin/echo.test index 967e330..9e49a91 100644 --- a/tests/test/script/builtin/echo.test +++ b/tests/test/script/builtin/echo.test @@ -6,10 +6,20 @@ : string : -$c <'echo foo >foo'; -$b +$c <'echo foo >foo' && $b : strings : -$c <'echo foo bar >"foo bar"'; -$b +$c <'echo foo bar >"foo bar"' && $b + +: big +: +: Echo a big string (about 3MB) to test that the builtin is asynchronous. +: +{ + s="------------------------------------------------------------------------" + s="$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s" + s="$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s" + s="$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s" + $c <"echo '$s' | cat >'$s'" && $b +} diff --git a/tests/test/script/builtin/mkdir.test b/tests/test/script/builtin/mkdir.test index ace4012..8f97fe3 100644 --- a/tests/test/script/builtin/mkdir.test +++ b/tests/test/script/builtin/mkdir.test @@ -6,69 +6,61 @@ : dirs : -$c <"mkdir: missing directory" == 1'; -$b +$c <'mkdir 2>"mkdir: missing directory" == 1' && $b : empty-path : : Test creation of empty directory path. : -$c <"mkdir: invalid path ''" == 1 EOI -$b : already-exists : : Test creation of an existing directory. : -$c <>/~%EOE% == 1 %mkdir: unable to create directory '.+/test/mkdir/already-exists/test/1/a': .+% EOE EOI -$b : not-exists : : Test creation of a directory with non-existent parent. : -$c <>/~%EOE% == 1 %mkdir: unable to create directory '.+/test/mkdir/not-exists/test/1/a/b': .+% EOE EOI -$b diff --git a/tests/test/script/builtin/rm.test b/tests/test/script/builtin/rm.test index 937633b..9a9ffc6 100644 --- a/tests/test/script/builtin/rm.test +++ b/tests/test/script/builtin/rm.test @@ -11,15 +11,13 @@ : : Removing with no arguments fails. : - $c <'rm 2>"rm: missing file" == 1'; - $b + $c <'rm 2>"rm: missing file" == 1' && $b : force : : Removing with no arguments succeeds with -f option. : - $c <'rm -f'; - $b + $c <'rm -f' && $b } : file @@ -29,11 +27,10 @@ : : Removing existing file succeeds. : - $c <>/~%EOE% == 1 %rm: unable to remove '.+/file/not-exists/fail/test/1/a': .+% EOE EOI - $b : force : : Removing non-existing file succeeds with -f option. : - $c <'rm -f a'; - $b + $c <'rm -f a' && $b } } @@ -65,30 +60,27 @@ : : Removing directory fails by default. : - $c <"rm: '$normalize([path] $~/a)' is a directory" == 1 EOI - $b : recursive : : Removing directory succeeds with -r option. : - $c <"rm: '([string] $~)' contains test working directory '$~'" == 1 EOI - $b } : path @@ -98,10 +90,9 @@ : : Removing an empty path fails. : - $c <"rm: invalid path ''" == 1 EOI - $b : outside-scope : @@ -112,19 +103,17 @@ : : Removing path outside the testscript working directory fails. : - $c <>/~%EOE% == 1 %rm: '.+/path/outside-scope/fail/a/b/c' is out of working directory '.+/path/outside-scope/fail/test'% EOE EOI - $b : force : : Removing path outside the testscript working directory succeeds with -f : option. : - $c <'rm -f ../../a/b/c'; - $b + $c <'rm -f ../../a/b/c' && $b } } diff --git a/tests/test/script/builtin/rmdir.test b/tests/test/script/builtin/rmdir.test index 7621425..6666f79 100644 --- a/tests/test/script/builtin/rmdir.test +++ b/tests/test/script/builtin/rmdir.test @@ -11,15 +11,13 @@ : : Removing with no arguments fails. : - $c <'rmdir 2>"rmdir: missing directory" == 1'; - $b + $c <'rmdir 2>"rmdir: missing directory" == 1' && $b : force : : Removing with no arguments succeeds with -f option. : - $c <'rmdir -f'; - $b + $c <'rmdir -f' && $b } : dir @@ -29,19 +27,17 @@ : : Removing an empty path fails. : - $c <"rmdir: invalid path ''" == 1 EOI - $b : test-scope : : Removing scope directory fails. : - $c <"rmdir: '$~' contains test working directory '$~'" == 1 EOI - $b : outside-scope : @@ -52,31 +48,28 @@ : : Removing directory outside the testscript working directory fails. : - $c <>/~%EOE% == 1 %rmdir: '.+/dir/outside-scope/fail/a/b/c' is out of working directory '.+/dir/outside-scope/fail/test'% EOE EOI - $b : force : : Removing path outside the testscript working directory succeeds with -f : option. : - $c <'rmdir -f ../../a/b/c'; - $b + $c <'rmdir -f ../../a/b/c' && $b } : exists : : Removing existing directory succeeds. : - $c <>/~%EOE% == 1 %rmdir: unable to remove '.+/dir/not-exists/fail/test/1/a': .+% EOE EOI - $b : force : : Removing non-existing directory succeeds with -f option. : - $c <'rmdir -f a'; - $b + $c <'rmdir -f a' && $b } : not-empty : : Removing non-empty directory fails. : - $c <>/~%EOE% == 1 %rmdir: unable to remove '.+/dir/not-empty/test/1/a': .+% EOE EOI - $b : not-dir : : Removing not a directory path fails. : - $c <>/~%EOE% == 1 %rmdir: unable to remove '.+/dir/not-dir/test/1/a': .+% EOE EOI - $b } diff --git a/tests/test/script/builtin/test.test b/tests/test/script/builtin/test.test index 7e9ace4..2e792ad 100644 --- a/tests/test/script/builtin/test.test +++ b/tests/test/script/builtin/test.test @@ -9,21 +9,18 @@ { : exists : - $c <"test: missing path" == 2'; -$b +$c <'test 2>"test: missing path" == 2' && $b : invalid-option : : Test passing invalid option. : -$c <'test -c a 2>"test: invalid option" == 2'; -$b +$c <'test -c a 2>"test: invalid option" == 2' && $b : unexpected-arg : : Test passing extra argument. : -$c <'test -f a b 2>"test: unexpected argument" == 2'; -$b +$c <'test -f a b 2>"test: unexpected argument" == 2' && $b : empty-path : : Test testing an empty path. : -$c <"test: invalid path ''" == 2 EOI -$b diff --git a/tests/test/script/builtin/touch.test b/tests/test/script/builtin/touch.test index b3a043e..3a543e8 100644 --- a/tests/test/script/builtin/touch.test +++ b/tests/test/script/builtin/touch.test @@ -6,28 +6,25 @@ : file : -$c <'touch a'; -$b +$c <'touch a' && $b : file-create : : Test that file is created. If it didn't then 'rm' would fail. : -$c <=a; touch a EOI -$b : no-cleanup : @@ -35,7 +32,7 @@ $b : the file would be removed while leaving the embedded scope, and so the : cleanup registered by the first touch would fail. : -$c <"touch: missing file" == 1'; -$b +$c <'touch 2>"touch: missing file" == 1' && $b : empty-path : : Test touching an empty path. : -$c <"touch: invalid path ''" == 1 EOI -$b : dir-update : : Test touching an existing directory. : -$c <"touch: '$a' exists and is not a file" == 1 EOI -$b diff --git a/tests/test/script/runner/cleanup.test b/tests/test/script/runner/cleanup.test index 1c3ccae..7b3539b 100644 --- a/tests/test/script/runner/cleanup.test +++ b/tests/test/script/runner/cleanup.test @@ -6,26 +6,20 @@ b += --no-column -# @@ TODO: $c <'$* -f a &a' && $b -# - : file : { : always : - $c <'$* -f a &a'; - $b + $c <'$* -f a &a' && $b : maybe : - $c <'$* &?a'; - $b + $c <'$* &?a' && $b : never : - $c <'$* &!a'; - $b + $c <'$* &!a' && $b : implicit : @@ -33,30 +27,27 @@ b += --no-column : implicitly registered for cleanup. If it were, the test would fail due to : the file absence at the cleanup time. : - $c <+a; rm a EOI - $b : not-exists : : Test cleanup of non-existing file. : - $c <'$* &a'; - $b 2>>/EOE != 0 + $c <'$* &a' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup file test/1/a does not exist EOE @@ -64,8 +55,7 @@ b += --no-column : : Test explicit cleanup of a file out of the testscript working directory. : - $c <'$* &../../a'; - $b 2>>/EOE != 0 + $c <'$* &../../a' && $b 2>>/EOE != 0 testscript:1: error: file cleanup ../../a is out of working directory test/ EOE @@ -74,8 +64,7 @@ b += --no-column : Test cleanup explicit registration of a file being outside the test working : directory but inside the script working directory. : - $c <'$* &../a'; - $b 2>>/EOE != 0 + $c <'$* &../a' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup file test/a does not exist EOE @@ -83,8 +72,7 @@ b += --no-column : : Test cleanup of a directory as a file. : - $c <'$* -d a &a'; - $b 2>>/~%EOE% != 0 + $c <'$* -d a &a' && $b 2>>/~%EOE% != 0 %error: unable to remove file test/1/a: .+% EOE } @@ -94,13 +82,11 @@ b += --no-column { : always : - $c <'$* -d a &a/'; - $b + $c <'$* -d a &a/' && $b : maybe : - $c <'$* &?a/'; - $b + $c <'$* &?a/' && $b : implicit : @@ -108,18 +94,16 @@ b += --no-column : not implicitly registered for cleanup. If it were, the test would fail due : to the directory absence at the cleanup time. : - $c <>/EOE != 0 + $c <'$* &a/' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup directory test/1/a/ does not exist EOE @@ -127,8 +111,7 @@ b += --no-column : : Test cleanup of a directory out of the testscript working directory. : - $c <'$* &../../a/'; - $b 2>>/EOE != 0 + $c <'$* &../../a/' && $b 2>>/EOE != 0 testscript:1: error: directory cleanup ../../a/ is out of working directory test/ EOE @@ -137,8 +120,7 @@ b += --no-column : Test cleanup explicit registration of a directory being outside the test : working directory but inside the testscript working directory. : - $c <'$* &../a/'; - $b 2>>/EOE != 0 + $c <'$* &../a/' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup directory test/a/ does not exist EOE @@ -146,8 +128,7 @@ b += --no-column : : Test cleanup of a non-empty directory. : - $c <'$* -d a -f a/b &a/'; - $b 2>>/EOE != 0 + $c <'$* -d a -f a/b &a/' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup directory test/1/a/ is not empty EOE @@ -155,8 +136,7 @@ b += --no-column : : Test cleanup of a file as a directory. : - $c <'$* -f a &a/'; - $b 2>>/~%EOE% != 0 + $c <'$* -f a &a/' && $b 2>>/~%EOE% != 0 %error: unable to remove directory test/1/a/: .+% EOE } @@ -166,20 +146,17 @@ b += --no-column { : always : - $c <'$* -d a/b -f a/b/c &a/***'; - $b + $c <'$* -d a/b -f a/b/c &a/***' && $b : maybe : - $c <'$* &?a/***'; - $b + $c <'$* &?a/***' && $b : not-exists : : Test cleanup of a wildcard not matching any directory. : - $c <'$* &a/***'; - $b 2>>/EOE != 0 + $c <'$* &a/***' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup wildcard test/1/a/*** doesn't match a directory EOE @@ -187,8 +164,7 @@ b += --no-column : : Test cleanup of a wildcard out of the testscript working directory. : - $c <'$* &../../a/***'; - $b 2>>/EOE != 0 + $c <'$* &../../a/***' && $b 2>>/EOE != 0 testscript:1: error: wildcard cleanup ../../a/*** is out of working directory test/ EOE @@ -198,8 +174,7 @@ b += --no-column : outside the test working directory is inside the testscript working : directory. : - $c <'$* &../a/***'; - $b 2>>/EOE != 0 + $c <'$* &../a/***' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup wildcard test/a/*** doesn't match a directory EOE @@ -207,8 +182,7 @@ b += --no-column : : Test cleanup of a file as a wildcard. : - $c <'$* -f a &a/***'; - $b 2>>/~%EOE% != 0 + $c <'$* -f a &a/***' && $b 2>>/~%EOE% != 0 %error: unable to remove directory test/1/a/: .+% EOE } @@ -217,15 +191,13 @@ b += --no-column : : Test that cleanup is performed in registration reversed order. : -$c <'$* -d a/b &a/ &a/b/'; -$b +$c <'$* -d a/b &a/ &a/b/' && $b : implicit-overwrite : : Test an implicit cleanup being overwritten with the explicit one, : -$c <'$* -o foo >=a &!a'; -$b 2>>/EOE != 0 +$c <'$* -o foo >=a &!a' && $b 2>>/EOE != 0 testscript:1: error: registered for cleanup directory test/1/ is not empty EOE @@ -233,10 +205,9 @@ EOE : : Test an explicit cleanup not being overwritten with the implicit one. : -$c <>/EOE != 0 $* &!a; $* -o foo >=a EOO -$b 2>>/EOE != 0 testscript:2: error: registered for cleanup directory test/1/ is not empty EOE diff --git a/tests/test/script/runner/redirect.test b/tests/test/script/runner/redirect.test index cfc12c5..3cd6c69 100644 --- a/tests/test/script/runner/redirect.test +++ b/tests/test/script/runner/redirect.test @@ -12,7 +12,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : pass : { - $c <'$* -i 1 -e bar <| >| 2>|'; + cat <'$* -i 1 -e bar <| >| 2>|' >=testscript; cat <=buildfile; test{testscript}: $target EOI @@ -22,15 +22,8 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : null : { - : out - : - $c <'$* -o foo >-'; - $b - - : err - : - $c <'$* -e foo 2>-'; - $b + $c <'$* -o foo >-' && $b : out + $c <'$* -e foo 2>-' && $b : err } : str @@ -39,25 +32,10 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : literal : { - : in - : - $c <'$* -i 0 foo'; - $b - - : err - : - $c <'$* -e foo 2>foo'; - $b - - : inout - : - $c <'$* -i 1 foo'; - $b + $c <'$* -i 0 foo' && $b : out + $c <'$* -e foo 2>foo' && $b : err + $c <'$* -i 1 foo' && $b : inout : inout-fail : @@ -75,30 +53,11 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. +foo EOE - : inerr - : - $c <'$* -i 2 foo'; - $b - - : inout-err - : - $c <'$* -i 1 -e bar foo 2>bar'; - $b - - : empty - : - $c <'$* -o "" >""'; - $b - - : no-newline - : - $c <'$* -i 1 <:"foo" >:"foo"'; - $b - - : no-newline-empty - : - $c <'$* -i 1 <:"" >:""'; - $b + $c <'$* -i 2 foo' && $b : inerr + $c <'$* -i 1 -e bar foo 2>bar' && $b : inout-err + $c <'$* -o "" >""' && $b : empty + $c <'$* -i 1 <:"foo" >:"foo"' && $b : no-newline + $c <'$* -i 1 <:"" >:""' && $b : no-newline-empty : no-newline-fail1 : @@ -124,31 +83,19 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : merge : - $c <>EOE 1>&2 foo bar EOE EOI - $b : portable-path : { - : in - : - $c <"\$* -i 1 'foo$ps'"; - $b - - : out - : - $c <"\$* -i 1 <'foo$ps' >/'foo/'"; - $b - - : err - : - $c <"\$* -i 2 <'foo$ps' 2>/'foo/'"; - $b + $c <"\$* -i 1 'foo$ps'" && $b : in + $c <"\$* -i 1 <'foo$ps' >/'foo/'" && $b : out + $c <"\$* -i 2 <'foo$ps' 2>/'foo/'" && $b : err } } @@ -211,37 +158,34 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. { : in : - $c <>EOO foo bar EOO EOI - $b : err : - $c <>EOO foo bar EOO EOI - $b : inout : - $c <>EOO foo bar @@ -250,11 +194,10 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. bar EOO EOI - $b : inerr : - $c <>EOE foo bar @@ -263,59 +206,53 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. bar EOE EOI - $b : empty : - $c <>EOO EOF EOO EOI - $b : shared : - $c <>EOF foo bar EOF EOI - $b : extra-newline : - $c <>EOO EOF EOO EOI - $b : no-newline : - $c <>:EOO foo EOF foo EOO EOI - $b : no-newline-fail1 : - $c <>~/EOE/ != 0 $* -i 1 <<:EOF >>EOO foo EOF foo EOO EOI - $b 2>>~/EOE/ != 0 /testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/ /.{7} -foo @@ -325,14 +262,13 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : no-newline-fail2 : - $c <>~/EOE/ != 0 $* -i 1 <>:EOO foo EOF foo EOO EOI - $b 2>>~/EOE/ != 0 /testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/ /.{7} -foo @@ -342,27 +278,25 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : no-newline-empty : - $c <>:EOO EOF EOO EOI - $b : no-newline-extra-newline : - $c <>:EOO EOF EOO EOI - $b : merge : - $c <>EOO 2>&1 foo bar @@ -372,23 +306,21 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. baz EOO EOI - $b : large-diff : : Make sure that the large (>4KB) expected/real output difference is not : printed as a part of the diagnostics. : - $c <>/~%EOE%d != 0 + s="----------------------------------------------------------------------"; + s="$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s"; $* -i 1 <<"EOF" >>"EOO" $s EOF x$s EOO EOI - $b 2>>/~%EOE%d != 0 %testscript:3: error: ../../../../../driver(.exe)? stdout doesn't match the expected output% info: stdout: test/1/stdout info: expected stdout: test/1/stdout.orig @@ -401,30 +333,27 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. { : in : - $c <<"EOI"; + $c <<"EOI" && $b \$* -i 1 <'foo$ps' foo/ EOF EOI - $b : out : - $c <<"EOI"; + $c <<"EOI" && $b \$* -i 1 <'foo$ps' >>/EOO foo/ EOO EOI - $b : err : - $c <<"EOI"; + $c <<"EOI" && $b \$* -i 2 <'foo$ps' 2>>/EOE foo/ EOE EOI - $b } } @@ -436,41 +365,37 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. { : match : - $c <>~/EOO/i /FO*/* bar /* EOO EOI - $b : match-empty : - $c <>:~/EOO/ /.{0} EOO EOI - $b : shared : - $c <>~/EOF/ 2>>~/EOF/ foo EOF EOI - $b : mismatch : - $c <>/~%EOE%d != 0 $* -o foo >>~/EOO/ bar EOO EOI - $b 2>>/~%EOE%d != 0 %testscript:1: error: ../../../../../driver(.exe)? stdout doesn't match the regex% info: stdout: test/1/stdout info: stdout regex: test/1/stdout.regex @@ -478,12 +403,11 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : mismatch-icase : - $c <>/~%EOE%d != 0 $* -o foo >>~/EOO/i bar EOO EOI - $b 2>>/~%EOE%d != 0 %testscript:1: error: ../../../../../driver(.exe)? stdout doesn't match the regex% info: stdout: test/1/stdout info: stdout regex: test/1/stdout.regex~i @@ -496,18 +420,17 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. { : in : - $c <=out; $* -i 1 <<foo EOI - $b : out : { : match : - $c <=out; $* -e bar 2>+out; $* -i 1 <>>out @@ -515,15 +438,13 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. bar EOF EOI - $b : mismatch : - $c <>/~%EOE%d != 0 $* -o foo >=out; $* -o bar >>>out EOI - $b 2>>/~%EOE%d != 0 %testscript:2: error: ../../../../../driver(.exe)? stdout doesn't match the expected output% info: stdout: test/1/stdout-2 info: expected stdout: test/1/out @@ -538,7 +459,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : merge : - $c <&1 >=out; $* -e baz -o biz 1>&2 2>+out; $* -i 1 <<>EOO @@ -548,5 +469,4 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. biz EOO EOI - $b } diff --git a/tests/test/script/runner/regex.test b/tests/test/script/runner/regex.test index f4863b1..413069c 100644 --- a/tests/test/script/runner/regex.test +++ b/tests/test/script/runner/regex.test @@ -23,20 +23,9 @@ : str : { - : out - : - $c <'cat ~/fo./'; - $b - - : err - : - $c <'cat &2 2>~/fo./'; - $b - - : no-newline - : - $c <'cat <:foo >:~/fo./'; - $b + $c <'cat ~/fo./' && $b : out + $c <'cat &2 2>~/fo./' && $b : err + $c <'cat <:foo >:~/fo./' && $b : no-newline : malformed : @@ -55,34 +44,31 @@ { : out : - $c <>~/EOO/ /foo/ EOO EOI - $b : err : - $c <&2 2>>~/EOO/ /fo./ EOO EOI - $b : no-newline : - $c <>:~/EOO/ /fo./ EOO EOI - $b : line-char : - $c <>~/EOO/ foo bar @@ -107,11 +93,10 @@ //{2} EOO EOI - $b : expansion : - $c <>EOE != 0 $* -o foo >>~/EOO/ /x EOO EOI - $b 2>>EOE != 0 testscript:2:3: error: invalid syntax character 'x' in stdout regex redirect info: regex line: '/x' EOE : invalid-char-regex : - $c <>~/EOE/ != 0 $* -o foo >>~/EOO/ /foo[/ EOO EOI - $b 2>>~/EOE/ != 0 /testscript:2:3: error: invalid char-regex in stdout regex redirect.*/ info: regex line: '/foo[/' EOE : invalid-line-regex : - $c <>/~%EOE% != 0 $* -o foo >>~/EOO/ a /{ EOO EOI - $b 2>>/~%EOE% != 0 %testscript:4:3: error: invalid stdout regex redirect.*% info: stdout regex: test/1/stdout.regex EOE @@ -174,8 +155,7 @@ { : i : - $c <'cat ~/foo/i'; - $b + $c <'cat ~/foo/i' && $b : d : @@ -185,15 +165,13 @@ : Escaped dot becomes syntax dot and matches any character ('i' in our : case). : - $c <'cat ~/f\\.o/d'; - $b + $c <'cat ~/f\\.o/d' && $b : syntax-dot : : Syntax dot becomes escaped dot and matches only '.' and so we fail. : - $c <'cat ~/f.o/d'; - $b 2>>~/EOE/ != 0 + $c <'cat ~/f.o/d' && $b 2>>~/EOE/ != 0 testscript:1:1: error: cat stdout doesn't match the regex /.+ EOE @@ -204,12 +182,11 @@ { : i : - $c <>~/EOO/ /foo/i EOO EOI - $b : d : @@ -219,21 +196,19 @@ { : escaped-dot : - $c <>~/EOO/ /f\.o/d EOO EOI - $b : syntax-dot : - $c <>~/EOE/ != 0 cat >~/EOO/ /f.o/d EOO EOI - $b 2>>~/EOE/ != 0 testscript:1:1: error: cat stdout doesn't match the regex /.+ EOE @@ -244,33 +219,30 @@ { : i : - $c <>~/EOO/i /foo/ EOO EOI - $b : d : { : escaped-dot : - $c <>~/EOO/d /f\.o/ EOO EOI - $b : syntax-dot : - $c <>~/EOE/ != 0 cat >~/EOO/d /f.o/ EOO EOI - $b 2>>~/EOE/ != 0 testscript:1:1: error: cat stdout doesn't match the regex /.+ EOE @@ -287,35 +259,26 @@ : str : { - : out - : - $c <"cat <'foo$ps' >/~%foo/%"; - $b - - : err - : - $c <"cat <'foo$ps' >/~%foo/%"; - $b + $c <"cat <'foo$ps' >/~%foo/%" && $b : out + $c <"cat <'foo$ps' 1>&2 2>/~%foo/%" && $b : err } : doc { : out : - $c <<"EOI"; + $c <<"EOI" && $b cat <'foo$ps' >>/~%EOO% foo/ EOO EOI - $b : err : - $c <<"EOI"; - cat <'foo$ps' >>/~%EOO% + $c <<"EOI" && $b + cat <'foo$ps' 1>&2 2>>/~%EOO% foo/ EOO EOI - $b } } diff --git a/tests/test/script/runner/status.test b/tests/test/script/runner/status.test index c1df3e4..67ce3ae 100644 --- a/tests/test/script/runner/status.test +++ b/tests/test/script/runner/status.test @@ -11,13 +11,11 @@ b += --no-column { : true : - $c <'$* == 0'; - $b + $c <'$* == 0' && $b : false : - $c <'$* -s 1 == 0'; - $b 2>>/~%EOE%d != 0 + $c <'$* -s 1 == 0' && $b 2>>/~%EOE%d != 0 %testscript:1: error: ../../../../driver(.exe)? exit status 1 != 0% EOE } @@ -27,21 +25,18 @@ b += --no-column { : true : - $c <'$* -s 1 != 0'; - $b + $c <'$* -s 1 != 0' && $b : false : - $c <'$* -s 1 != 1'; - $b 2>>/~%EOE% != 0 + $c <'$* -s 1 != 1' && $b 2>>/~%EOE% != 0 %testscript:1: error: ../../../../driver(.exe)? exit status 1 == 1% EOE } : error : -$c <'$* -s 1 -e "Error"'; -$b 2>>/~%EOE% != 0 +$c <'$* -s 1 -e "Error"' && $b 2>>/~%EOE% != 0 %testscript:1: error: ../../../driver(.exe)? exit status 1 != 0% info: stderr: test/1/stderr Error @@ -53,8 +48,7 @@ EOE : Can pop up dialog boxes on Windows or produce coredump on POSIX. Note that : under Wine some extra info is printed to STDOUT. : -$c <'$* -t m'; -$b 2>>/~%EOE% != 0 +$c <'$* -t m' && $b 2>>/~%EOE% != 0 %wine: .+%? %testscript:1: error: ../../../driver(.exe)? terminated abnormally%d % info: .+% -- cgit v1.1