aboutsummaryrefslogtreecommitdiff
path: root/tests/recipe/cxx/testscript
diff options
context:
space:
mode:
Diffstat (limited to 'tests/recipe/cxx/testscript')
-rw-r--r--tests/recipe/cxx/testscript60
1 files changed, 51 insertions, 9 deletions
diff --git a/tests/recipe/cxx/testscript b/tests/recipe/cxx/testscript
index 6b11c0f..323d671 100644
--- a/tests/recipe/cxx/testscript
+++ b/tests/recipe/cxx/testscript
@@ -26,6 +26,8 @@ if (!$static && $test.target == $build.host)
}}
EOI
+ +export BDEP_SYNC=0
+
: update-clean
:
{
@@ -79,7 +81,7 @@ if (!$static && $test.target == $build.host)
return r;
if (verb == 1)
- text << "cp " << t;
+ print_diag ("cp", s, t);
else if (verb >= 2)
text << "cp " << sp << ' ' << tp;
@@ -89,18 +91,18 @@ if (!$static && $test.target == $build.host)
}}
EOI
- env BDEP_SYNC=0 -- $* 2>>~%EOE%;
+ $* 2>>~%EOE%;
%^(c\+\+|ld).*%+
- cp file{foo}
+ cp file{bar} -> file{foo}
EOE
cat <<<foo >'bar';
# While at it, make sure there is no rebuild.
#
- env BDEP_SYNC=0 -- $* 2>/'info: dir{./} is up to date';
+ $* 2>/'info: dir{./} is up to date';
- env BDEP_SYNC=0 -- $* clean 2>-
+ $* clean 2>-
}
: test
@@ -139,7 +141,7 @@ if (!$static && $test.target == $build.host)
const path& tp (t.path ());
if (verb == 1)
- text << "test " << t;
+ print_diag ("test", t);
else if (verb >= 2)
text << "cat " << tp;
@@ -153,14 +155,54 @@ if (!$static && $test.target == $build.host)
}}
EOI
- env BDEP_SYNC=0 -- $* test 2>>~%EOE%;
+ $* test 2>>~%EOE%;
%^(c\+\+|ld).*%+
- cp file{foo}
+ cp file{bar} -> file{foo}
test file{foo}
bar
EOE
- env BDEP_SYNC=0 -- $* clean 2>-
+ $* clean 2>-
+ }
+
+ : rule
+ :
+ {
+ cat <<EOI >=buildfile;
+ alias{far}: alias{bar}
+ alias{bar}:
+
+ alias{~'/f(.+)/'}: alias{~'/b\1/'}
+ {{ c++ 1 --
+
+ #include <iostream>
+
+ --
+
+ recipe
+ apply (action a, target& t) const override
+ {
+ const auto& mrs (t.data<regex_match_results> (a));
+
+ return [this, mr = mrs.str (1)] (action a, const target& t)
+ {
+ return perform_update (a, t, mr);
+ };
+ }
+
+ target_state
+ perform_update (action, const target&, const string& mr) const
+ {
+ text << pattern->rule_name << ": " << mr;
+ return target_state::changed;
+ }
+ }}
+ EOI
+
+ $* 2>>~%EOE%
+ %^(c\+\+|ld).*%+
+ <ad hoc pattern rule #1>: ar
+ EOE
}
# Clean recipe builds if the testscript is enabled (see above for details).