aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test/script/builtin/cat.test31
-rw-r--r--tests/test/script/builtin/echo.test18
-rw-r--r--tests/test/script/builtin/mkdir.test24
-rw-r--r--tests/test/script/builtin/rm.test33
-rw-r--r--tests/test/script/builtin/rmdir.test33
-rw-r--r--tests/test/script/builtin/test.test30
-rw-r--r--tests/test/script/builtin/touch.test21
-rw-r--r--tests/test/script/runner/cleanup.test81
-rw-r--r--tests/test/script/runner/redirect.test170
-rw-r--r--tests/test/script/runner/regex.test87
-rw-r--r--tests/test/script/runner/status.test18
11 files changed, 180 insertions, 366 deletions
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 <<EOI;
+$c <<EOI && $b
cat <<EOF >>EOO
foo
bar
@@ -15,11 +15,10 @@ foo
bar
EOO
EOI
-$b
: dash
:
-$c <<EOI;
+$c <<EOI && $b
cat - <<EOF >>EOO
foo
bar
@@ -28,11 +27,10 @@ foo
bar
EOO
EOI
-$b
: file
:
-$c <<EOI;
+$c <<EOI && $b
cat <<EOF >=out;
foo
bar
@@ -42,11 +40,10 @@ foo
bar
EOO
EOI
-$b
: in-repeat
:
-$c <<EOI;
+$c <<EOI && $b
cat - <<EOF >>EOO
foo
bar
@@ -55,25 +52,31 @@ foo
bar
EOO
EOI
-$b
: non-existent
:
-$c <<EOI;
+$c <<EOI && $b
cat in 2>>/~%EOE% != 0
%cat: unable to print '.+/test/cat/non-existent/test/1/in': .+%
EOE
EOI
-$b
: empty-path
:
: Cat an empty path.
:
-$c <<EOI;
+$c <<EOI && $b
cat '' 2>"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 <<EOI;
+$c <<EOI && $b
mkdir a b;
touch a/a b/b
EOI
-$b
: parent
:
-$c <<EOI;
+$c <<EOI && $b
mkdir -p a/b;
touch a/a a/b/b
EOI
-$b
: exists
:
-$c <'mkdir -p a a a/b a/b';
-$b
+$c <'mkdir -p a a a/b a/b' && $b
: double-dash
:
: Make sure '-p' directory is created.
:
-$c <<EOI;
+$c <<EOI && $b
mkdir -p -- -p;
touch -p/a
EOI
-$b
: no-args
:
: Test passing no arguments.
:
-$c <'mkdir 2>"mkdir: missing directory" == 1';
-$b
+$c <'mkdir 2>"mkdir: missing directory" == 1' && $b
: empty-path
:
: Test creation of empty directory path.
:
-$c <<EOI;
+$c <<EOI && $b
mkdir '' 2>"mkdir: invalid path ''" == 1
EOI
-$b
: already-exists
:
: Test creation of an existing directory.
:
-$c <<EOI;
+$c <<EOI && $b
mkdir a a 2>>/~%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 <<EOI;
+$c <<EOI && $b
mkdir a/b 2>>/~%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 <<EOI;
+ $c <<EOI && $b
touch a &!a;
rm a
EOI
- $b
: not-exists
:
@@ -42,19 +39,17 @@
:
: Removing non-existing file fails.
:
- $c <<EOI;
+ $c <<EOI && $b
rm a 2>>/~%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 <<EOI;
+ $c <<EOI && $b
mkdir a;
rm a 2>"rm: '$normalize([path] $~/a)' is a directory" == 1
EOI
- $b
: recursive
:
: Removing directory succeeds with -r option.
:
- $c <<EOI;
+ $c <<EOI && $b
mkdir -p a/b &!a &!a/b;
rm -r a
EOI
- $b
: scope
:
: Removing scope directory fails.
:
- $c <<EOI;
+ $c <<EOI && $b
rm -r ./ 2>"rm: '([string] $~)' contains test working directory '$~'" == 1
EOI
- $b
}
: path
@@ -98,10 +90,9 @@
:
: Removing an empty path fails.
:
- $c <<EOI;
+ $c <<EOI && $b
rm '' 2>"rm: invalid path ''" == 1
EOI
- $b
: outside-scope
:
@@ -112,19 +103,17 @@
:
: Removing path outside the testscript working directory fails.
:
- $c <<EOI;
+ $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'%
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 <<EOI;
+ $c <<EOI && $b
rmdir '' 2>"rmdir: invalid path ''" == 1
EOI
- $b
: test-scope
:
: Removing scope directory fails.
:
- $c <<EOI;
+ $c <<EOI && $b
rmdir ./ 2>"rmdir: '$~' contains test working directory '$~'" == 1
EOI
- $b
: outside-scope
:
@@ -52,31 +48,28 @@
:
: Removing directory outside the testscript working directory fails.
:
- $c <<EOI;
+ $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'%
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 <<EOI;
+ $c <<EOI && $b
mkdir a &!a;
rmdir a
EOI
- $b
: not-exists
:
@@ -84,42 +77,38 @@
: fail
: Removing non-existing directory fails.
:
- $c <<EOI;
+ $c <<EOI && $b
rmdir a 2>>/~%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 <<EOI;
+ $c <<EOI && $b
mkdir -p a/b;
rmdir a 2>>/~%EOE% == 1
%rmdir: unable to remove '.+/dir/not-empty/test/1/a': .+%
EOE
EOI
- $b
: not-dir
:
: Removing not a directory path fails.
:
- $c <<EOI;
+ $c <<EOI && $b
touch a;
rmdir a 2>>/~%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 <<EOI;
+ $c <<EOI && $b
touch a;
test -f a
EOI
- $b
: not-exists
:
- $c <'test -f a == 1';
- $b
+ $c <'test -f a == 1' && $b
: not-file
:
- $c <'test -f . == 1';
- $b
+ $c <'test -f . == 1' && $b
}
: dir
@@ -31,49 +28,42 @@
{
: exists
:
- $c <'test -d .';
- $b
+ $c <'test -d .' && $b
: not-exists
:
- $c <'test -d a == 1';
- $b
+ $c <'test -d a == 1' && $b
: not-dir
:
- $c <<EOI;
+ $c <<EOI && $b
touch a;
test -d a == 1
EOI
- $b
}
: no-args
:
: Test passing no arguments.
:
-$c <'test 2>"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 <<EOI;
+$c <<EOI && $b
test -d '' 2>"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 <<EOI;
+$c <<EOI && $b
touch a &!a;
rm a
EOI
-$b
: file-update
:
: Test that existing file touch doesn't fail.
:
-$c <<EOI;
+$c <<EOI && $b
cat <"" >=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 <<EOI;
+$c <<EOI && $b
{
+touch a
{
@@ -43,32 +40,28 @@ $c <<EOI;
}
}
EOI
-$b
: no-args
:
: Test passing no arguments.
:
-$c <'touch 2>"touch: missing file" == 1';
-$b
+$c <'touch 2>"touch: missing file" == 1' && $b
: empty-path
:
: Test touching an empty path.
:
-$c <<EOI;
+$c <<EOI && $b
touch '' 2>"touch: invalid path ''" == 1
EOI
-$b
: dir-update
:
: Test touching an existing directory.
:
-$c <<EOI;
+$c <<EOI && $b
a = $~;
a += "a";
mkdir a;
touch a 2>"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 <<EOI;
+ $c <<EOI && $b
touch ../../a;
rm -f ../../a
EOI
- $b
: append
:
: Test that file append redirect does not not register cleanup. If it did,
: that cleanup would fail as the file would be already deleted by rm.
:
- $c <<EOI;
+ $c <<EOI && $b
touch a &!a;
$* -o foo >+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 <<EOI;
+ $c <<EOI && $b
mkdir ../../a;
rm -r -f ../../a
EOI
- $b
: not-exists
:
: Test cleanup of non-existing directory.
:
- $c <'$* &a/';
- $b 2>>/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 <<EOO;
+$c <<EOO && $b 2>>/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 <<EOI >=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
-
- : out
- :
- $c <'$* -o foo >foo';
- $b
-
- : err
- :
- $c <'$* -e foo 2>foo';
- $b
-
- : inout
- :
- $c <'$* -i 1 <foo >foo';
- $b
+ $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
: inout-fail
:
@@ -75,30 +53,11 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
+foo
EOE
- : inerr
- :
- $c <'$* -i 2 <foo 2>foo';
- $b
-
- : inout-err
- :
- $c <'$* -i 1 -e bar <foo 1>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 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
: no-newline-fail1
:
@@ -124,31 +83,19 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
: merge
:
- $c <<EOI;
+ $c <<EOI && $b
$* -o foo -e bar 2>>EOE 1>&2
foo
bar
EOE
EOI
- $b
: portable-path
:
{
- : in
- :
- $c <"\$* -i 1 </'foo/' >'foo$ps'";
- $b
-
- : out
- :
- $c <"\$* -i 1 <'foo$ps' >/'foo/'";
- $b
-
- : err
- :
- $c <"\$* -i 2 <'foo$ps' 2>/'foo/'";
- $b
+ $c <"\$* -i 1 </'foo/' >'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 <<EOI;
+ $c <<EOI && $b
$* -i 0 <<EOO
foo
bar
EOO
EOI
- $b
: out
:
- $c <<EOI;
+ $c <<EOI && $b
$* -o foo -o bar >>EOO
foo
bar
EOO
EOI
- $b
: err
:
- $c <<EOI;
+ $c <<EOI && $b
$* -e foo -e bar 2>>EOO
foo
bar
EOO
EOI
- $b
: inout
:
- $c <<EOI;
+ $c <<EOI && $b
$* -i 1 <<EOF >>EOO
foo
bar
@@ -250,11 +194,10 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
bar
EOO
EOI
- $b
: inerr
:
- $c <<EOI;
+ $c <<EOI && $b
$* -i 2 <<EOF 2>>EOE
foo
bar
@@ -263,59 +206,53 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
bar
EOE
EOI
- $b
: empty
:
- $c <<EOI;
+ $c <<EOI && $b
$* -i 1 <<EOF >>EOO
EOF
EOO
EOI
- $b
: shared
:
- $c <<EOI;
+ $c <<EOI && $b
$* -i 1 <<EOF >>EOF
foo
bar
EOF
EOI
- $b
: extra-newline
:
- $c <<EOI;
+ $c <<EOI && $b
$* -i 1 <<EOF >>EOO
EOF
EOO
EOI
- $b
: no-newline
:
- $c <<EOI;
+ $c <<EOI && $b
$* -i 1 <<:EOF >>:EOO
foo
EOF
foo
EOO
EOI
- $b
: no-newline-fail1
:
- $c <<EOI;
+ $c <<EOI && $b 2>>~/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 <<EOI;
+ $c <<EOI && $b 2>>~/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
@@ -342,27 +278,25 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
: no-newline-empty
:
- $c <<EOI;
+ $c <<EOI && $b
$* -i 1 <<:EOF >>:EOO
EOF
EOO
EOI
- $b
: no-newline-extra-newline
:
- $c <<EOI;
+ $c <<EOI && $b
$* -i 1 <<:EOF >>:EOO
EOF
EOO
EOI
- $b
: merge
:
- $c <<EOI;
+ $c <<EOI && $b
$* -i 1 <<EOF -e baz >>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 <<EOI;
- 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 <<EOI && $b 2>>/~%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 <</EOF >'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 <<EOI;
+ $c <<EOI && $b
$* -o foo -o foo -o bar >>~/EOO/i
/FO*/*
bar
/*
EOO
EOI
- $b
: match-empty
:
- $c <<EOI;
+ $c <<EOI && $b
$* >>:~/EOO/
/.{0}
EOO
EOI
- $b
: shared
:
- $c <<EOI;
+ $c <<EOI && $b
$* -o foo -e foo >>~/EOF/ 2>>~/EOF/
foo
EOF
EOI
- $b
: mismatch
:
- $c <<EOI;
+ $c <<EOI && $b 2>>/~%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 <<EOI;
+ $c <<EOI && $b 2>>/~%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 <<EOI;
+ $c <<EOI && $b
$* -o foo >=out;
$* -i 1 <<<out >foo
EOI
- $b
: out
:
{
: match
:
- $c <<EOI;
+ $c <<EOI && $b
$* -o foo >=out;
$* -e bar 2>+out;
$* -i 1 <<EOF >>>out
@@ -515,15 +438,13 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
bar
EOF
EOI
- $b
: mismatch
:
- $c <<EOI;
+ $c <<EOI && $b 2>>/~%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 <<EOI;
+ $c <<EOI && $b
$* -o foo -e bar 2>&1 >=out;
$* -e baz -o biz 1>&2 2>+out;
$* -i 1 <<<out >>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 <foo >~/fo./';
- $b
-
- : err
- :
- $c <'cat <foo 1>&2 2>~/fo./';
- $b
-
- : no-newline
- :
- $c <'cat <:foo >:~/fo./';
- $b
+ $c <'cat <foo >~/fo./' && $b : out
+ $c <'cat <foo 1>&2 2>~/fo./' && $b : err
+ $c <'cat <:foo >:~/fo./' && $b : no-newline
: malformed
:
@@ -55,34 +44,31 @@
{
: out
:
- $c <<EOI;
+ $c <<EOI && $b
cat <foo >>~/EOO/
/foo/
EOO
EOI
- $b
: err
:
- $c <<EOI;
+ $c <<EOI && $b
cat <foo 1>&2 2>>~/EOO/
/fo./
EOO
EOI
- $b
: no-newline
:
- $c <<EOI;
+ $c <<EOI && $b
cat <:foo >>:~/EOO/
/fo./
EOO
EOI
- $b
: line-char
:
- $c <<EOI;
+ $c <<EOI && $b
cat <<EOF >>~/EOO/
foo
bar
@@ -107,11 +93,10 @@
//{2}
EOO
EOI
- $b
: expansion
:
- $c <<EOI;
+ $c <<EOI && $b
s="O*/i
bar
";
@@ -125,41 +110,37 @@
baz
EOO
EOI
- $b
: invalid-syntax-char
:
- $c <<EOI;
+ $c <<EOI && $b 2>>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 <<EOI;
+ $c <<EOI && $b 2>>~/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 <<EOI;
+ $c <<EOI && $b 2>>/~%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 >~/foo/i';
- $b
+ $c <'cat <Foo >~/foo/i' && $b
: d
:
@@ -185,15 +165,13 @@
: Escaped dot becomes syntax dot and matches any character ('i' in our
: case).
:
- $c <'cat <fio >~/f\\.o/d';
- $b
+ $c <'cat <fio >~/f\\.o/d' && $b
: syntax-dot
:
: Syntax dot becomes escaped dot and matches only '.' and so we fail.
:
- $c <'cat <fio >~/f.o/d';
- $b 2>>~/EOE/ != 0
+ $c <'cat <fio >~/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 <<EOI;
+ $c <<EOI && $b
cat <Foo >>~/EOO/
/foo/i
EOO
EOI
- $b
: d
:
@@ -219,21 +196,19 @@
{
: escaped-dot
:
- $c <<EOI;
+ $c <<EOI && $b
cat <fio >>~/EOO/
/f\.o/d
EOO
EOI
- $b
: syntax-dot
:
- $c <<EOI;
+ $c <<EOI && $b 2>>~/EOE/ != 0
cat <fio >>~/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 <<EOI;
+ $c <<EOI && $b
cat <Foo >>~/EOO/i
/foo/
EOO
EOI
- $b
: d
:
{
: escaped-dot
:
- $c <<EOI;
+ $c <<EOI && $b
cat <fio >>~/EOO/d
/f\.o/
EOO
EOI
- $b
: syntax-dot
:
- $c <<EOI;
+ $c <<EOI && $b 2>>~/EOE/ != 0
cat <fio >>~/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: .+%