diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dependency/chain/testscript | 2 | ||||
-rw-r--r-- | tests/dependency/recipe/buildfile | 4 | ||||
-rw-r--r-- | tests/dependency/recipe/testscript | 344 | ||||
-rw-r--r-- | tests/test/script/builtin/mv.testscript | 8 | ||||
-rw-r--r-- | tests/test/script/builtin/rm.testscript | 6 | ||||
-rw-r--r-- | tests/test/script/builtin/rmdir.testscript | 6 | ||||
-rw-r--r-- | tests/test/script/runner/cleanup.testscript | 12 | ||||
-rw-r--r-- | tests/test/script/runner/redirect.testscript | 195 |
8 files changed, 538 insertions, 39 deletions
diff --git a/tests/dependency/chain/testscript b/tests/dependency/chain/testscript index 9232840..ac4a946 100644 --- a/tests/dependency/chain/testscript +++ b/tests/dependency/chain/testscript @@ -3,7 +3,7 @@ .include ../../common.testscript -: basic +: basics : $* <<EOI 2>>/~%EOE% ./: dir{x}: dir{a} diff --git a/tests/dependency/recipe/buildfile b/tests/dependency/recipe/buildfile new file mode 100644 index 0000000..3dc5452 --- /dev/null +++ b/tests/dependency/recipe/buildfile @@ -0,0 +1,4 @@ +# file : tests/dependency/recipe/buildfile +# license : MIT; see accompanying LICENSE file + +./: testscript $b diff --git a/tests/dependency/recipe/testscript b/tests/dependency/recipe/testscript new file mode 100644 index 0000000..5510e3c --- /dev/null +++ b/tests/dependency/recipe/testscript @@ -0,0 +1,344 @@ +# file : tests/dependency/recipe/testscript +# license : MIT; see accompanying LICENSE file + +.include ../../common.testscript + +# Note: in the parser we have to handle recipes for the with/without +# prerequisites cases separately. So we try to cover both here. + +: basics +: +$* <<EOI 2>>/~%EOE% +alias{x}: alias{z} +{{ + cmd +}} +dump alias{x} +EOI +<stdin>:5:1: dump: +% .+/alias\{x\}: .+/:alias\{z\}% + {{ + cmd + }} +EOE + +: basics-replay +: +$* <<EOI 2>>/~%EOE% +alias{x y}: alias{z} +{{ + cmd +}} +dump alias{y} +EOI +<stdin>:5:1: dump: +% .+/alias\{y\}: .+/:alias\{z\}% + {{ + cmd + }} +EOE + +: basics-header +: +$* <<EOI 2>>/~%EOE% +alias{x}: +% +{{ + cmd +}} +dump alias{x} +EOI +<stdin>:6:1: dump: +% .+/alias\{x\}:% + {{ + cmd + }} +EOE + +: basics-header-replay +: +$* <<EOI 2>>/~%EOE% +alias{x y}: +% +{{ + cmd +}} +dump alias{y} +EOI +<stdin>:6:1: dump: +% .+/alias\{y\}:% + {{ + cmd + }} +EOE + +: basics-lang +: +$* <<EOI 2>>/~%EOE% +alias{x}: +{{ c++ + void f (); +}} +dump alias{x} +EOI +<stdin>:5:1: dump: +% .+/alias\{x\}:% + {{ c++ + void f (); + }} +EOE + +: with-vars +: +$* <<EOI 2>>/~%EOE% +alias{x}: +{ + var = x +} +{{ + cmd +}} +dump alias{x} +EOI +<stdin>:8:1: dump: +% .+/alias\{x\}:% + { + var = x + } + {{ + cmd + }} +EOE + +: with-vars-replay +: +$* <<EOI 2>>/~%EOE% +alias{x y}: alias{z} +{ + var = x +} +{{ + cmd +}} +dump alias{y} +EOI +<stdin>:8:1: dump: +% .+/alias\{y\}: .+/:alias\{z\}% + { + var = x + } + {{ + cmd + }} +EOE + +: with-vars-header +: +$* <<EOI 2>>/~%EOE% +alias{x}: alias{z} +{ + var = x +} +% +{{ + cmd +}} +dump alias{x} +EOI +<stdin>:9:1: dump: +% .+/alias\{x\}: .+/:alias\{z\}% + { + var = x + } + {{ + cmd + }} +EOE + +: with-vars-header-replay +: +$* <<EOI 2>>/~%EOE% +alias{x y}: +{ + var = x +} +% +{{ + cmd +}} +dump alias{y} +EOI +<stdin>:9:1: dump: +% .+/alias\{y\}:% + { + var = x + } + {{ + cmd + }} +EOE + +: chain +: +$* <<EOI 2>>/~%EOE% +alias{x}: +{{ + cmd1 +}} +{{{ + cmd2 +}}} +dump alias{x} +EOI +<stdin>:8:1: dump: +% .+/alias\{x\}:% + {{ + cmd1 + }} + {{{ + cmd2 + }}} +EOE + +: chain-replay +: +$* <<EOI 2>>/~%EOE% +alias{x y}: alias{z} +{{ + cmd1 +}} +{{{ + cmd2 +}}} +dump alias{y} +EOI +<stdin>:8:1: dump: +% .+/alias\{y\}: .+/:alias\{z\}% + {{ + cmd1 + }} + {{{ + cmd2 + }}} +EOE + +: chain-header +: +$* <<EOI 2>>/~%EOE% +alias{x}: alias{z} + +{{ + cmd1 +}} + +% +{{{ + cmd2 +}}} +dump alias{x} +EOI +<stdin>:11:1: dump: +% .+/alias\{x\}: .+/:alias\{z\}% + {{ + cmd1 + }} + {{{ + cmd2 + }}} +EOE + +: chain-header-replay +: +$* <<EOI 2>>/~%EOE% +alias{x y}: + +{{ + cmd1 +}} + +% +{{{ + cmd2 +}}} +dump alias{y} +EOI +<stdin>:11:1: dump: +% .+/alias\{y\}:% + {{ + cmd1 + }} + {{{ + cmd2 + }}} +EOE + +: unterminated +: +$* <<EOI 2>>EOE != 0 +alias{x}: +{{{ + cmd +}} +EOI +<stdin>:5:1: error: unterminated recipe block + <stdin>:2:1: info: recipe block starts here +EOE + +: expected-lang +: +$* <<EOI 2>>EOE != 0 +alias{x}: +{{ $lang + cmd +}} +EOI +<stdin>:2:4: error: expected recipe language instead of '$' +EOE + +: header-attribute +: +$* <<EOI 2>>/~!EOE! +alias{x}: +% [diag=gen] +{{ + cmd +}} +dump alias{x} +EOI +<stdin>:6:1: dump: +! .+/alias\{x\}:! + % [diag=gen] + {{ + cmd + }} +EOE + +: header-attribute-replay +: +$* <<EOI 2>>/~!EOE! +alias{x y}: +% [diag=gen] +{{ + cmd +}} +dump alias{y} +EOI +<stdin>:6:1: dump: +! .+/alias\{y\}:! + % [diag=gen] + {{ + cmd + }} +EOE + +: header-missing-block +: +$* <<EOI 2>>EOE != 0 +alias{x}: +% +{ + cmd +} +EOI +<stdin>:3:1: error: expected recipe block instead of '{' +EOE diff --git a/tests/test/script/builtin/mv.testscript b/tests/test/script/builtin/mv.testscript index 31e2603..764c1e0 100644 --- a/tests/test/script/builtin/mv.testscript +++ b/tests/test/script/builtin/mv.testscript @@ -21,8 +21,8 @@ : Moving path outside the testscript working directory fails. : $c <<EOI && $b - mv ../../a/b/c ./c 2>>/~%EOE% == 1 - %mv: '.+/fail/a/b/c' is out of working directory '.+/fail/test'% + mv ../../a/b/c ./c 2>>/EOE == 1 + mv: 'a/b/c' is out of working directory 'test/' EOE EOI @@ -84,14 +84,14 @@ : src : $c <<EOI && $b - mv $~ b 2>"mv: '$~' contains test working directory '$~'" != 0 + mv $~ b 2>/"mv: 'test/1/' contains test working directory 'test/1/'" != 0 EOI : dst : $c <<EOI && $b mkdir a; - mv a "$~" 2>"mv: '$~' contains test working directory '$~'" != 0 + mv a "$~" 2>/"mv: 'test/1' contains test working directory 'test/1/'" != 0 EOI } diff --git a/tests/test/script/builtin/rm.testscript b/tests/test/script/builtin/rm.testscript index 5b00042..21ec2a9 100644 --- a/tests/test/script/builtin/rm.testscript +++ b/tests/test/script/builtin/rm.testscript @@ -11,7 +11,7 @@ : Removing scope directory fails. : $c <<EOI && $b - rm -r ./ 2>"rm: '$~' contains test working directory '$~'" == 1 + rm -r ./ 2>/"rm: 'test/1/' contains test working directory 'test/1/'" == 1 EOI } @@ -28,8 +28,8 @@ : Removing path outside the testscript working directory fails. : $c <<EOI && $b - rm ../../a/b/c 2>>/~%EOE% == 1 - %rm: '.+/path/outside-scope/fail/a/b/c' is out of working directory '.+/path/outside-scope/fail/test'% + rm ../../a/b/c 2>>/EOE == 1 + rm: 'a/b/c' is out of working directory 'test/' EOE EOI diff --git a/tests/test/script/builtin/rmdir.testscript b/tests/test/script/builtin/rmdir.testscript index 269dd58..a63a5dd 100644 --- a/tests/test/script/builtin/rmdir.testscript +++ b/tests/test/script/builtin/rmdir.testscript @@ -11,7 +11,7 @@ : Removing scope directory fails. : $c <<EOI && $b - rmdir ./ 2>"rmdir: '$~' contains test working directory '$~'" == 1 + rmdir ./ 2>/"rmdir: 'test/1/' contains test working directory 'test/1/'" == 1 EOI : outside-scope @@ -24,8 +24,8 @@ : Removing directory outside the testscript working directory fails. : $c <<EOI && $b - rmdir ../../a/b/c 2>>/~%EOE% == 1 - %rmdir: '.+/dir/outside-scope/fail/a/b/c/' is out of working directory '.+/dir/outside-scope/fail/test'% + rmdir ../../a/b/c 2>>/EOE == 1 + rmdir: 'a/b/c/' is out of working directory 'test/' EOE EOI diff --git a/tests/test/script/runner/cleanup.testscript b/tests/test/script/runner/cleanup.testscript index e39ae95..03153e4 100644 --- a/tests/test/script/runner/cleanup.testscript +++ b/tests/test/script/runner/cleanup.testscript @@ -56,7 +56,7 @@ b += --no-column : Test explicit cleanup of a file out of the testscript working directory. : $c <'$* &../../a' && $b 2>>/EOE != 0 - testscript:1: error: file cleanup ../../a is out of working directory test/ + testscript:1: error: file cleanup ../../a is out of working directory 'test/' info: test id: 1 EOE @@ -116,7 +116,7 @@ b += --no-column : Test cleanup of a directory out of the testscript working directory. : $c <'$* &../../a/' && $b 2>>/EOE != 0 - testscript:1: error: directory cleanup ../../a/ is out of working directory test/ + testscript:1: error: directory cleanup ../../a/ is out of working directory 'test/' info: test id: 1 EOE @@ -150,7 +150,7 @@ b += --no-column : dir : $c <'$* -d a/b' && $b 2>>/EOE != 0 - testscript:1: error: registered for cleanup directory test/1/ is not empty + testscript:1: error: test working directory 'test/1/' is not empty a/ info: test id: 1 EOE @@ -220,7 +220,7 @@ b += --no-column : Test cleanup of a wildcard out of the testscript working directory. : $c <'$* &../../a/***' && $b 2>>/EOE != 0 - testscript:1: error: wildcard cleanup ../../a/*** is out of working directory test/ + testscript:1: error: wildcard cleanup ../../a/*** is out of working directory 'test/' info: test id: 1 EOE @@ -346,7 +346,7 @@ EOI : Test an implicit cleanup being overwritten with the explicit one, : $c <'$* -o foo >=a &!a' && $b 2>>/EOE != 0 -testscript:1: error: registered for cleanup directory test/1/ is not empty +testscript:1: error: test working directory 'test/1/' is not empty a info: test id: 1 EOE @@ -359,7 +359,7 @@ $c <<EOO && $b 2>>/EOE != 0 $* &!a; $* -o foo >=a EOO -testscript:2: error: registered for cleanup directory test/1/ is not empty +testscript:2: error: test working directory 'test/1/' is not empty a info: test id: 1 EOE diff --git a/tests/test/script/runner/redirect.testscript b/tests/test/script/runner/redirect.testscript index b8fe74d..0fe3aa3 100644 --- a/tests/test/script/runner/redirect.testscript +++ b/tests/test/script/runner/redirect.testscript @@ -80,10 +80,14 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : literal : { - $c <'$* -i 0 <foo' && $b : in - $c <'$* -o foo >foo' && $b : out - $c <'$* -e foo 2>foo' && $b : err - $c <'$* -i 1 <foo >foo' && $b : inout + $c <'$* -i 0 <<<=foo' && $b : in + $c <'$* -i 0 <foo' && $b : in-alias + $c <'$* -o foo >>>?foo' && $b : out + $c <'$* -o foo >foo' && $b : out-alias + $c <'$* -e foo 2>>>?foo' && $b : err + $c <'$* -e foo 2>foo' && $b : err-alias + $c <'$* -i 1 <<<=foo >>>?foo' && $b : inout + $c <'$* -i 1 <foo >foo' && $b : inout-alias : inout-fail : @@ -101,11 +105,16 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. info: test id: 1 EOE - $c <'$* -i 2 <foo 2>foo' && $b : inerr - $c <'$* -i 1 -e bar <foo 1>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 + $c <'$* -i 2 <<<=foo 2>>>?foo' && $b : inerr + $c <'$* -i 2 <foo 2>foo' && $b : inerr-alias + $c <'$* -i 1 -e bar <<<=foo 1>>>?foo 2>>>?bar' && $b : inout-err + $c <'$* -i 1 -e bar <foo 1>foo 2>bar' && $b : inout-err-alias + $c <'$* -o "" >>>?""' && $b : empty + $c <'$* -o "" >""' && $b : empty-alias + $c <'$* -i 1 <<<=:"foo" >>>?:"foo"' && $b : no-newline + $c <'$* -i 1 <:"foo" >:"foo"' && $b : no-newline-alias + $c <'$* -i 1 <<<=:"" >>>?:""' && $b : no-newline-empty + $c <'$* -i 1 <:"" >:""' && $b : no-newline-empty-alias : no-newline-fail1 : @@ -132,6 +141,15 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : merge : $c <<EOI && $b + $* -o foo -e bar 2>>?EOE 1>&2 + foo + bar + EOE + EOI + + : merge-alias + : + $c <<EOI && $b $* -o foo -e bar 2>>EOE 1>&2 foo bar @@ -155,6 +173,10 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. { : match : + $c <'$* -o foo >>>?~/Foo?/i' && $b + + : match-alias + : $c <'$* -o foo >~/Foo?/i' && $b : mismatch @@ -209,6 +231,15 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : in : $c <<EOI && $b + $* -i 0 <<=EOO + foo + bar + EOO + EOI + + : in-alias + : + $c <<EOI && $b $* -i 0 <<EOO foo bar @@ -218,6 +249,15 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : out : $c <<EOI && $b + $* -o foo -o bar >>?EOO + foo + bar + EOO + EOI + + : out-alias + : + $c <<EOI && $b $* -o foo -o bar >>EOO foo bar @@ -227,6 +267,15 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : err : $c <<EOI && $b + $* -e foo -e bar 2>>?EOO + foo + bar + EOO + EOI + + : err-alias + : + $c <<EOI && $b $* -e foo -e bar 2>>EOO foo bar @@ -236,6 +285,18 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : inout : $c <<EOI && $b + $* -i 1 <<=EOF >>?EOO + foo + bar + EOF + foo + bar + EOO + EOI + + : inout-alias + : + $c <<EOI && $b $* -i 1 <<EOF >>EOO foo bar @@ -248,6 +309,19 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : inerr : $c <<EOI && $b + $* -i 2 <<=EOF 2>>?EOE + foo + bar + EOF + foo + bar + EOE + EOI + + + : inerr-alias + : + $c <<EOI && $b $* -i 2 <<EOF 2>>EOE foo bar @@ -260,6 +334,14 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : empty : $c <<EOI && $b + $* -i 1 <<=EOF >>?EOO + EOF + EOO + EOI + + : empty-alias + : + $c <<EOI && $b $* -i 1 <<EOF >>EOO EOF EOO @@ -268,16 +350,43 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : shared : $c <<EOI && $b + $* -i 1 <<=EOF >>?EOF + foo + bar + EOF + EOI + + : shared-alias + : + $c <<EOI && $b $* -i 1 <<EOF >>EOF foo bar EOF EOI + : shared-in-alias + : + $c <<EOI && $b + $* -i 1 <<EOF >>?EOF + foo + bar + EOF + EOI + + : shared-out-alias + : + $c <<EOI && $b + $* -i 1 <<=EOF >>EOF + foo + bar + EOF + EOI + : extra-newline : $c <<EOI && $b - $* -i 1 <<EOF >>EOO + $* -i 1 <<=EOF >>?EOO EOF @@ -287,7 +396,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : no-newline : $c <<EOI && $b - $* -i 1 <<:EOF >>:EOO + $* -i 1 <<=:EOF >>?:EOO foo EOF foo @@ -297,7 +406,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : no-newline-fail1 : $c <<EOI && $b 2>>~/EOE/ != 0 - $* -i 1 <<:EOF >>EOO + $* -i 1 <<=:EOF >>?EOO foo EOF foo @@ -314,7 +423,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : no-newline-fail2 : $c <<EOI && $b 2>>~/EOE/ != 0 - $* -i 1 <<EOF >>:EOO + $* -i 1 <<=EOF >>?:EOO foo EOF foo @@ -331,7 +440,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : no-newline-empty : $c <<EOI && $b - $* -i 1 <<:EOF >>:EOO + $* -i 1 <<=:EOF >>?:EOO EOF EOO EOI @@ -339,7 +448,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : no-newline-extra-newline : $c <<EOI && $b - $* -i 1 <<:EOF >>:EOO + $* -i 1 <<=:EOF >>?:EOO EOF @@ -349,7 +458,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : merge : $c <<EOI && $b - $* -i 1 <<EOF -e baz >>EOO 2>&1 + $* -i 1 <<=EOF -e baz >>?EOO 2>&1 foo bar EOF @@ -387,6 +496,14 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : in : $c <<"EOI" && $b + \$* -i 1 <<=/EOF >>>?'foo$ps' + foo/ + EOF + EOI + + : in-alias + : + $c <<"EOI" && $b \$* -i 1 <</EOF >'foo$ps' foo/ EOF @@ -395,6 +512,14 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : out : $c <<"EOI" && $b + \$* -i 1 <<<='foo$ps' >>?/EOO + foo/ + EOO + EOI + + : out-alias + : + $c <<"EOI" && $b \$* -i 1 <'foo$ps' >>/EOO foo/ EOO @@ -403,6 +528,14 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : err : $c <<"EOI" && $b + \$* -i 2 <<<='foo$ps' 2>>?/EOE + foo/ + EOE + EOI + + : err-alias + : + $c <<"EOI" && $b \$* -i 2 <'foo$ps' 2>>/EOE foo/ EOE @@ -419,7 +552,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : match : $c <<EOI && $b - $* -o foo -o foo -o bar >>~/EOO/i + $* -o foo -o foo -o bar >>?~/EOO/i /FO*/* bar /* @@ -429,7 +562,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : match-empty : $c <<EOI && $b - $* >>:~/EOO/ + $* >>?:~/EOO/ /.{0} EOO EOI @@ -437,7 +570,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : shared : $c <<EOI && $b - $* -o foo -e foo >>~/EOF/ 2>>~/EOF/ + $* -o foo -e foo >>?~/EOF/ 2>>?~/EOF/ foo EOF EOI @@ -445,7 +578,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : mismatch : $c <<EOI && $b 2>>/~%EOE%d != 0 - $* -o foo >>~/EOO/ + $* -o foo >>?~/EOO/ bar EOO EOI @@ -459,7 +592,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : mismatch-icase : $c <<EOI && $b 2>>/~%EOE%d != 0 - $* -o foo >>~/EOO/i + $* -o foo >>?~/EOO/i bar EOO EOI @@ -479,6 +612,13 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : $c <<EOI && $b $* -o foo >=out; + $* -i 1 <=out >foo + EOI + + : in-alias + : + $c <<EOI && $b + $* -o foo >=out; $* -i 1 <<<out >foo EOI @@ -490,6 +630,17 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. $c <<EOI && $b $* -o foo >=out; $* -e bar 2>+out; + $* -i 1 <<EOF >?out + foo + bar + EOF + EOI + + : match-alias + : + $c <<EOI && $b + $* -o foo >=out; + $* -e bar 2>+out; $* -i 1 <<EOF >>>out foo bar @@ -500,7 +651,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : $c <<EOI && $b 2>>/~%EOE%d != 0 $* -o foo >=out; - $* -o bar >>>out + $* -o bar >?out EOI %testscript:2: error: ../../../../../driver(.exe)? stdout doesn't match expected% info: stdout: test/1/stdout-2 |