Commit 835d20b6 authored by Adam Wujek's avatar Adam Wujek

pytest/main_fw: check TMR_ERROR_CNT after each test

Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 42dcede5
...@@ -125,6 +125,9 @@ class monimod: ...@@ -125,6 +125,9 @@ class monimod:
data = self.pmbus_read_block_cmd(self.cmd_ids["TMR_ERROR_CNT"]) data = self.pmbus_read_block_cmd(self.cmd_ids["TMR_ERROR_CNT"])
return int.from_bytes(bytes(data), "little") return int.from_bytes(bytes(data), "little")
def clear_tmr(self):
data = self.pmbus_write_block_cmd(self.cmd_ids["TMR_ERROR_CNT"], [0,0,0,0])
def set_pec(self, pec_val): def set_pec(self, pec_val):
# Turn off PEC in Linux i2c driver if enabled. # Turn off PEC in Linux i2c driver if enabled.
# Setting PEC in Monimod is possible only with PEC disabled in # Setting PEC in Monimod is possible only with PEC disabled in
......
...@@ -102,6 +102,17 @@ def check_boot_mode(monimod_bus): ...@@ -102,6 +102,17 @@ def check_boot_mode(monimod_bus):
pytest.skip("Monimod not in main mode! Unable to switch to main mode!") pytest.skip("Monimod not in main mode! Unable to switch to main mode!")
warnings.warn(UserWarning("Monimod not in main mode! Switched to main mode.")) warnings.warn(UserWarning("Monimod not in main mode! Switched to main mode."))
# check the content of TMR_ERROR_CNT after each test
# clear TMR_ERROR_CNT if non zero
@pytest.fixture(scope="function", autouse=True)
def check_tmr(monimod_bus):
yield
TMR_val = monimod_bus.get_tmr()
if TMR_val != 0:
monimod_bus.clear_tmr()
assert TMR_val == 0, ("TMR_ERROR_CNT is not zero")
class TestFwMainRegAccess(object): class TestFwMainRegAccess(object):
@pytest.mark.check_uptime @pytest.mark.check_uptime
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment