aboutsummaryrefslogtreecommitdiff
path: root/build2/test
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-11-22 12:10:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-22 12:10:03 +0200
commit557269660c1d9796a7cf9e911efb9262f645e359 (patch)
tree0323bcb5a90c339fe87fcd193cf71bdcb3431c91 /build2/test
parentfae6cd2235c907e077dad7b5d8dc9b6d90a78a37 (diff)
Use diagnostics facility from libbutl
Diffstat (limited to 'build2/test')
-rw-r--r--build2/test/rule.cxx12
-rw-r--r--build2/test/script/parser.cxx21
-rw-r--r--build2/test/script/runner.cxx3
3 files changed, 14 insertions, 22 deletions
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index 6eb3551..e8a31cb 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -582,14 +582,12 @@ namespace build2
else if (verb)
text << "test " << t;
+ diag_record dr;
+ if (!run_test (t, dr, args.data ()))
{
- diag_record dr;
-
- if (!run_test (t, dr, args.data ()))
- {
- dr << info << "test command line: ";
- print_process (dr, args);
- }
+ dr << info << "test command line: ";
+ print_process (dr, args);
+ dr << endf; // return
}
return target_state::changed;
diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx
index 438e1f2..5730647 100644
--- a/build2/test/script/parser.cxx
+++ b/build2/test/script/parser.cxx
@@ -47,8 +47,8 @@ namespace build2
}
catch (const io_error& e)
{
- error << "unable to read testscript " << p << ": " << e.what ();
- throw failed ();
+ fail << "unable to read testscript " << p << ": " << e.what ()
+ << endf;
}
}
@@ -986,11 +986,9 @@ namespace build2
}
catch (const invalid_path&) {} // Fall through.
- {
- diag_record dr (fail (dl));
- dr << "invalid testscript include path ";
- to_stream (dr.os, n, true); // Quote.
- }
+ diag_record dr (fail (dl));
+ dr << "invalid testscript include path ";
+ to_stream (dr.os, n, true); // Quote.
}
}
@@ -1311,14 +1309,12 @@ namespace build2
return p;
}
- error (l) << "empty " << what;
+ fail (l) << "empty " << what << endf;
}
catch (const invalid_path& e)
{
- error (l) << "invalid " << what << " '" << e.path << "'";
+ fail (l) << "invalid " << what << " '" << e.path << "'" << endf;
}
-
- throw failed ();
};
auto add_file = [&app, &parse_path] (redirect& r, int fd, string&& w)
@@ -2630,8 +2626,7 @@ namespace build2
}
catch (const exception&)
{
- error (loc) << "invalid $* index " << var.name;
- throw failed ();
+ fail (loc) << "invalid $* index " << var.name << endf;
}
const strings& s (cast<strings> (v));
diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx
index aa35612..ef086f5 100644
--- a/build2/test/script/runner.cxx
+++ b/build2/test/script/runner.cxx
@@ -41,8 +41,7 @@ namespace build2
// executed let's add the location anyway to ease the
// troubleshooting. And let's stick to that principle down the road.
//
- error (ll) << "unable to read " << p << ": " << e.what ();
- throw failed ();
+ fail (ll) << "unable to read " << p << ": " << e.what () << endf;
}
}