aboutsummaryrefslogtreecommitdiff
path: root/tests/recipe/buildscript/testscript
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-06-05 21:45:22 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-06-08 16:50:24 +0300
commitdd1cb295722a049fe21c8d0311cb1823ccb0e508 (patch)
treec654b5052831122ed35e4bcfc82fc30a5a737674 /tests/recipe/buildscript/testscript
parent7fdc55efe423f58e5ce03e7f758ace6443800b7a (diff)
Add buildscript recipe tests
Diffstat (limited to 'tests/recipe/buildscript/testscript')
-rw-r--r--tests/recipe/buildscript/testscript96
1 files changed, 96 insertions, 0 deletions
diff --git a/tests/recipe/buildscript/testscript b/tests/recipe/buildscript/testscript
new file mode 100644
index 0000000..4ea1ee6
--- /dev/null
+++ b/tests/recipe/buildscript/testscript
@@ -0,0 +1,96 @@
+# file : tests/recipe/buildscript/testscript
+# license : MIT; see accompanying LICENSE file
+
++mkdir build
++cat <<EOI >=build/bootstrap.build
+ project = test
+ amalgamation =
+ subprojects =
+
+ using config
+ using test
+ EOI
+
++cat <<EOI >=build/root.build
+ using cxx
+ EOI
+
+test.options += config.cxx=$quote($recall($cxx.path) $cxx.mode, true)
+
+: update
+:
+{
+ echo 'bar' >=bar;
+
+ cat <<EOI >=buildfile;
+ ./: foo
+
+ foo: bar
+ {{
+ cp $path($<) $path($>)
+ }}
+ EOI
+
+ $* 2>'cp file{foo}';
+
+ cat <<<foo >'bar';
+
+ # While at it, make sure there is no rebuild.
+ #
+ $* 2>/'info: dir{./} is up to date';
+
+ $* clean 2>-
+}
+
+: clean
+:
+{
+ echo 'bar' >=bar;
+
+ cat <<EOI >=buildfile;
+ ./: foo
+
+ foo: bar
+ {{
+ cp $path($<) $path($>)
+ }}
+ % [diag=clean] clean
+ {{
+ t = $path($>)
+ rm $t $(t).d
+ }}
+ EOI
+
+ $* 2>-;
+
+ # Rely on the cleanup machinery to verify that the build output files are
+ # removed.
+ #
+ $* clean 2>'clean file{foo}'
+}
+
+: test
+:
+{
+ echo 'bar' >=bar;
+
+ cat <<EOI >=buildfile;
+ ./: foo
+
+ foo: bar
+ {{
+ cp $path($<) $path($>)
+ }}
+ % [diag=test] test
+ {{
+ cat <$path($<) >?$path($>)
+ }}
+ EOI
+
+ $* test 2>>EOE;
+ cp file{foo}
+ test file{foo}
+ EOE
+
+ $* clean 2>-
+}