From 91495e646c688eade6b46f21bb40e3da8b8d6f1a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 23 Jan 2017 08:21:53 +0200 Subject: Implement automatic loading of directory buildfiles Now instead of explicitly writing: d = foo/ bar/ ./: $d include $d We can (usually) just write: ./: foo/ bar/ --- tests/search/buildfile | 5 +++++ tests/search/dir/buildfile | 8 +++++++ tests/search/dir/testscript | 51 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 tests/search/buildfile create mode 100644 tests/search/dir/buildfile create mode 100644 tests/search/dir/testscript (limited to 'tests/search') 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 <>>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 +: +$* <'bar' +bar/: x = y +./: bar/ +EOI + +: existing-target-implied +: +$* <'bar' +dir{bar/}: x = y +./: bar/ +EOI + +: existing-target-real +: +$* <