Tests: Watchdog: Fix config access in the host script

Move the calls to get_config_item() to the setup() method. The config is
not available in the initializer yet.
pull/10657/head
Filip Jagodzinski 2018-11-22 20:43:17 +01:00
parent f9ac1567af
commit a37d03d640
3 changed files with 9 additions and 6 deletions

View File

@ -68,13 +68,14 @@ class ResetReasonTest(BaseHostTest):
super(ResetReasonTest, self).__init__()
self.device_has_watchdog = None
self.raw_reset_reasons = set()
cycle_s = self.get_config_item('program_cycle_s')
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
self.program_cycle_s = DEFAULT_CYCLE_PERIOD
self.test_steps_sequence = self.test_steps()
# Advance the coroutine to it's first yield statement.
self.test_steps_sequence.send(None)
def setup(self):
cycle_s = self.get_config_item('program_cycle_s')
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
self.register_callback(MSG_KEY_DEVICE_READY, self.cb_device_ready)
self.register_callback(MSG_KEY_RESET_REASON_RAW, self.cb_reset_reason_raw)
self.register_callback(MSG_KEY_RESET_REASON, self.cb_reset_reason)

View File

@ -47,10 +47,11 @@ class SyncOnReset(BaseHostTest):
def __init__(self):
super(SyncOnReset, self).__init__()
self.test_case_num = 0
cycle_s = self.get_config_item('program_cycle_s')
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
self.program_cycle_s = DEFAULT_CYCLE_PERIOD
def setup(self):
cycle_s = self.get_config_item('program_cycle_s')
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
self.register_callback(MSG_KEY_DEVICE_READY, self.cb_device_ready)
self.register_callback(MSG_KEY_DEVICE_RESET, self.cb_device_reset)

View File

@ -49,8 +49,7 @@ class WatchdogReset(BaseHostTest):
super(WatchdogReset, self).__init__()
self.current_case = TestCaseData(0, CASE_DATA_INVALID)
self.__handshake_timer = None
cycle_s = self.get_config_item('program_cycle_s')
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
self.program_cycle_s = DEFAULT_CYCLE_PERIOD
self.drop_heartbeat_messages = True
self.hb_timestamps_us = []
@ -94,6 +93,8 @@ class WatchdogReset(BaseHostTest):
self.current_case = TestCaseData(self.current_case.index, dev_data)
def setup(self):
cycle_s = self.get_config_item('program_cycle_s')
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
self.register_callback(MSG_KEY_DEVICE_READY, self.cb_device_ready)
self.register_callback(MSG_KEY_DEVICE_RESET, self.cb_device_reset)
self.register_callback(MSG_KEY_HEARTBEAT, self.cb_heartbeat)