From 28106f96de8ae5cdb3a0ee0e3a8a8185551e3b00 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 20 Jan 2017 20:25:59 +0300 Subject: Add support for comparison of test command output to a file --- tests/test/script/builtin/cat.test | 2 +- tests/test/script/builtin/touch.test | 2 +- tests/test/script/common.test | 6 ++-- tests/test/script/runner/cleanup.test | 6 ++-- tests/test/script/runner/redirect.test | 50 ++++++++++++++++++++++++---------- 5 files changed, 44 insertions(+), 22 deletions(-) (limited to 'tests/test/script') 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 <>>out; +cat <=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 <>>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 <>>&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 <>>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 <>>out; + $* -o foo >=out; $* -i 1 <<foo EOI $b - : append + : out : - $c <>>out; - $* -e bar 2>>>&out; - $* -i 1 <<>EOO - foo - bar - EOO - EOI - $b + { + : match + : + $c <=out; + $* -e bar 2>+out; + $* -i 1 <>>out + foo + bar + EOF + EOI + $b + + : mismatch + : + $c <=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 <&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 <<>EOO foo bar -- cgit v1.1