aboutsummaryrefslogtreecommitdiff
path: root/tests/test/script/common.testscript
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-09-03 16:37:32 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2018-09-04 16:29:59 +0300
commit5007870b52aa549971824959a55ad3bb886f09e0 (patch)
treeb0ef7f24c0b9ece2ed23f3c1792f16da324e4171 /tests/test/script/common.testscript
parent09d60452a80d14d9b8bf3a9395860b50683fa1e8 (diff)
Rename .test/test{} to .testscript/testscript{}
Diffstat (limited to 'tests/test/script/common.testscript')
-rw-r--r--tests/test/script/common.testscript37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test/script/common.testscript b/tests/test/script/common.testscript
new file mode 100644
index 0000000..b509818
--- /dev/null
+++ b/tests/test/script/common.testscript
@@ -0,0 +1,37 @@
+# file : tests/test/script/common.testscript
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Commonly-used build system test project setup and driver command line
+# (test module using testscript tests).
+#
+
++mkdir build
++cat <<"EOI" >=build/bootstrap.build
+project = test
+amalgamation =
+
+using test
+EOI
+
+# We assume the specified target if any is in out_base which would be two
+# levels up from our working directory.
+#
++if! $empty($target)
+ cat <<"EOI" >=build/root.build
+ target = \$src_root/../../$string([name] $target)
+ testscript{*}: test = \$target
+ EOI
+end
+
+# The "cat & build" setup: first cat ($c) the testscript, then run build ($b)
+# which will execute the testscript. We have to quote stdin because of the
+# command line re-expansion.
+#
+# Note that the buildfile is clever hack that relies on the first target
+# automatically becoming dir{./}'s prerequisite.
+#
+c = cat >=testscript
+b = $0 --serial-stop --quiet --buildfile - test \
+<"'testscript{testscript}: \$target'" \
+&?test/***