From 61c77b931a735a3305eabc3e1f0ae1a6cc4d3709 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 31 Jul 2020 16:57:51 +0300 Subject: 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. --- libbuild2/test/rule.cxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'libbuild2/test') 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 (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); } -- cgit v1.1