aboutsummaryrefslogtreecommitdiff
path: root/tests/test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test')
-rw-r--r--tests/test/script/runner/test-runner.testscript31
-rw-r--r--tests/test/simple/generated/testscript27
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/test/script/runner/test-runner.testscript b/tests/test/script/runner/test-runner.testscript
new file mode 100644
index 0000000..772fa1b
--- /dev/null
+++ b/tests/test/script/runner/test-runner.testscript
@@ -0,0 +1,31 @@
+# file : tests/test/script/runner/test-runner.testscript
+# license : MIT; see accompanying LICENSE file
+
+.include ../common.testscript
+
++if ($cxx.target.class == 'windows')
+ exit
+end
+
++cat <<EOI >=run
+ #!/bin/sh
+ if test "$1" = "--trace"; then
+ shift
+ echo "$*"
+ fi
+ "$@"
+ EOI
+
++chmod u+x run
+
+run=$~/run
+
+: basic
+:
+$c <<"EOI" && $b "config.test.runner=$run --trace"
+ cat <'text' >'text'; # Non-test program.
+ \$* -o 'text' >>~%EOO% # Test program.
+ %.+/driver -o text%
+ text
+ EOO
+ EOI
diff --git a/tests/test/simple/generated/testscript b/tests/test/simple/generated/testscript
index f6a89d8..9ce40ba 100644
--- a/tests/test/simple/generated/testscript
+++ b/tests/test/simple/generated/testscript
@@ -99,3 +99,30 @@ EOI
EOE
}
}
+
+: runner
+:
+if ($cxx.target.class != 'windows')
+{
+ cat <<EOI >=run;
+ #!/bin/sh
+ if test "$1" = "--trace"; then
+ shift
+ echo "tracing"
+ fi
+ "$@"
+ EOI
+
+ chmod u+x run;
+
+ echo 'tracing' >=output.in;
+ cat $src_base/output.in >+output.in;
+
+ $* config.test.runner="./run --trace" <<EOI
+ driver = $src_root/../exe{driver}
+ ./: test = $driver
+ ./: $driver
+ ./: file{output}: test.stdout = true
+ file{output}: in{output} $src_root/manifest #@@ in module
+ EOI
+}