From 08eea971d2d3170ca357935644483dc520f46173 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 1 Dec 2016 13:19:49 +0200 Subject: Organize tests/, factor common testscript fragments --- tests/test/buildfile | 2 +- tests/test/common.test | 24 ++++++++++++++++++++++++ tests/test/script/buildfile | 2 +- tests/test/script/builtin/cat.test | 4 ++++ tests/test/script/common.test | 27 +++++++++++++++++++++++++++ tests/test/script/integration/buildfile | 1 - tests/test/script/integration/testscript | 13 ++++--------- tests/test/script/runner/cleanup.test | 13 ++----------- tests/test/script/runner/status.test | 15 +++------------ 9 files changed, 66 insertions(+), 35 deletions(-) create mode 100644 tests/test/common.test create mode 100644 tests/test/script/common.test (limited to 'tests/test') diff --git a/tests/test/buildfile b/tests/test/buildfile index 0a98d5e..3095a9d 100644 --- a/tests/test/buildfile +++ b/tests/test/buildfile @@ -3,5 +3,5 @@ # license : MIT; see accompanying LICENSE file d = script/ -./: $d +./: $d file{common.test} include $d diff --git a/tests/test/common.test b/tests/test/common.test new file mode 100644 index 0000000..9477359 --- /dev/null +++ b/tests/test/common.test @@ -0,0 +1,24 @@ +# file : tests/test/common.test +# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +# Commonly-used build system test project setup and driver command line +# (test module tests). +# + ++mkdir build ++cat <>>build/bootstrap.build +project = test +amalgamation = + +using test +EOI + +test = $effect($build.path) +test.options += -q --buildfile - + +# By default perform test. +# ++if ($empty($test.arguments)) + test.arguments = test +end diff --git a/tests/test/script/buildfile b/tests/test/script/buildfile index 2c98193..7100d20 100644 --- a/tests/test/script/buildfile +++ b/tests/test/script/buildfile @@ -3,5 +3,5 @@ # license : MIT; see accompanying LICENSE file d = builtin/ integration/ runner/ -./: $d +./: $d file{common.test} include $d diff --git a/tests/test/script/builtin/cat.test b/tests/test/script/builtin/cat.test index 7797906..f94b7bd 100644 --- a/tests/test/script/builtin/cat.test +++ b/tests/test/script/builtin/cat.test @@ -2,6 +2,10 @@ # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file +# @@ I think these should be run indirectly (via cat & build) +# for cross-testing to work (we want to run the via the build +# system we built, not the one we used to acomplish this. + : in : cat <>EOO diff --git a/tests/test/script/common.test b/tests/test/script/common.test new file mode 100644 index 0000000..a38c0a1 --- /dev/null +++ b/tests/test/script/common.test @@ -0,0 +1,27 @@ +# file : tests/test/script/common.test +# copyright : Copyright (c) 2014-2016 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 <>>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. +# +c = cat >>>testscript +b = $effect($build.path) -q --buildfile - <'./: test{testscript}' \ + &?test/*** test + +# Add extra set of quotes since this value will be "cat" (normally as $*) +# into testscript. +# +test = "'$test'" diff --git a/tests/test/script/integration/buildfile b/tests/test/script/integration/buildfile index d2b77c9..28aa014 100644 --- a/tests/test/script/integration/buildfile +++ b/tests/test/script/integration/buildfile @@ -4,4 +4,3 @@ ./: test{testscript} -test{*}: test = $effect($build.path) diff --git a/tests/test/script/integration/testscript b/tests/test/script/integration/testscript index 93ce08a..8960b88 100644 --- a/tests/test/script/integration/testscript +++ b/tests/test/script/integration/testscript @@ -2,16 +2,11 @@ # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -+mkdir build -+cat <>>build/bootstrap.build -project = test -amalgamation = +# @@ I think these should be run indirectly (via cat & build) +# for cross-testing to work (we want to run the via the build +# system we built, not the one we used to acomplish this. -using test -EOI - -test.options += -q --buildfile - -test.arguments = test +.include ../../common.test : scrip-files : diff --git a/tests/test/script/runner/cleanup.test b/tests/test/script/runner/cleanup.test index e5d917d..52c0a29 100644 --- a/tests/test/script/runner/cleanup.test +++ b/tests/test/script/runner/cleanup.test @@ -2,18 +2,9 @@ # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -+mkdir build -+cat <>>build/bootstrap.build -project = test -amalgamation = +.include ../common.test -using test -EOI - -b = $effect($build.path) -q --no-column --buildfile - <"./: test{testscript}" \ - &?test/*** test -c = cat >>>testscript -test = "'$test'" +b += --no-column # Valid cleanups. # diff --git a/tests/test/script/runner/status.test b/tests/test/script/runner/status.test index 4998311..cf4ce1d 100644 --- a/tests/test/script/runner/status.test +++ b/tests/test/script/runner/status.test @@ -1,19 +1,10 @@ -# file : tests/test/script/runner/status.tests +# file : tests/test/script/runner/status.test # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -+mkdir build -+cat <>>build/bootstrap.build -project = test -amalgamation = +.include ../common.test -using test -EOI - -b = $effect($build.path) -q --no-column --buildfile - <"./: test{testscript}" \ - &?test/*** test -c = cat >>>testscript -test = "'$test'" +b += --no-column +if ($cxx.target.class == "windows") ext = ".exe" -- cgit v1.1