dut: Add DUT-aware 'DUTHooks' module to replace callback board APIs.
The board APIs for test callback (OnTestStart, OnTestFailure, ...) should have
the reference to DUT and is better to be managed in its own module.
This change moves them to self.dut.hooks so the error can be notified on DUT
more easily.
BUG=chromium:557573
TEST=make test
Change-Id: If7acc6ba5ffb9dca8b20eb4f4213ec3463eb47e3
Reviewed-on: https://chromium-review.googlesource.com/318394
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
diff --git a/py/goofy/goofy.py b/py/goofy/goofy.py
index 587e9cf..6d588d0 100755
--- a/py/goofy/goofy.py
+++ b/py/goofy/goofy.py
@@ -990,7 +990,7 @@
status_filter: List of available test states. Only run the tests which
states are in the list. Set to None if all test states are available.
"""
- system.GetBoard().OnTestStart()
+ self.dut.hooks.OnTestStart()
if type(subtrees) != list:
subtrees = [subtrees]
@@ -1616,7 +1616,7 @@
self.state_instance.set_shared_data('tests_after_shutdown', None)
self.restore_active_run_state()
- system.GetBoard().OnTestStart()
+ self.dut.hooks.OnTestStart()
self.may_disable_cros_shortcut_keys()
@@ -2074,7 +2074,7 @@
self.reap_completed_tests()
def test_fail(self, test):
- system.GetBoard().OnTestFailure(test)
+ self.dut.hooks.OnTestFailure(test)
if self.link_manager:
self.link_manager.UpdateStatus(False)