Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/atf/dist/tools Print symbolically why the proce...
details: https://anonhg.NetBSD.org/src/rev/0e8c3dc0721f
branches: trunk
changeset: 342592:0e8c3dc0721f
user: christos <christos%NetBSD.org@localhost>
date: Wed Dec 30 22:23:38 2015 +0000
description:
Print symbolically why the process exited.
diffstat:
external/bsd/atf/dist/tools/process.cpp | 19 +++++++++++++++++++
external/bsd/atf/dist/tools/process.hpp | 2 ++
external/bsd/atf/dist/tools/test-program.cpp | 2 +-
3 files changed, 22 insertions(+), 1 deletions(-)
diffs (53 lines):
diff -r 6c25bee1b663 -r 0e8c3dc0721f external/bsd/atf/dist/tools/process.cpp
--- a/external/bsd/atf/dist/tools/process.cpp Wed Dec 30 22:23:02 2015 +0000
+++ b/external/bsd/atf/dist/tools/process.cpp Wed Dec 30 22:23:38 2015 +0000
@@ -360,6 +360,25 @@
{
}
+std::string
+impl::status::str(void)
+ const
+{
+ int mutable_status = m_status;
+ std::stringstream rv;
+ if (WIFEXITED(mutable_status))
+ rv << "exit(" << WEXITSTATUS(mutable_status);
+ else if (WIFSTOPPED(mutable_status))
+ rv << "stopped(" << WSTOPSIG(mutable_status);
+ else if (WIFSIGNALED(mutable_status))
+ rv << "terminated(" << WTERMSIG(mutable_status);
+ if (WCOREDUMP(mutable_status))
+ rv << "/core)";
+ else
+ rv << ")";
+ return rv.str();
+}
+
bool
impl::status::exited(void)
const
diff -r 6c25bee1b663 -r 0e8c3dc0721f external/bsd/atf/dist/tools/process.hpp
--- a/external/bsd/atf/dist/tools/process.hpp Wed Dec 30 22:23:02 2015 +0000
+++ b/external/bsd/atf/dist/tools/process.hpp Wed Dec 30 22:23:38 2015 +0000
@@ -207,6 +207,8 @@
public:
~status(void);
+ std::string str(void) const;
+
bool exited(void) const;
int exitstatus(void) const;
diff -r 6c25bee1b663 -r 0e8c3dc0721f external/bsd/atf/dist/tools/test-program.cpp
--- a/external/bsd/atf/dist/tools/test-program.cpp Wed Dec 30 22:23:02 2015 +0000
+++ b/external/bsd/atf/dist/tools/test-program.cpp Wed Dec 30 22:23:38 2015 +0000
@@ -664,7 +664,7 @@
const tools::process::status status = child.wait();
if (!status.exited() || status.exitstatus() != EXIT_SUCCESS)
throw tools::parser::format_error("Test program returned failure "
- "exit status for test case list");
+ "exit status " + status.str() + " for test case list");
return metadata(parser.get_tcs());
}
Home |
Main Index |
Thread Index |
Old Index