From dd1cb295722a049fe21c8d0311cb1823ccb0e508 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 5 Jun 2020 21:45:22 +0300 Subject: Add buildscript recipe tests --- tests/recipe/buildscript/buildfile | 4 ++ tests/recipe/buildscript/testscript | 96 +++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 tests/recipe/buildscript/buildfile create mode 100644 tests/recipe/buildscript/testscript (limited to 'tests/recipe') diff --git a/tests/recipe/buildscript/buildfile b/tests/recipe/buildscript/buildfile new file mode 100644 index 0000000..17c91a3 --- /dev/null +++ b/tests/recipe/buildscript/buildfile @@ -0,0 +1,4 @@ +# file : tests/recipe/buildscript/buildfile +# license : MIT; see accompanying LICENSE file + +./: testscript $b 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 <=build/bootstrap.build + project = test + amalgamation = + subprojects = + + using config + using test + EOI + ++cat <=build/root.build + using cxx + EOI + +test.options += config.cxx=$quote($recall($cxx.path) $cxx.mode, true) + +: update +: +{ + echo 'bar' >=bar; + + cat <=buildfile; + ./: foo + + foo: bar + {{ + cp $path($<) $path($>) + }} + EOI + + $* 2>'cp file{foo}'; + + cat <<'bar'; + + # While at it, make sure there is no rebuild. + # + $* 2>/'info: dir{./} is up to date'; + + $* clean 2>- +} + +: clean +: +{ + echo 'bar' >=bar; + + cat <=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 <=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>- +} -- cgit v1.1