diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-04-26 16:42:33 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-04-26 16:43:56 +0300 |
commit | 2fd9d3f177429b20797897360931badedbb0f0ef (patch) | |
tree | 4491ac257088da1ee19a1d71ab321e0a722e36e1 /build2/test/script | |
parent | f6e6cfc3b5c7c84dedddc95084c423608769d4b7 (diff) |
Print diff failure reason
Diffstat (limited to 'build2/test/script')
-rw-r--r-- | build2/test/script/runner.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx index 4136953..e01f621 100644 --- a/build2/test/script/runner.cxx +++ b/build2/test/script/runner.cxx @@ -334,6 +334,34 @@ namespace build2 if (p.wait ()) return true; + assert (p.exit); + const process_exit& pe (*p.exit); + + // Note that both POSIX and GNU diff utilities report error + // exiting with the code > 1. + // + if (!pe.normal () || pe.code () > 1) + { + diag_record d (fail (ll)); + + if (!pe.normal ()) + { + d << pp << " terminated abnormally: "; + print_process (d, args); + + d << info << pe.description (); + if (pe.core ()) + d << " (core dumped)"; + } + else + { + d << pp << " exit status " + << static_cast<uint16_t> (pe.code ()) << ": "; + + print_process (d, args); + } + } + // Output doesn't match the expected result. // if (diag) |