diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-20 20:25:59 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-24 14:53:00 +0300 |
commit | 28106f96de8ae5cdb3a0ee0e3a8a8185551e3b00 (patch) | |
tree | 8b912a7c9a2bd2ba1263695428d8343d022953a5 /tests | |
parent | eeed734583c2f553e71ae0bd78a4b6e7e4d9cc2b (diff) |
Add support for comparison of test command output to a file
Diffstat (limited to 'tests')
-rw-r--r-- | tests/common.test | 2 | ||||
-rw-r--r-- | tests/search/dir/testscript | 4 | ||||
-rw-r--r-- | tests/test/common.test | 2 | ||||
-rw-r--r-- | tests/test/config-test/testscript | 36 | ||||
-rw-r--r-- | tests/test/script-integration/testscript | 2 | ||||
-rw-r--r-- | tests/test/script/builtin/cat.test | 2 | ||||
-rw-r--r-- | tests/test/script/builtin/touch.test | 2 | ||||
-rw-r--r-- | tests/test/script/common.test | 6 | ||||
-rw-r--r-- | tests/test/script/runner/cleanup.test | 6 | ||||
-rw-r--r-- | tests/test/script/runner/redirect.test | 50 |
10 files changed, 67 insertions, 45 deletions
diff --git a/tests/common.test b/tests/common.test index d495da0..250948e 100644 --- a/tests/common.test +++ b/tests/common.test @@ -6,7 +6,7 @@ # +mkdir build -+cat <<EOI >>>build/bootstrap.build ++cat <<EOI >=build/bootstrap.build project = test amalgamation = EOI diff --git a/tests/search/dir/testscript b/tests/search/dir/testscript index 4c427b2..49c964e 100644 --- a/tests/search/dir/testscript +++ b/tests/search/dir/testscript @@ -11,11 +11,11 @@ test.arguments = 'update(../)' # baz/ has invalid buildfile # +mkdir foo bar baz -+cat <<EOI >>>bar/buildfile ++cat <<EOI >=bar/buildfile print bar ./: EOI -+cat <'assert false' >>>baz/buildfile ++cat <'assert false' >=baz/buildfile : no-buildfile : diff --git a/tests/test/common.test b/tests/test/common.test index 0f63bd3..7e3aa67 100644 --- a/tests/test/common.test +++ b/tests/test/common.test @@ -7,7 +7,7 @@ # +mkdir build -+cat <<EOI >>>build/bootstrap.build ++cat <<EOI >=build/bootstrap.build project = test amalgamation = diff --git a/tests/test/config-test/testscript b/tests/test/config-test/testscript index be342ef..0851da7 100644 --- a/tests/test/config-test/testscript +++ b/tests/test/config-test/testscript @@ -12,14 +12,14 @@ test.cleanups = &!./ #@@ TMP +mkdir proj +mkdir proj/build -+cat <<EOI >>>proj/build/bootstrap.build ++cat <<EOI >=proj/build/bootstrap.build project = proj amalgamation = using test EOI -+cat <<EOI >>>proj/buildfile ++cat <<EOI >=proj/buildfile d = tests/ units/ ./: $d include $d @@ -29,13 +29,13 @@ EOI # +mkdir proj/tests +mkdir proj/tests/build -+cat <<EOI >>>proj/tests/build/bootstrap.build ++cat <<EOI >=proj/tests/build/bootstrap.build project = using test EOI -+cat <<EOI >>>proj/tests/buildfile ++cat <<EOI >=proj/tests/buildfile d = script/ ./: $d include $d @@ -44,17 +44,17 @@ EOI # tests/script - scripted test # +mkdir proj/tests/script -+cat <<EOI >>>proj/tests/script/buildfile ++cat <<EOI >=proj/tests/script/buildfile ./: test{basics.test} EOI -+cat <<EOI >>>proj/tests/script/basics.test -echo 'tests/script/basics/foo' >+ : foo -echo 'tests/script/basics/bar' >+ : bar ++cat <<EOI >=proj/tests/script/basics.test +echo 'tests/script/basics/foo' >| : foo +echo 'tests/script/basics/bar' >| : bar : baz { - echo 'tests/script/basics/baz/foo' >+ : foo - echo 'tests/script/basics/baz/bar' >+ : bar + echo 'tests/script/basics/baz/foo' >| : foo + echo 'tests/script/basics/baz/bar' >| : bar } EOI @@ -64,13 +64,13 @@ EOI # This one is "dual": test and sub-test alias. # -+cat <<EOI >>>proj/units/buildfile ++cat <<EOI >=proj/units/buildfile d = simple/ script/ ./: $d test{testscript} include $d EOI -+cat <<EOI >>>proj/units/testscript -echo 'units' >+ ++cat <<EOI >=proj/units/testscript +echo 'units' >| EOI # units/simple - simple (non-scripted) test @@ -81,7 +81,7 @@ EOI # +mkdir proj/units/simple +touch proj/units/simple/driver -+cat <<EOI >>>proj/units/simple/buildfile ++cat <<EOI >=proj/units/simple/buildfile driver = $src_root/../../exe{driver} #@@ TMP file{driver}@./: $driver ./: file{driver} $driver @@ -92,12 +92,12 @@ EOI # units/script - scripted test # +mkdir proj/units/script -+cat <<EOI >>>proj/units/script/buildfile ++cat <<EOI >=proj/units/script/buildfile ./: test{testscript} EOI -+cat <<EOI >>>proj/units/script/testscript -echo 'units/script/foo' >+ : foo -echo 'units/script/bar' >+ : bar ++cat <<EOI >=proj/units/script/testscript +echo 'units/script/foo' >| : foo +echo 'units/script/bar' >| : bar EOI # Now the tests. Should all be top-level, no groups (or set test.arguments). diff --git a/tests/test/script-integration/testscript b/tests/test/script-integration/testscript index f102f5b..faade22 100644 --- a/tests/test/script-integration/testscript +++ b/tests/test/script-integration/testscript @@ -74,7 +74,7 @@ EOE : scope. Also note that we still have to remove everything after detecting the : failure. : -cat <<EOI >>>foo.test; +cat <<EOI >=foo.test; touch ../../dummy EOI $* <<EOI 2>>/EOE &test/*** != 0 diff --git a/tests/test/script/builtin/cat.test b/tests/test/script/builtin/cat.test index f5041fc..442ef00 100644 --- a/tests/test/script/builtin/cat.test +++ b/tests/test/script/builtin/cat.test @@ -33,7 +33,7 @@ $b : file : $c <<EOI; -cat <<EOF >>>out; +cat <<EOF >=out; foo bar EOF diff --git a/tests/test/script/builtin/touch.test b/tests/test/script/builtin/touch.test index a80a05c..b3a043e 100644 --- a/tests/test/script/builtin/touch.test +++ b/tests/test/script/builtin/touch.test @@ -24,7 +24,7 @@ $b : Test that existing file touch doesn't fail. : $c <<EOI; -cat <"" >>>a; +cat <"" >=a; touch a EOI $b diff --git a/tests/test/script/common.test b/tests/test/script/common.test index 177fa75..781be30 100644 --- a/tests/test/script/common.test +++ b/tests/test/script/common.test @@ -7,7 +7,7 @@ # +mkdir build -+cat <<"EOI" >>>build/bootstrap.build ++cat <<"EOI" >=build/bootstrap.build project = test amalgamation = @@ -18,7 +18,7 @@ EOI # levels up from our working directory. # +if! $empty($target) - cat <<"EOI" >>>build/root.build + cat <<"EOI" >=build/root.build target = \$src_root/../../$string([name] $target) test{*}: test = \$target EOI @@ -31,6 +31,6 @@ end # Note that the buildfile is clever hack that relies on the first target # automatically becoming dir{./}'s prerequisite. # -c = cat >>>testscript +c = cat >=testscript b = $0 --jobs 1 --quiet --buildfile - test <"'test{testscript}: \$target'" \ &?test/*** diff --git a/tests/test/script/runner/cleanup.test b/tests/test/script/runner/cleanup.test index ed724ee..1c3ccae 100644 --- a/tests/test/script/runner/cleanup.test +++ b/tests/test/script/runner/cleanup.test @@ -46,7 +46,7 @@ b += --no-column : $c <<EOI; touch a &!a; - $* -o foo >>>&a; + $* -o foo >+a; rm a EOI $b @@ -224,7 +224,7 @@ $b : : Test an implicit cleanup being overwritten with the explicit one, : -$c <'$* -o foo >>>a &!a'; +$c <'$* -o foo >=a &!a'; $b 2>>/EOE != 0 testscript:1: error: registered for cleanup directory test/1/ is not empty EOE @@ -235,7 +235,7 @@ EOE : $c <<EOO; $* &!a; -$* -o foo >>>a +$* -o foo >=a EOO $b 2>>/EOE != 0 testscript:2: error: registered for cleanup directory test/1/ is not empty diff --git a/tests/test/script/runner/redirect.test b/tests/test/script/runner/redirect.test index e2d765c..f32492a 100644 --- a/tests/test/script/runner/redirect.test +++ b/tests/test/script/runner/redirect.test @@ -465,31 +465,53 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. : file : { - : in-out + : in : $c <<EOI; - $* -o foo >>>out; + $* -o foo >=out; $* -i 1 <<<out >foo EOI $b - : append + : out : - $c <<EOI; - $* -o foo >>>out; - $* -e bar 2>>>&out; - $* -i 1 <<<out >>EOO - foo - bar - EOO - EOI - $b + { + : match + : + $c <<EOI; + $* -o foo >=out; + $* -e bar 2>+out; + $* -i 1 <<EOF >>>out + foo + bar + EOF + EOI + $b + + : mismatch + : + $c <<EOI; + $* -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 + info: stdout diff: test/1/stdout-2.diff + %--- \.*% + %\+\+\+ \.*% + %@@ \.*% + -foo + +bar + EOE + } : merge : $c <<EOI; - $* -o foo -e bar 2>&1 >>>out; - $* -e baz -o biz 1>&2 2>>>&out; + $* -o foo -e bar 2>&1 >=out; + $* -e baz -o biz 1>&2 2>+out; $* -i 1 <<<out >>EOO foo bar |