factory: Provide review information screen inside framework UI.
The "factory_Review" cannot fit our new group-based test list well.
To support review without corrupting other tests' states, we need to move it to
the framework itself.
factory_Review and its ancestor, factory_ShowTestResults, are both removed.
BUG=chrome-os-partner:7928
TEST=Manually started UI, hit "Ctrl-Alt-Z" and see review screen.
Change-Id: I2f2c1d1c085d6d8e02ba87eed5db4e816cfdf3bf
Reviewed-on: https://gerrit.chromium.org/gerrit/18531
Reviewed-by: Tammo Spalink <tammo@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
diff --git a/goofy.py b/goofy.py
index c30bb8a..222679f 100755
--- a/goofy.py
+++ b/goofy.py
@@ -356,6 +356,7 @@
Event.Type.RESTART_TESTS: self.restart_tests,
Event.Type.AUTO_RUN: self.auto_run,
Event.Type.RE_RUN_FAILED: self.re_run_failed,
+ Event.Type.REVIEW: self.show_review_information,
}
def __del__(self):
@@ -442,15 +443,14 @@
# Any 'active' tests should be marked as failed now.
for test in self.test_list.walk():
state = test.get_state()
- if isinstance(test, factory.InformationScreen):
- test.update_state(status=TestState.UNTESTED, error_msg='')
- elif state.status == TestState.ACTIVE:
- if isinstance(test, factory.ShutdownStep):
- # Shutdown while the test was active - that's good.
- self.handle_shutdown_complete(test, state)
- else:
- test.update_state(status=TestState.FAILED,
- error_msg='Unknown (shutdown?)')
+ if state.status != TestState.ACTIVE:
+ continue
+ if isinstance(test, factory.ShutdownStep):
+ # Shutdown while the test was active - that's good.
+ self.handle_shutdown_complete(test, state)
+ else:
+ test.update_state(status=TestState.FAILED,
+ error_msg='Unknown (shutdown?)')
def show_next_active_test(self):
'''
@@ -575,9 +575,12 @@
self.set_visible_test(t)
break
- def abort_active_tests(self):
+ def kill_active_tests(self, abort):
'''
Kills and waits for all active tests.
+
+ @param abort: True to change state of killed tests to FAILED, False for
+ UNTESTED.
'''
self.reap_completed_tests()
for test, invoc in self.invocations.items():
@@ -585,8 +588,13 @@
invoc.abort_and_join()
factory.console.info('Killed %s' % test.path)
del self.invocations[test]
+ if not abort:
+ test.update_state(status=TestState.UNTESTED)
self.reap_completed_tests()
+ def abort_active_tests(self):
+ self.kill_active_tests(True)
+
def shutdown(self, operation):
'''
Shuts the machine (from a ShutdownStep).
@@ -717,6 +725,16 @@
'''Re-runs failed tests.'''
self.run_tests_with_status(TestState.FAILED)
+ def show_review_information(self, event):
+ '''Event handler for showing review information screen.
+
+ The information screene is rendered by main UI program (ui.py), so in
+ goofy we only need to kill all active tests, set them as untested, and
+ clear remaining tests.
+ '''
+ self.kill_active_tests(False)
+ self.run_tests([])
+
def handle_switch_test(self, event):
test = self.test_list.lookup_path(event.path)
if test: