From c4846c81415424777b4fb22b862520cb594e3f8b Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Sun, 23 Apr 2017 12:54:37 +0300 Subject: [PATCH] test: failfast option. Change-Id: I42d1bdb9c20c9b96cfa41304bd025b09fab20518 --- test/config.cc | 2 ++ test/main.cc | 12 ++++++++++-- test/test.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/test/config.cc b/test/config.cc index 92e078b2..743e022a 100644 --- a/test/config.cc +++ b/test/config.cc @@ -325,6 +325,8 @@ void dump(const char *title) { log_info("cleanup: before %s, after %s\n", global::config::cleanup_before ? "Yes" : "No", global::config::cleanup_after ? "Yes" : "No"); + + log_info("failfast: %s\n", global::config::failfast ? "Yes" : "No"); } } /* namespace config */ diff --git a/test/main.cc b/test/main.cc index 385b5050..5ad2cb20 100644 --- a/test/main.cc +++ b/test/main.cc @@ -68,6 +68,7 @@ void actor_params::set_defaults(void) { global::config::dump_config = true; global::config::cleanup_before = true; global::config::cleanup_after = true; + global::config::failfast = true; } namespace global { @@ -86,6 +87,7 @@ unsigned timeout_duration_seconds; bool dump_config; bool cleanup_before; bool cleanup_after; +bool failfast; } /* namespace config */ } /* namespace global */ @@ -287,7 +289,7 @@ int main(int argc, char *const argv[]) { int rc = osal_actor_start(a, pid); log_trace("<< actor_start"); if (rc) { - log_trace(">> killall_actors"); + log_trace(">> killall_actors: (%s)", "start failed"); osal_killall_actors(); log_trace("<< killall_actors"); failure("Failed to start actor #%u (%s)\n", a.actor_id, @@ -331,8 +333,14 @@ int main(int argc, char *const argv[]) { actor->space_id, pid, status2str(status)); if (status > as_running) { left -= 1; - if (status != as_successful) + if (status != as_successful) { + if (global::config::failfast && !failed) { + log_trace(">> killall_actors: (%s)", "failfast"); + osal_killall_actors(); + log_trace("<< killall_actors"); + } failed = true; + } } } else { if (timeout_seconds_left == 0) diff --git a/test/test.h b/test/test.h index bb7764ba..c12e08a6 100644 --- a/test/test.h +++ b/test/test.h @@ -46,6 +46,7 @@ extern unsigned timeout_duration_seconds; extern bool dump_config; extern bool cleanup_before; extern bool cleanup_after; +extern bool failfast; } /* namespace config */ } /* namespace global */