aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/adhoc-rule-buildscript.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-10-10 17:22:46 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-11-06 19:32:09 +0300
commitf41599c8e9435f3dfec60b872c2b4ae31177efdd (patch)
tree088f8d9bf906e4a2ed734e034699163c9ccc7306 /libbuild2/adhoc-rule-buildscript.cxx
parentac76a4fd2afff48a0d5db84592babe5cabef3a2c (diff)
Add support for test timeouts
Diffstat (limited to 'libbuild2/adhoc-rule-buildscript.cxx')
-rw-r--r--libbuild2/adhoc-rule-buildscript.cxx25
1 files changed, 20 insertions, 5 deletions
diff --git a/libbuild2/adhoc-rule-buildscript.cxx b/libbuild2/adhoc-rule-buildscript.cxx
index 3dbe817..a09d2c7 100644
--- a/libbuild2/adhoc-rule-buildscript.cxx
+++ b/libbuild2/adhoc-rule-buildscript.cxx
@@ -124,8 +124,21 @@ namespace build2
}
recipe adhoc_buildscript_rule::
- apply (action a, target& t, match_extra&) const
+ apply (action a, target& t, match_extra& e) const
{
+ return apply (a, t, e, nullopt);
+ }
+
+ recipe adhoc_buildscript_rule::
+ apply (action a, target& t, match_extra&, const optional<timestamp>& d) const
+ {
+ // We don't support deadlines of any of these case (see below).
+ //
+ if (d && (a.outer () ||
+ t.data<bool> () ||
+ (a == perform_update_id && t.is_a<file> ())))
+ return empty_recipe;
+
// If this is an outer operation (e.g., update-for-test), then delegate to
// the inner.
//
@@ -171,9 +184,9 @@ namespace build2
}
else
{
- return [this] (action a, const target& t)
+ return [d, this] (action a, const target& t)
{
- return default_action (a, t);
+ return default_action (a, t, d);
};
}
}
@@ -584,7 +597,9 @@ namespace build2
}
target_state adhoc_buildscript_rule::
- default_action (action a, const target& t) const
+ default_action (action a,
+ const target& t,
+ const optional<timestamp>& deadline) const
{
tracer trace ("adhoc_buildscript_rule::default_action");
@@ -597,7 +612,7 @@ namespace build2
const scope& bs (t.base_scope ());
const scope& rs (*bs.root_scope ());
- build::script::environment e (a, t, script.temp_dir);
+ build::script::environment e (a, t, script.temp_dir, deadline);
build::script::parser p (ctx);
if (verb == 1)