aboutsummaryrefslogtreecommitdiff
path: root/tests/test/script/common.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test/script/common.test')
-rw-r--r--tests/test/script/common.test27
1 files changed, 18 insertions, 9 deletions
diff --git a/tests/test/script/common.test b/tests/test/script/common.test
index abd1faa..f58ed86 100644
--- a/tests/test/script/common.test
+++ b/tests/test/script/common.test
@@ -7,21 +7,30 @@
#
+mkdir build
-+cat <<EOI >>>build/bootstrap.build
++cat <<"EOI" >>>build/bootstrap.build
project = test
amalgamation =
using test
EOI
-# The "cat & build" setup: first cat ($c) the testscript, then run build
-# ($b) which will execute the testscript.
+# We assume the specified target if any is in out_base which would be two
+# levels up from our working directory.
#
-c = cat >>>testscript
-b = $effect($build.path) --jobs 1 --quiet --buildfile - test \
- <'./: test{testscript}' &?test/***
++if! $empty($target)
+ cat <<"EOI" >>>build/root.build
+ target = \$src_root/../../$string([name] $target)
+ test{*}: test = \$target
+ EOI
+end
-# Add extra set of quotes since this value will be "cat" (normally as $*)
-# into testscript.
+# 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.
#
-test = "'$test'"
+c = cat >>>testscript
+b = $0 --jobs 1 --quiet --buildfile - test <"'test{testscript}: \$target'" \
+&?test/***