aboutsummaryrefslogtreecommitdiff
path: root/tests/test/script/runner
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-12-16 17:29:01 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-12-16 17:29:01 +0200
commit2af491cc4ad0ae4064f2e858c83ed485613adafa (patch)
tree18010b6c7b9ef13072f6e2514fcb1bb60f38d60a /tests/test/script/runner
parent3ab61fbc2ce25afa617ed6bb50c2f8d701beeaba (diff)
Convert tests/ to subproject, initial work on cross-testing support
Diffstat (limited to 'tests/test/script/runner')
-rw-r--r--tests/test/script/runner/buildfile9
-rw-r--r--tests/test/script/runner/cleanup.test65
-rw-r--r--tests/test/script/runner/redirect.test2
-rw-r--r--tests/test/script/runner/status.test10
4 files changed, 46 insertions, 40 deletions
diff --git a/tests/test/script/runner/buildfile b/tests/test/script/runner/buildfile
index e5f2761..375be18 100644
--- a/tests/test/script/runner/buildfile
+++ b/tests/test/script/runner/buildfile
@@ -2,8 +2,11 @@
# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-import libs = libbutl%lib{butl}
+./: test{cleanup status} exe{driver} $b
-exe{driver}: cxx{driver} $libs test{cleanup redirect status}
+# @@ Do test{*} once redirect folds in.
+#
+test{cleanup}@./ test{status}@./: target = exe{driver}
-include ../../../../../build2/
+import libs = libbutl%lib{butl}
+exe{driver}: cxx{driver} $libs test{redirect}
diff --git a/tests/test/script/runner/cleanup.test b/tests/test/script/runner/cleanup.test
index c68304c..f14d02d 100644
--- a/tests/test/script/runner/cleanup.test
+++ b/tests/test/script/runner/cleanup.test
@@ -10,39 +10,39 @@ td = [string] $path.canonicalize(test/)
# Valid cleanups.
#
-# @@ TODO: $c <"$* -f a &a" && $b
+# @@ TODO: $c <'$* -f a &a' && $b
#
: file-always
:
-$c <"$* -f a &a";
+$c <'$* -f a &a';
$b
: file-maybe
:
-$c <"$* &?a";
+$c <'$* &?a';
$b
: file-never
:
-$c <"$* &!a";
+$c <'$* &!a';
$b
: file-implicit
:
: Test that a file created out of the testscript working directory is not
: implicitly registered for cleanup. If it were, the test would fail due to
-: 'rm' failure.
+: rm failure.
:
-$c <"touch ../../a";
+$c <'touch ../../a';
$b;
rm a
: file-append
:
-: Test that file append redirect doesn't not register cleanup. If it did, that
-: cleanup would fail as the file would be already deleted by 'rm'.
+: 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;
touch a &!a;
$* -o foo >>>&a;
rm a
@@ -51,39 +51,39 @@ $b
: dir-always
:
-$c <"$* -d a &a/";
+$c <'$* -d a &a/';
$b
: dir-maybe
:
-$c <"$* &?a/";
+$c <'$* &?a/';
$b
: dir-implicit
:
: Test that a directory created out of the testscript working directory is not
: implicitly registered for cleanup. If it were, the test would fail due to
-: 'rm' failure.
+: rm failure.
:
-$c <"mkdir ../../a";
+$c <'mkdir ../../a';
$b;
rm -r a
: wildcard-always
:
-$c <"$* -d a/b -f a/b/c &a/***";
+$c <'$* -d a/b -f a/b/c &a/***';
$b
: wildcard-maybe
:
-$c <"$* &?a/***";
+$c <'$* &?a/***';
$b
: order
:
: Test that cleanup is performed in registration reversed order.
:
-$c <"$* -d a/b &a/ &a/b/";
+$c <'$* -d a/b &a/ &a/b/';
$b
# Invalid cleanups.
@@ -92,7 +92,7 @@ $b
:
: Test cleanup of non-existing file.
:
-$c <"$* &a";
+$c <'$* &a';
$b 2>>"EOE" != 0
testscript:1: error: registered for cleanup file $path.canonicalize(test/1/a) does not exist
EOE
@@ -101,7 +101,7 @@ EOE
:
: Test explicit cleanup of a file out of the testscript working directory.
:
-$c <"$* &../../a";
+$c <'$* &../../a';
$b 2>>"EOE" != 0
testscript:1: error: file cleanup $path.canonicalize(../../a) is out of working directory $td
EOE
@@ -111,7 +111,7 @@ EOE
: Test cleanup explicit registration of a file being outside the test working
: directory but inside the script working directory.
:
-$c <"$* &../a";
+$c <'$* &../a';
$b 2>>"EOE" != 0
testscript:1: error: registered for cleanup file $path.canonicalize(test/a) does not exist
EOE
@@ -120,14 +120,14 @@ EOE
:
: Test cleanup of a directory as a file.
:
-$c <"$* -d a &a";
+$c <'$* -d a &a';
$b 2>- != 0 # @@ REGEX
: dir-not-exists
:
: Test cleanup of non-existing directory.
:
-$c <"$* &a/";
+$c <'$* &a/';
$b 2>>"EOE" != 0
testscript:1: error: registered for cleanup directory ([string] $path.canonicalize(test/1/a/)) does not exist
EOE
@@ -136,7 +136,7 @@ EOE
:
: Test cleanup of a directory out of the testscript working directory.
:
-$c <"$* &../../a/";
+$c <'$* &../../a/';
$b 2>>"EOE" != 0
testscript:1: error: directory cleanup ([string] $path.canonicalize(../../a/)) is out of working directory $td
EOE
@@ -146,7 +146,7 @@ EOE
: Test cleanup explicit registration of a directory being outside the test
: working directory but inside the testscript working directory.
:
-$c <"$* &../a/";
+$c <'$* &../a/';
$b 2>>"EOE" != 0
testscript:1: error: registered for cleanup directory ([string] $path.canonicalize(test/a/)) does not exist
EOE
@@ -155,7 +155,7 @@ EOE
:
: Test cleanup of a non-empty directory.
:
-$c <"$* -d a -f a/b &a/";
+$c <'$* -d a -f a/b &a/';
$b 2>>"EOE" != 0
testscript:1: error: registered for cleanup directory ([string] $path.canonicalize(test/1/a/)) is not empty
EOE
@@ -164,14 +164,14 @@ EOE
:
: Test cleanup of a file as a directory.
:
-$c <"$* -f a &a/";
+$c <'$* -f a &a/';
$b 2>- != 0 # @@ REGEX
: wildcard-not-exists
:
: Test cleanup of a wildcard not matching any directory.
:
-$c <"$* &a/***";
+$c <'$* &a/***';
$b 2>>"EOE" != 0
testscript:1: error: registered for cleanup wildcard $path.canonicalize(test/1/a/***) doesn't match a directory
EOE
@@ -180,7 +180,7 @@ EOE
:
: Test cleanup of a wildcard out of the testscript working directory.
:
-$c <"$* &../../a/***";
+$c <'$* &../../a/***';
$b 2>>"EOE" != 0
testscript:1: error: wildcard cleanup $path.canonicalize(../../a/***) is out of working directory $td
EOE
@@ -188,9 +188,10 @@ EOE
: wildcard-in-wd
:
: Test cleanup registration of a wildcard matching the directory that being
-: outside the test working directory is inside the testscript working directory.
+: outside the test working directory is inside the testscript working
+: directory.
:
-$c <"$* &../a/***";
+$c <'$* &../a/***';
$b 2>>"EOE" != 0
testscript:1: error: registered for cleanup wildcard $path.canonicalize(test/a/***) doesn't match a directory
EOE
@@ -199,14 +200,14 @@ EOE
:
: Test cleanup of a file as a wildcard.
:
-$c <"$* -f a &a/***";
+$c <'$* -f a &a/***';
$b 2>- != 0 # @@ REGEX
: implicit-overwrite
:
: 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 ([string] $path.canonicalize(test/1/)) is not empty
EOE
@@ -215,7 +216,7 @@ EOE
:
: Test an explicit cleanup not being overwritten with the implicit one.
:
-$c <<"EOO";
+$c <<EOO;
$* &!a;
$* -o foo >>>a
EOO
diff --git a/tests/test/script/runner/redirect.test b/tests/test/script/runner/redirect.test
index 16c17d8..e8d57c1 100644
--- a/tests/test/script/runner/redirect.test
+++ b/tests/test/script/runner/redirect.test
@@ -2,6 +2,8 @@
# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
+# @@ Needs conversion to cat & build (then adjust buildfile).
+
$* -o foo >- : out-null
$* -e foo 2>- : err-null
$* -i 0 <foo : in-str
diff --git a/tests/test/script/runner/status.test b/tests/test/script/runner/status.test
index 941d485..e115f13 100644
--- a/tests/test/script/runner/status.test
+++ b/tests/test/script/runner/status.test
@@ -7,33 +7,33 @@
b += --no-column
if ($cxx.target.class == "windows")
- ext = ".exe"
+ ext = .exe
end
# Successfull tests.
#
: eq-true
:
-$c <"$* == 0";
+$c <'$* == 0';
$b
: ne-true
:
-$c <"$* -s 1 != 0";
+$c <'$* -s 1 != 0';
$b
# Faulty tests.
#
: eq-false
:
-$c <"$* -s 1 == 0";
+$c <'$* -s 1 == 0';
$b 2>>"EOE" != 0
testscript:1: error: $path.canonicalize(../../../driver$ext) exit status 1 != 0
EOE
: ne-false
:
-$c <"$* -s 1 != 1";
+$c <'$* -s 1 != 1';
$b 2>>"EOE" != 0
testscript:1: error: $path.canonicalize(../../../driver$ext) exit status 1 == 1
EOE