diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-12-01 13:19:49 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-12-01 13:19:49 +0200 |
commit | 08eea971d2d3170ca357935644483dc520f46173 (patch) | |
tree | 871df5e71e364d4620db74298b7f88f9466d1473 /tests | |
parent | 0ed86c76239d4f2904ea4ae1a77902a9e0db2a6d (diff) | |
download | build2-08eea971d2d3170ca357935644483dc520f46173.tar.gz build2-08eea971d2d3170ca357935644483dc520f46173.tar.xz build2-08eea971d2d3170ca357935644483dc520f46173.zip |
Organize tests/, factor common testscript fragments
Diffstat (limited to 'tests')
-rw-r--r-- | tests/buildfile | 2 | ||||
-rw-r--r-- | tests/common.test | 21 | ||||
-rw-r--r-- | tests/directive/assert.test | 2 | ||||
-rw-r--r-- | tests/directive/buildfile | 4 | ||||
-rw-r--r-- | tests/directive/common.test | 11 | ||||
-rw-r--r-- | tests/expansion/buildfile | 4 | ||||
-rw-r--r-- | tests/expansion/common.test | 11 | ||||
-rw-r--r-- | tests/expansion/type.test | 2 | ||||
-rw-r--r-- | tests/function/builtin/buildfile | 2 | ||||
-rw-r--r-- | tests/function/builtin/testscript | 8 | ||||
-rw-r--r-- | tests/function/path/buildfile | 2 | ||||
-rw-r--r-- | tests/function/path/testscript | 8 | ||||
-rw-r--r-- | tests/test/buildfile | 2 | ||||
-rw-r--r-- | tests/test/common.test | 24 | ||||
-rw-r--r-- | tests/test/script/buildfile | 2 | ||||
-rw-r--r-- | tests/test/script/builtin/cat.test | 4 | ||||
-rw-r--r-- | tests/test/script/common.test | 27 | ||||
-rw-r--r-- | tests/test/script/integration/buildfile | 1 | ||||
-rw-r--r-- | tests/test/script/integration/testscript | 13 | ||||
-rw-r--r-- | tests/test/script/runner/cleanup.test | 13 | ||||
-rw-r--r-- | tests/test/script/runner/status.test | 15 |
21 files changed, 94 insertions, 84 deletions
diff --git a/tests/buildfile b/tests/buildfile index 405df8f5..0c2a8951 100644 --- a/tests/buildfile +++ b/tests/buildfile @@ -3,5 +3,5 @@ # license : MIT; see accompanying LICENSE file d = directive/ expansion/ function/ test/ -./: $d +./: $d file{common.test} include $d diff --git a/tests/common.test b/tests/common.test new file mode 100644 index 00000000..4d4520fd --- /dev/null +++ b/tests/common.test @@ -0,0 +1,21 @@ +# file : tests/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. +# + ++mkdir build ++cat <<EOI >>>build/bootstrap.build +project = test +amalgamation = +EOI + +test = $effect($build.path) +test.options += -q --buildfile - + +# By default just load the buildfile. +# ++if ($empty($test.arguments)) + test.arguments = noop +end diff --git a/tests/directive/assert.test b/tests/directive/assert.test index ca1b0354..80e28ba3 100644 --- a/tests/directive/assert.test +++ b/tests/directive/assert.test @@ -2,7 +2,7 @@ # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -.include common.test +.include ../common.test $* <'assert true' : true $* <'assert! false foo' : not-false diff --git a/tests/directive/buildfile b/tests/directive/buildfile index e9e946e7..583b1492 100644 --- a/tests/directive/buildfile +++ b/tests/directive/buildfile @@ -2,6 +2,4 @@ # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -./: test{assert} file{common.test} - -test{*}: test = $effect($build.path) +./: test{assert} diff --git a/tests/directive/common.test b/tests/directive/common.test deleted file mode 100644 index 351c133a..00000000 --- a/tests/directive/common.test +++ /dev/null @@ -1,11 +0,0 @@ -# file : tests/directive/assert.test -# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd -# license : MIT; see accompanying LICENSE file - -+mkdir build -+cat <<EOI >>>build/bootstrap.build -project = test -amalgamation = -EOI - -test.options += -q --buildfile - noop diff --git a/tests/expansion/buildfile b/tests/expansion/buildfile index 81df59e2..2f028523 100644 --- a/tests/expansion/buildfile +++ b/tests/expansion/buildfile @@ -2,6 +2,4 @@ # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -./: test{type} file{common.test} - -test{*}: test = $effect($build.path) +./: test{type} diff --git a/tests/expansion/common.test b/tests/expansion/common.test deleted file mode 100644 index 881c74e1..00000000 --- a/tests/expansion/common.test +++ /dev/null @@ -1,11 +0,0 @@ -# file : tests/expansion/assert.test -# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd -# license : MIT; see accompanying LICENSE file - -+mkdir build -+cat <<EOI >>>build/bootstrap.build -project = test -amalgamation = -EOI - -test.options += -q --buildfile - noop diff --git a/tests/expansion/type.test b/tests/expansion/type.test index 27c646d6..7ac65246 100644 --- a/tests/expansion/type.test +++ b/tests/expansion/type.test @@ -4,7 +4,7 @@ # Test type propagation during expansion. -.include common.test +.include ../common.test : var : diff --git a/tests/function/builtin/buildfile b/tests/function/builtin/buildfile index 5a49ad06..fb06e731 100644 --- a/tests/function/builtin/buildfile +++ b/tests/function/builtin/buildfile @@ -3,5 +3,3 @@ # license : MIT; see accompanying LICENSE file ./: test{testscript} - -test{*}: test = $effect($build.path) diff --git a/tests/function/builtin/testscript b/tests/function/builtin/testscript index 6491a60e..98513d3a 100644 --- a/tests/function/builtin/testscript +++ b/tests/function/builtin/testscript @@ -2,13 +2,7 @@ # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -+mkdir build -+cat <<EOI >>>build/bootstrap.build -project = test -amalgamation = -EOI - -test.options += -q --buildfile - noop +.include ../../common.test : type : diff --git a/tests/function/path/buildfile b/tests/function/path/buildfile index 8f51caba..65ed19be 100644 --- a/tests/function/path/buildfile +++ b/tests/function/path/buildfile @@ -3,5 +3,3 @@ # license : MIT; see accompanying LICENSE file ./: test{testscript} - -test{*}: test = $effect($build.path) diff --git a/tests/function/path/testscript b/tests/function/path/testscript index fc1cb31b..8b527e39 100644 --- a/tests/function/path/testscript +++ b/tests/function/path/testscript @@ -2,13 +2,7 @@ # copyright : Copyright (c) 2014-2016 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -+mkdir build -+cat <<EOI >>>build/bootstrap.build -project = test -amalgamation = -EOI - -test.options += -q --buildfile - noop +.include ../../common.test +if ($cxx.target.class != windows) # @@ TMP ternarry s = '/' diff --git a/tests/test/buildfile b/tests/test/buildfile index 0a98d5ee..3095a9da 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 00000000..94773596 --- /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 <<EOI >>>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 2c981931..7100d201 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 7797906d..f94b7bdd 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 <<EOI >>EOO diff --git a/tests/test/script/common.test b/tests/test/script/common.test new file mode 100644 index 00000000..a38c0a18 --- /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 <<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. +# +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 d2b77c9c..28aa0142 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 93ce08a2..8960b884 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 <<EOI >>>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 e5d917d8..52c0a296 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 <<EOI >>>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 4998311b..cf4ce1dc 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 <<EOI >>>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" |