Detect when a unit test child process crashes (RIPD-1592):

When a test suite starts and ends, it informs the parent process. If the parent
has received a start message without a matching end message it reports that a
child may have crashed in that suite.
This commit is contained in:
seelabs
2018-03-09 13:39:49 -05:00
parent deef322b07
commit 4b2afc8f42
7 changed files with 112 additions and 17 deletions

View File

@@ -163,7 +163,8 @@ class multi_runner_base
protected:
std::unique_ptr<boost::interprocess::message_queue> message_queue_;
void message_queue_send(std::string const& s);
enum class MessageType : std::uint8_t {test_start, test_end, log};
void message_queue_send(MessageType mt, std::string const& s);
public:
multi_runner_base();
@@ -208,7 +209,8 @@ private:
std::ostream& os_;
std::atomic<bool> continue_message_queue_{true};
std::thread message_queue_thread_;
// track running suites so if a child crashes the culprit can be flagged
std::set<std::string> running_suites_;
public:
multi_runner_parent(multi_runner_parent const&) = delete;
multi_runner_parent&
@@ -335,7 +337,7 @@ multi_runner_child::run_multi(Pred pred)
// inform the parent
std::stringstream s;
s << job_index_ << "> failed Unhandled exception in test.\n";
message_queue_send(s.str());
message_queue_send(MessageType::log, s.str());
failed = true;
}
}