aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-07-31 16:57:51 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-08-03 10:50:42 +0300
commit61c77b931a735a3305eabc3e1f0ae1a6cc4d3709 (patch)
tree3af9a8fee9643575a9b2296cda99878f55f1540e /libbuild2/test
parentbe464b7496f5d02718ae0cb2f884b3bf3d19f3e6 (diff)
Fix buildscript diagnostics so diff output is always in unified format
Also make sure diff refers program stdout as 'stdout' rather than '-' in the test rule diagnostics.
Diffstat (limited to 'libbuild2/test')
-rw-r--r--libbuild2/test/rule.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/libbuild2/test/rule.cxx b/libbuild2/test/rule.cxx
index e1006d8..db490d9 100644
--- a/libbuild2/test/rule.cxx
+++ b/libbuild2/test/rule.cxx
@@ -866,7 +866,22 @@ namespace build2
if (cast<target_triplet> (tt[test_target]).class_ == "windows")
args.push_back ("--strip-trailing-cr");
- args.push_back (op.string ().c_str ());
+ const char* f (op.string ().c_str ());
+
+ // Note that unmatched program stdout will be referred by diff as '-'
+ // by default. Let's name it as 'stdout' for clarity and consistency
+ // with the buildscript diagnostics.
+ //
+ // Also note that the -L option is not portable but is supported by all
+ // the major implementations (see script/run.cxx for details).
+ //
+ args.push_back ("-L");
+ args.push_back (f);
+
+ args.push_back ("-L");
+ args.push_back ("stdout");
+
+ args.push_back (f);
args.push_back ("-");
args.push_back (nullptr);
}