diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-28 14:32:38 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-28 14:32:38 +0200 |
commit | 9693eae0d4fddb148bd5fd663a7a2e802d3e4666 (patch) | |
tree | c4aecfd4518dca552ea424e4d84fd75412edc6c1 | |
parent | 1c7cbb302b1c6e41eb0c5cecfc655532f1919cba (diff) |
Use utility library to arrange unit testing
-rw-r--r-- | build/root.build | 6 | ||||
-rw-r--r-- | build2/buildfile | 18 | ||||
-rw-r--r-- | build2/dummy.cxx | 8 | ||||
-rw-r--r-- | unit-tests/cc/lexer/buildfile | 14 | ||||
-rw-r--r-- | unit-tests/cc/parser/buildfile | 14 | ||||
-rw-r--r-- | unit-tests/function/buildfile | 13 | ||||
-rw-r--r-- | unit-tests/lexer/buildfile | 13 | ||||
-rw-r--r-- | unit-tests/scheduler/buildfile | 12 | ||||
-rw-r--r-- | unit-tests/test/script/lexer/buildfile | 14 | ||||
-rw-r--r-- | unit-tests/test/script/parser/buildfile | 15 | ||||
-rw-r--r-- | unit-tests/test/script/regex/buildfile | 9 |
11 files changed, 20 insertions, 116 deletions
diff --git a/build/root.build b/build/root.build index 85f69a1..0d887ec 100644 --- a/build/root.build +++ b/build/root.build @@ -11,8 +11,6 @@ ixx{*}: extension = ixx txx{*}: extension = txx cxx{*}: extension = cxx -cxx.poptions =+ "-I$out_root" "-I$src_root" - # Load the cli module but only if it's available. This way a distribution # that includes pre-generated files can be built without installing cli. # This is also the reason why we need to explicitly spell out individual @@ -21,9 +19,11 @@ cxx.poptions =+ "-I$out_root" "-I$src_root" # using? cli -# All exe{} in unit-tests/ are, well, tests. +# All exe{} in unit-tests/ are, well, tests. Also don't link whole archives +# by default there. # unit-tests/exe{*}: test = true +unit-tests/libu{*}: bin.whole = false # Specify the test target for cross-testing. # diff --git a/build2/buildfile b/build2/buildfile index fc0632c..7514984 100644 --- a/build2/buildfile +++ b/build2/buildfile @@ -4,19 +4,19 @@ import libs = libbutl%lib{butl} -exe{b}: {hxx ixx txx cxx}{** -b-options -version -dummy} \ - {hxx ixx cxx}{b-options} {hxx}{version} \ - liba{b} $libs +exe{b}: cxx{b} libu{b} + +libu{b}: {hxx ixx txx cxx}{** -b -b-options -version} \ + {hxx ixx cxx}{b-options} {hxx}{version} \ + $libs + +cxx.poptions =+ "-I$out_root" "-I$src_root" +libu{b}: cxx.export.poptions = "-I$out_root" "-I$src_root" +libu{b}: cxx.export.libs = $libs hxx{version}: in{version} $src_root/file{manifest} hxx{version}: dist = true -# Fake utility library (without it code generation does not work). -# -liba{b}: {cxx}{dummy} -liba{b}: cxx.export.poptions = "-I$out_root" "-I$src_root" -liba{b}: install = false - # Pass our compiler target to be used as build2 host. # obj{b context}: cxx.poptions += -DBUILD2_HOST_TRIPLET=\"$cxx.target\" diff --git a/build2/dummy.cxx b/build2/dummy.cxx deleted file mode 100644 index bdea9a9..0000000 --- a/build2/dummy.cxx +++ /dev/null @@ -1,8 +0,0 @@ -// file : build2/dummy.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -namespace build2 -{ - void dummy () {} -} diff --git a/unit-tests/cc/lexer/buildfile b/unit-tests/cc/lexer/buildfile index 17a91d0..8c20552 100644 --- a/unit-tests/cc/lexer/buildfile +++ b/unit-tests/cc/lexer/buildfile @@ -2,17 +2,5 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -#@@ Temporary until we get utility library support. -# -import libs = libbutl%lib{butl} -src = cc/lexer token lexer diagnostics utility variable name b-options \ -types-parsers context scope parser target operation rule prerequisite file \ -module function functions-builtin functions-filesystem functions-path \ -functions-process-path functions-regex functions-string \ -functions-target-triplet algorithm search dump filesystem scheduler \ -config/{utility init operation module} spec - -exe{driver}: {hxx cxx}{*} ../../../build2/cxx{$src} ../../../build2/liba{b} \ - $libs test{*} - include ../../../build2/ +exe{driver}: {hxx cxx}{*} ../../../build2/libu{b} test{*} diff --git a/unit-tests/cc/parser/buildfile b/unit-tests/cc/parser/buildfile index d919e2f..0c04bb1 100644 --- a/unit-tests/cc/parser/buildfile +++ b/unit-tests/cc/parser/buildfile @@ -2,17 +2,5 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -#@@ Temporary until we get utility library support. -# -import libs = libbutl%lib{butl} -src = cc/{lexer parser} token lexer diagnostics utility variable name \ -b-options types-parsers context scope parser target operation rule \ -prerequisite file module function functions-builtin functions-filesystem \ -functions-path functions-process-path functions-regex functions-string \ -functions-target-triplet algorithm search dump filesystem scheduler \ -config/{utility init operation module} spec - -exe{driver}: {hxx cxx}{*} ../../../build2/cxx{$src} ../../../build2/liba{b} \ - $libs test{*} - include ../../../build2/ +exe{driver}: {hxx cxx}{*} ../../../build2/libu{b} test{*} diff --git a/unit-tests/function/buildfile b/unit-tests/function/buildfile index bae96f5..38f541a 100644 --- a/unit-tests/function/buildfile +++ b/unit-tests/function/buildfile @@ -2,16 +2,5 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -#@@ Temporary until we get utility library support. -# -import libs = libbutl%lib{butl} -src = token lexer diagnostics utility variable name b-options types-parsers \ -context scope parser target operation rule prerequisite file module function \ -functions-builtin functions-filesystem functions-path functions-process-path \ -functions-regex functions-string functions-target-triplet algorithm search \ -dump filesystem scheduler config/{utility init operation module} spec - -exe{driver}: {hxx cxx}{*} ../../build2/cxx{$src} ../../build2/liba{b} $libs \ - test{*} - include ../../build2/ +exe{driver}: {hxx cxx}{*} ../../build2/libu{b} test{*} diff --git a/unit-tests/lexer/buildfile b/unit-tests/lexer/buildfile index 09dbbf1..6df2a72 100644 --- a/unit-tests/lexer/buildfile +++ b/unit-tests/lexer/buildfile @@ -2,16 +2,5 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -#@@ Temporary until we get utility library support. -# -import libs = libbutl%lib{butl} -src = token lexer diagnostics utility variable name b-options types-parsers \ -context scope parser target operation rule prerequisite file module function \ -functions-builtin functions-filesystem functions-path functions-process-path \ -functions-regex functions-string functions-target-triplet algorithm search \ -dump filesystem scheduler config/{utility init operation module} spec - -exe{driver}: {hxx cxx}{*} ../../build2/cxx{$src} ../../build2/liba{b} $libs \ - test{*} - include ../../build2/ +exe{driver}: {hxx cxx}{*} ../../build2/libu{b} test{*} diff --git a/unit-tests/scheduler/buildfile b/unit-tests/scheduler/buildfile index 842c582..81c077b 100644 --- a/unit-tests/scheduler/buildfile +++ b/unit-tests/scheduler/buildfile @@ -2,15 +2,5 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -#@@ Temporary until we get utility library support. -# -import libs = libbutl%lib{butl} -src = token lexer diagnostics utility variable name b-options types-parsers \ -context scope parser target operation rule prerequisite file module function \ -functions-builtin functions-filesystem functions-path functions-process-path \ -functions-regex functions-string functions-target-triplet algorithm search \ -dump filesystem scheduler config/{utility init operation module} spec - -exe{driver}: {hxx cxx}{*} ../../build2/cxx{$src} ../../build2/liba{b} $libs - include ../../build2/ +exe{driver}: {hxx cxx}{*} ../../build2/libu{b} diff --git a/unit-tests/test/script/lexer/buildfile b/unit-tests/test/script/lexer/buildfile index 365b092..8cb284c 100644 --- a/unit-tests/test/script/lexer/buildfile +++ b/unit-tests/test/script/lexer/buildfile @@ -2,17 +2,5 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -#@@ Temporary until we get utility library support. -# -import libs = libbutl%lib{butl} -src = token lexer diagnostics utility variable name b-options types-parsers \ -context scope parser target operation rule prerequisite file module function \ -functions-builtin functions-filesystem functions-path functions-process-path \ -functions-regex functions-string functions-target-triplet algorithm search \ -dump filesystem scheduler config/{utility init operation module} \ -test/script/{token lexer} spec - -exe{driver}: {hxx cxx}{*} ../../../../build2/cxx{$src} \ - ../../../../build2/liba{b} $libs test{*} - include ../../../../build2/ +exe{driver}: {hxx cxx}{*} ../../../../build2/libu{b} test{*} diff --git a/unit-tests/test/script/parser/buildfile b/unit-tests/test/script/parser/buildfile index 3f62835..ea76bcd 100644 --- a/unit-tests/test/script/parser/buildfile +++ b/unit-tests/test/script/parser/buildfile @@ -2,18 +2,5 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -#@@ Temporary until we get utility library support. -# -import libs = libbutl%lib{butl} -src = token lexer parser diagnostics utility variable name context target \ -scope prerequisite file module operation rule b-options algorithm search \ -filesystem function functions-builtin functions-filesystem functions-path \ -functions-process-path functions-regex functions-string \ -functions-target-triplet config/{utility init operation module} dump \ -types-parsers test/{target script/{token lexer parser regex script}} \ -scheduler spec - -exe{driver}: {hxx cxx}{*} ../../../../build2/cxx{$src} \ - ../../../../build2/liba{b} $libs test{*} - include ../../../../build2/ +exe{driver}: {hxx cxx}{*} ../../../../build2/libu{b} test{*} diff --git a/unit-tests/test/script/regex/buildfile b/unit-tests/test/script/regex/buildfile index 1230338..217ff70 100644 --- a/unit-tests/test/script/regex/buildfile +++ b/unit-tests/test/script/regex/buildfile @@ -2,12 +2,5 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -#@@ Temporary until we get utility library support. -# -import libs = libbutl%lib{butl} -src = test/script/regex - -exe{driver}: {hxx cxx}{*} ../../../../build2/cxx{$src} \ - ../../../../build2/liba{b} $libs - include ../../../../build2/ +exe{driver}: {hxx cxx}{*} ../../../../build2/libu{b} |