diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-31 13:45:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-31 13:45:57 +0200 |
commit | 5974cab56148a18628bfb423189e016ade2d40f9 (patch) | |
tree | 472a7966d0e1c5725f0736c73812cbdeaab827dc /tests | |
parent | 2a9d673f298b623db061ee85d397563d644c8268 (diff) |
Rework scoping logic
Now the src directory is entered into the scope map and points to
the same scope as out. This means that targets that are in src,
not out (e.g., source files) will "see" rules, variables, etc.
This becomes important when we try, for example, to install a
source file (say, a header) from src: we need the rule as well
as the install.* variables.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/import/installed/build/bootstrap.build | 1 | ||||
-rw-r--r-- | tests/import/installed/buildfile | 8 | ||||
-rw-r--r-- | tests/scope/amalgamation/build/bootstrap.build | 3 | ||||
-rw-r--r-- | tests/scope/amalgamation/buildfile | 1 | ||||
-rw-r--r-- | tests/scope/amalgamation/l1/build/bootstrap.build | 16 | ||||
-rw-r--r-- | tests/scope/amalgamation/l1/buildfile | 37 | ||||
-rw-r--r-- | tests/scope/amalgamation/l1/l2/build/bootstrap.build | 2 | ||||
-rw-r--r-- | tests/scope/test-1.out | 15 | ||||
-rw-r--r-- | tests/scope/test-2.out | 15 | ||||
-rwxr-xr-x | tests/scope/test.sh | 12 | ||||
-rw-r--r-- | tests/simple/build/bootstrap.build | 3 | ||||
-rw-r--r-- | tests/simple/buildfile | 6 | ||||
-rw-r--r-- | tests/simple/driver.cxx | 8 |
13 files changed, 125 insertions, 2 deletions
diff --git a/tests/import/installed/build/bootstrap.build b/tests/import/installed/build/bootstrap.build index 97fd11f..2af1e60 100644 --- a/tests/import/installed/build/bootstrap.build +++ b/tests/import/installed/build/bootstrap.build @@ -1,3 +1,4 @@ project = import-installed amalgamation = # Disabled. using config +using test diff --git a/tests/import/installed/buildfile b/tests/import/installed/buildfile index 276de36..abdc151 100644 --- a/tests/import/installed/buildfile +++ b/tests/import/installed/buildfile @@ -5,5 +5,9 @@ cxx.ext = cxx import libs += lib{z} -#exe{driver}: cxx{driver} $libs -lib{driver}: cxx{driver} $libs +#lib{driver}: cxx{driver} $libs + +exe{driver}: cxx{driver} $libs +exe{driver}: test = true + + diff --git a/tests/scope/amalgamation/build/bootstrap.build b/tests/scope/amalgamation/build/bootstrap.build new file mode 100644 index 0000000..ee73365 --- /dev/null +++ b/tests/scope/amalgamation/build/bootstrap.build @@ -0,0 +1,3 @@ +project = scope-amalgamation +amalgamation = # Disabled. +using config diff --git a/tests/scope/amalgamation/buildfile b/tests/scope/amalgamation/buildfile new file mode 100644 index 0000000..9f80de9 --- /dev/null +++ b/tests/scope/amalgamation/buildfile @@ -0,0 +1 @@ +./: diff --git a/tests/scope/amalgamation/l1/build/bootstrap.build b/tests/scope/amalgamation/l1/build/bootstrap.build new file mode 100644 index 0000000..6bde838 --- /dev/null +++ b/tests/scope/amalgamation/l1/build/bootstrap.build @@ -0,0 +1,16 @@ +project = scope-amalgamation-l1 +using config + +# At this stage we don't know ../ is a project. This +# tests an out-of-project scope that will later be +# replaced with an in-project scope. Note that the +# replacement will only occur if src_root != out_root. +# If they are the same, then this scope will simply +# be "upgraded". +# +$src_root/../: +{ + print 0: $project + print 0: $src_base + print 0: $out_base +} diff --git a/tests/scope/amalgamation/l1/buildfile b/tests/scope/amalgamation/l1/buildfile new file mode 100644 index 0000000..55d8c64 --- /dev/null +++ b/tests/scope/amalgamation/l1/buildfile @@ -0,0 +1,37 @@ +# Out of amalgamation. +# +../../: +{ + print -1: $project + print -1: $src_base + print -1: $out_base +} + +# In amalgamation. +# +../s/: +{ + print 0: $project + print 0: $src_base + print 0: $out_base +} + +# In project. +# +s/: +{ + print 1: $project + print 1: $src_base + print 1: $out_base +} + +# In sub-project. +# +l2/s/: +{ + print 2: $project + print 2: $src_base + print 2: $out_base +} + +./: diff --git a/tests/scope/amalgamation/l1/l2/build/bootstrap.build b/tests/scope/amalgamation/l1/l2/build/bootstrap.build new file mode 100644 index 0000000..0262763 --- /dev/null +++ b/tests/scope/amalgamation/l1/l2/build/bootstrap.build @@ -0,0 +1,2 @@ +project = scope-amalgamation-l2 +using config diff --git a/tests/scope/test-1.out b/tests/scope/test-1.out new file mode 100644 index 0000000..0273bf1 --- /dev/null +++ b/tests/scope/test-1.out @@ -0,0 +1,15 @@ +0: +0: +0: +-1: +-1: +-1: +0: scope-amalgamation +0: /home/boris/work/build2/build2/tests/scope/amalgamation/s/ +0: /home/boris/work/build2/build2/tests/scope/amalgamation/s/ +1: scope-amalgamation-l1 +1: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/s/ +1: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/s/ +2: scope-amalgamation-l2 +2: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/l2/s/ +2: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/l2/s/ diff --git a/tests/scope/test-2.out b/tests/scope/test-2.out new file mode 100644 index 0000000..88f9620 --- /dev/null +++ b/tests/scope/test-2.out @@ -0,0 +1,15 @@ +0: +0: +0: +-1: +-1: +-1: +0: scope-amalgamation +0: /home/boris/work/build2/build2/tests/scope/amalgamation/s/ +0: /home/boris/work/build2/build2/tests/scope/a-out/s/ +1: scope-amalgamation-l1 +1: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/s/ +1: /home/boris/work/build2/build2/tests/scope/a-out/l1/s/ +2: scope-amalgamation-l2 +2: /home/boris/work/build2/build2/tests/scope/amalgamation/l1/l2/s/ +2: /home/boris/work/build2/build2/tests/scope/a-out/l1/l2/s/ diff --git a/tests/scope/test.sh b/tests/scope/test.sh new file mode 100755 index 0000000..5bbf0d8 --- /dev/null +++ b/tests/scope/test.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# In-tree. +# +valgrind b amalgamation/l1/ 2>/dev/null | diff -u test-1.out - + +# Out-of-tree. +# +rm -rf a-out/ +b 'configure(amalgamation/@a-out/)' 2>/dev/null +valgrind b amalgamation/l1/@a-out/l1/ 2>/dev/null | diff -u test-2.out - +rm -rf a-out/ diff --git a/tests/simple/build/bootstrap.build b/tests/simple/build/bootstrap.build new file mode 100644 index 0000000..7ee30cb --- /dev/null +++ b/tests/simple/build/bootstrap.build @@ -0,0 +1,3 @@ +project = simple +amalgamation = # Disabled. +using config diff --git a/tests/simple/buildfile b/tests/simple/buildfile new file mode 100644 index 0000000..986f391 --- /dev/null +++ b/tests/simple/buildfile @@ -0,0 +1,6 @@ +using cxx + +hxx.ext = hxx +cxx.ext = cxx + +exe{driver}: cxx{driver} diff --git a/tests/simple/driver.cxx b/tests/simple/driver.cxx new file mode 100644 index 0000000..5b076c7 --- /dev/null +++ b/tests/simple/driver.cxx @@ -0,0 +1,8 @@ +#include <iostream> + +using namespace std; + +int +main () +{ +} |