Commit b89f0b1e authored by Adam Wujek's avatar Adam Wujek

pytest: fix testing long registers when an old data is the same as a test data

Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 1ca3af6d
Pipeline #5308 passed with stage
in 1 minute and 57 seconds
......@@ -269,7 +269,7 @@ class TestFwMainRegValues(object):
TMR_val = monimod_bus.get_tmr()
assert TMR_val == 0
@pytest.mark.parametrize("cmds, test_data", [# cmd, size
@pytest.mark.parametrize("cmds, test_data", [# cmd, #data
("TEMP_CURVE_POINTS", [0x02, 0x80, 0xda, 0x20, 0xeb, 0x20, 0xdb, 0x20, 0xf3, 0xc0, 0xdb, 0xe8, 0x03]),
("TEMP_CURVE_POINTS", [0x02, 0x11, 0x22, 0x33, 0x44, 0xaa, 0x5c, 0xee, 0x80, 0x99, 0xaa, 0xbb, 0xcc]),
("TEMP_MATRIX_ROW", [0x00, 0x02, 0xfa, 0x04, 0x05, 0x0c, 0x92]),
......@@ -280,6 +280,12 @@ class TestFwMainRegValues(object):
data_old = monimod_bus.pmbus_read_block_cmd(monimod_bus.cmd_ids[cmds])
# Use the same fan ID
data_new = [data_old[0]] + test_data[1:]
if data_new == data_old:
# If the old data is the same as a new one, increase last byte.
# Be careful with corrected value, because it has to be a valid
# number after conversion from linear to float then back from
# float to linear
data_new[-1] = data_new[-1] + 1
monimod_bus.pmbus_write_block_cmd(monimod_bus.cmd_ids[cmds], data_new)
data_new_read = monimod_bus.pmbus_read_block_cmd(monimod_bus.cmd_ids[cmds])
......
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