aboutsummaryrefslogtreecommitdiff
path: root/build2/test
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-03-17 12:19:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-03-17 12:19:07 +0200
commitde09beabe1448e9c6b401ec9acdd69ee5bf0f0e2 (patch)
tree5e994d2e4b4f1184cfa27b937a0dc8999619a807 /build2/test
parent262d2b3711fefd0b82100d2aaeaf94f6d2e6ea77 (diff)
Improve testscript execution diagnostics
Diffstat (limited to 'build2/test')
-rw-r--r--build2/test/rule.cxx63
1 files changed, 39 insertions, 24 deletions
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index 6ef2587..5cec891 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -363,6 +363,44 @@ namespace build2
}
}
+ static script::scope_state
+ perform_script_impl (const target& t,
+ const testscript& ts,
+ const dir_path& wd,
+ const common& c) noexcept
+ {
+ using namespace script;
+
+ scope_state r;
+
+ try
+ {
+ if (verb)
+ {
+ const auto& tt (cast<target_triplet> (t["test.target"]));
+ text << "test " << t << " with " << ts << " on " << tt;
+ }
+
+ script::script s (t, ts, wd);
+
+ {
+ parser p;
+ p.pre_parse (s);
+
+ default_runner r (c);
+ p.execute (s, r);
+ }
+
+ r = s.state;
+ }
+ catch (const failed&)
+ {
+ r = scope_state::failed;
+ }
+
+ return r;
+ }
+
target_state rule_common::
perform_script (action, const target& t) const
{
@@ -471,12 +509,6 @@ namespace build2
mk = false;
}
- if (verb)
- {
- const auto& tt (cast<target_triplet> (t["test.target"]));
- text << "test " << t << " with " << *ts << " on " << tt;
- }
-
result.push_back (scope_state::unknown);
scope_state& r (result.back ());
@@ -489,24 +521,7 @@ namespace build2
const diag_frame* ds) noexcept
{
diag_frame df (ds);
- try
- {
- script::script s (t, ts, wd);
-
- {
- script::parser p;
- p.pre_parse (s);
-
- script::default_runner r (*this);
- p.execute (s, r);
- }
-
- r = s.state;
- }
- catch (const failed&)
- {
- r = scope_state::failed;
- }
+ r = perform_script_impl (t, ts, wd, *this);
},
ref (r),
cref (t),