aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-23 08:21:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-01-23 08:21:53 +0200
commit91495e646c688eade6b46f21bb40e3da8b8d6f1a (patch)
tree6cfafe23d2ca8a3d2c889961c8df0fffc128c4f7 /tests
parent699e3bc87d1cbb3c2b19ddaf5db37909cb49f47b (diff)
Implement automatic loading of directory buildfiles
Now instead of explicitly writing: d = foo/ bar/ ./: $d include $d We can (usually) just write: ./: foo/ bar/
Diffstat (limited to 'tests')
-rw-r--r--tests/buildfile6
-rw-r--r--tests/common.test2
-rw-r--r--tests/function/buildfile4
-rw-r--r--tests/function/builtin/testscript2
-rw-r--r--tests/search/buildfile5
-rw-r--r--tests/search/dir/buildfile8
-rw-r--r--tests/search/dir/testscript51
-rw-r--r--tests/test/buildfile6
-rw-r--r--tests/test/script/buildfile5
9 files changed, 75 insertions, 14 deletions
diff --git a/tests/buildfile b/tests/buildfile
index c0a50e3..0384c45 100644
--- a/tests/buildfile
+++ b/tests/buildfile
@@ -2,6 +2,6 @@
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-d = directive/ eval/ expansion/ function/ test/ value/
-./: $d file{common.test}
-include $d
+./: directive/ eval/ expansion/ function/ search/ test/ value/ \
+file{common.test}
+
diff --git a/tests/common.test b/tests/common.test
index 2311ae1..d495da0 100644
--- a/tests/common.test
+++ b/tests/common.test
@@ -15,6 +15,6 @@ test.options += --jobs 1 --quiet --buildfile -
# By default just load the buildfile.
#
-if ($empty($test.arguments))
+if ($null($test.arguments))
test.arguments = noop
end
diff --git a/tests/function/buildfile b/tests/function/buildfile
index 4e043cf..8034f2b 100644
--- a/tests/function/buildfile
+++ b/tests/function/buildfile
@@ -2,6 +2,4 @@
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-d = builtin/ path/
-./: $d
-include $d
+./: builtin/ path/
diff --git a/tests/function/builtin/testscript b/tests/function/builtin/testscript
index 82df683..0b005f3 100644
--- a/tests/function/builtin/testscript
+++ b/tests/function/builtin/testscript
@@ -1,4 +1,4 @@
-# file : tests/function/path/testscript
+# file : tests/function/builtin/testscript
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
diff --git a/tests/search/buildfile b/tests/search/buildfile
new file mode 100644
index 0000000..a72ca71
--- /dev/null
+++ b/tests/search/buildfile
@@ -0,0 +1,5 @@
+# file : tests/search/buildfile
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+./: dir/
diff --git a/tests/search/dir/buildfile b/tests/search/dir/buildfile
new file mode 100644
index 0000000..03afc85
--- /dev/null
+++ b/tests/search/dir/buildfile
@@ -0,0 +1,8 @@
+# file : tests/search/dir/buildfile
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Test loading of dir{} buildfiles during target search.
+#
+
+./: test{testscript} $b
diff --git a/tests/search/dir/testscript b/tests/search/dir/testscript
new file mode 100644
index 0000000..4c427b2
--- /dev/null
+++ b/tests/search/dir/testscript
@@ -0,0 +1,51 @@
+# file : tests/search/dir/testscript
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+test.arguments = 'update(../)'
+
+.include ../../common.test
+
+# foo/ has no buildfile
+# bar/ has valid buildfile
+# baz/ has invalid buildfile
+#
++mkdir foo bar baz
++cat <<EOI >>>bar/buildfile
+print bar
+./:
+EOI
++cat <'assert false' >>>baz/buildfile
+
+: no-buildfile
+:
+$* <'./: foo/' 2>>/EOE != 0
+error: no explicit target for prerequisite ../:dir{foo/}
+ info: did you forget to include the corresponding buildfile?
+info: while applying rule alias to update dir{../}
+EOE
+
+: basic
+:
+$* <'./: bar/' >'bar'
+
+: existing-scope
+:
+$* <<EOI >'bar'
+bar/: x = y
+./: bar/
+EOI
+
+: existing-target-implied
+:
+$* <<EOI >'bar'
+dir{bar/}: x = y
+./: bar/
+EOI
+
+: existing-target-real
+:
+$* <<EOI
+dir{baz/}:
+./: baz/
+EOI
diff --git a/tests/test/buildfile b/tests/test/buildfile
index 85ae8be..e01048f 100644
--- a/tests/test/buildfile
+++ b/tests/test/buildfile
@@ -2,6 +2,6 @@
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-d = config-test/ script/ script-integration/
-./: $d file{common.test}
-include $d
+./: config-test/ script/ script-integration/ \
+file{common.test}
+
diff --git a/tests/test/script/buildfile b/tests/test/script/buildfile
index b57c983..8ce3cc7 100644
--- a/tests/test/script/buildfile
+++ b/tests/test/script/buildfile
@@ -2,6 +2,5 @@
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-d = builtin/ runner/
-./: $d file{common.test}
-include $d
+./: builtin/ runner/ file{common.test}
+