diff --git a/repos/gems/run/depot_autopilot.run b/repos/gems/run/depot_autopilot.run
index ef33e94fa9..42817660b3 100644
--- a/repos/gems/run/depot_autopilot.run
+++ b/repos/gems/run/depot_autopilot.run
@@ -323,6 +323,9 @@ proc prepare_to_run_genode { } {
global qemu_args
global previous_results
global previous_time_ms
+ global previous_succeeded
+ global previous_failed
+ global previous_skipped
global skip_test_pkg
global test_pkgs
global single_test_build
@@ -466,7 +469,10 @@ proc prepare_to_run_genode { } {
- } $previous_results {
+ } $previous_results {
} [test_pkgs_start_nodes] {
@@ -557,8 +563,11 @@ foreach test_pkg $avail_test_pkgs {
}
}
-set previous_results ""
-set previous_time_ms 0
+set previous_results ""
+set previous_time_ms 0
+set previous_succeeded 0
+set previous_failed 0
+set previous_skipped 0
prepare_to_run_genode
while {1} {
@@ -586,6 +595,7 @@ while {1} {
append previous_results \012
}
append previous_results { } [format {%-31s %-6s %7s} $last_test_pkg "failed " "$timeout.000"] { reboot}
+ incr previous_failed
# prepare system re-boot
prepare_to_run_genode
@@ -609,6 +619,23 @@ while {1} {
set last_test_result ""
regexp {depot_autopilot\] ( [^\033]+)} $output ignored last_test_result
regsub -all {<} $last_test_result {\<} last_test_result
+
+ set failed_off [string first " failed" $last_test_result]
+ set skipped_off [string first " skipped" $last_test_result]
+ set ok_off [string first " ok" $last_test_result]
+
+ if {$failed_off > 0 && ($skipped_off < 0 || $failed_off < $skipped_off) && ($ok_off < 0 || $failed_off < $ok_off)} {
+ incr previous_failed
+ } elseif {$skipped_off > 0 && ($ok_off < 0 || $skipped_off < $ok_off)} {
+ incr previous_skipped
+ } elseif {$ok_off > 0} {
+ incr previous_succeeded
+ } else {
+ puts "Error: malformed test result"
+ puts $last_test_result
+ exit -1
+ }
+
if {$previous_results != ""} {
append previous_results \012
}
diff --git a/repos/gems/src/app/depot_autopilot/README b/repos/gems/src/app/depot_autopilot/README
index 6a72db4ba5..a50d2f3d21 100644
--- a/repos/gems/src/app/depot_autopilot/README
+++ b/repos/gems/src/app/depot_autopilot/README
@@ -61,7 +61,10 @@ This is an example configuration of the Depot Autopilot:
! ...
!
!
-! test-rm_fault_no_nox skipped
+! test-rm_fault_no_nox skipped
! test-rm_nested failed 0.653 log "Error: "
!
!
@@ -114,6 +117,14 @@ This is an example configuration of the Depot Autopilot:
Contains a time in seconds that shall be added to the total time shown in
header of the overview.
+::
+::
+::
+
+ A non-negative number that denotes how many tests are already
+ succeeded/failed/skipped. The number is added to the number of
+ succeeded/failed/skipped tests in the result overview.
+
::
Each node stands for a test that shall be evaluated by the Autopilot.
diff --git a/repos/gems/src/app/depot_autopilot/child.cc b/repos/gems/src/app/depot_autopilot/child.cc
index d2d5ff13d5..0c11409734 100644
--- a/repos/gems/src/app/depot_autopilot/child.cc
+++ b/repos/gems/src/app/depot_autopilot/child.cc
@@ -50,7 +50,7 @@ void Child::gen_start_node(Xml_generator &xml,
log("--- Run \"", _name, "\" (max 1 sec) ---");
log("");
- _state = State::SUCCEEDED;
+ _state = State::SKIPPED;
char name_padded[32];
for (size_t i = 0; i < sizeof(name_padded) - 1; name_padded[i++] = ' ');
@@ -677,17 +677,23 @@ Child::State_name Child::_padded_state_name() const
switch (_state) {
case SUCCEEDED: return "ok ";
case FAILED: return "failed ";
+ case SKIPPED:;
case UNFINISHED: ;
}
return "?";
}
-void Child::conclusion(int &result)
+void Child::conclusion(Result &result)
{
+ struct Bad_state : Exception { };
log(" ", _conclusion);
- if (_state != SUCCEEDED) {
- result = -1; }
+ switch (_state) {
+ case SUCCEEDED: result.succeeded++; break;
+ case FAILED: result.failed++; break;
+ case SKIPPED: result.skipped++; break;
+ default: throw Bad_state();
+ }
}
@@ -891,3 +897,14 @@ Event::Event(Xml_node const &node,
throw Invalid();
}
}
+
+
+/************
+ ** Result **
+ ************/
+
+void Result::print(Output &output) const
+{
+ Genode::print(output, "succeeded: ", succeeded, " failed: ", failed,
+ " skipped: ", skipped);
+}
diff --git a/repos/gems/src/app/depot_autopilot/child.h b/repos/gems/src/app/depot_autopilot/child.h
index feb83718d2..5df6994134 100644
--- a/repos/gems/src/app/depot_autopilot/child.h
+++ b/repos/gems/src/app/depot_autopilot/child.h
@@ -31,6 +31,20 @@ namespace Depot_deploy {
using namespace Depot;
+ struct Result
+ {
+ Genode::size_t failed { 0 };
+ Genode::size_t succeeded { 0 };
+ Genode::size_t skipped { 0 };
+
+
+ /*********
+ ** log **
+ *********/
+
+ void print(Genode::Output &output) const;
+ };
+
class Child;
class Event;
class Timeout_event;
@@ -147,7 +161,7 @@ class Depot_deploy::Child : public List_model::Element
* node until the condition is satisfied.
*/
enum Condition { UNCHECKED, SATISFIED, UNSATISFIED };
- enum State { UNFINISHED, SUCCEEDED, FAILED };
+ enum State { UNFINISHED, SUCCEEDED, FAILED, SKIPPED };
bool const _skip;
Allocator &_alloc;
@@ -209,7 +223,7 @@ class Depot_deploy::Child : public List_model::Element
void log_session_write(Log_event::Line const &log_line);
- void conclusion(int &result);
+ void conclusion(Result &result);
void event_occured(Event const &event,
unsigned long const time_us);
diff --git a/repos/gems/src/app/depot_autopilot/children.h b/repos/gems/src/app/depot_autopilot/children.h
index 223d919d7f..0416dac16c 100644
--- a/repos/gems/src/app/depot_autopilot/children.h
+++ b/repos/gems/src/app/depot_autopilot/children.h
@@ -158,13 +158,11 @@ class Depot_deploy::Children
return finished;
}
- int conclusion()
+ void conclusion(Result &result)
{
- int result = 0;
_children.for_each([&] (Child &child) {
child.conclusion(result);
});
- return result;
}
void gen_queries(Xml_generator &xml)
diff --git a/repos/gems/src/app/depot_autopilot/config.xsd b/repos/gems/src/app/depot_autopilot/config.xsd
index 6336b4f491..de70677220 100644
--- a/repos/gems/src/app/depot_autopilot/config.xsd
+++ b/repos/gems/src/app/depot_autopilot/config.xsd
@@ -71,7 +71,10 @@
-
+
+
+
+
diff --git a/repos/gems/src/app/depot_autopilot/main.cc b/repos/gems/src/app/depot_autopilot/main.cc
index 5f0c62e3e4..6423aa5c2e 100644
--- a/repos/gems/src/app/depot_autopilot/main.cc
+++ b/repos/gems/src/app/depot_autopilot/main.cc
@@ -154,9 +154,14 @@ struct Depot_deploy::Main
});
if (finished) {
+ Result result;
unsigned long previous_time_sec { 0UL };
if (config.has_sub_node("previous-results")) {
- previous_time_sec += config.sub_node("previous-results").attribute_value("time_sec", 0UL);
+ Xml_node const previous_results = config.sub_node("previous-results");
+ previous_time_sec += previous_results.attribute_value("time_sec", 0UL);
+ result.succeeded += previous_results.attribute_value("succeeded", 0UL);
+ result.failed += previous_results.attribute_value("failed", 0UL);
+ result.skipped += previous_results.attribute_value("skipped", 0UL);
}
unsigned long const time_us { _timer.curr_time().trunc_to_plain_us().value };
unsigned long time_ms { time_us / 1000UL };
@@ -170,10 +175,11 @@ struct Depot_deploy::Main
log(Cstring(previous_results.content_base(), previous_results.content_size()));
}
}
- int result = _children.conclusion();
+ _children.conclusion(result);
log("");
- _env.parent().exit(result);
-
+ log(result);
+ log("");
+ _env.parent().exit(result.failed ? -1 : 0);
}
/* update query for blueprints of all unconfigured start nodes */