Update such that tests pass for v1.2

This includes minor updates for the th different MCU variant, and bugfixes.

Resolves #7
This commit is contained in:
2020-06-03 04:51:19 +00:00
parent 0f0cb73fa5
commit cdf0f4ffc9
22 changed files with 649 additions and 57 deletions

View File

@@ -51,7 +51,7 @@ def logger():
def context_factory():
def create_context(
fw_rel_path: str,
mcu: str = "STM32L412RB",
mcu: str = "STM32L010C6",
addr: int = 0x8000000,
leave_halted: bool = False,
):
@@ -138,6 +138,7 @@ def test_set_time(context_factory, logger):
print("Text:", text.decode())
assert text.endswith(TEST_PASS_TEXT)
def test_periodic_alarms(context_factory, logger):
serial_dev, jlink = context_factory("Test/periodic_alarms.bin")
serial_dev.timeout = 6
@@ -175,7 +176,7 @@ def test_clock(context_factory, logger):
# TODO: Using a single pin, instead of UART, would make this more
# accurate. Add support via sigrok.
assert (delta - EXPECTED_RUNTIME) < TOLERANCE
assert abs(delta - EXPECTED_RUNTIME) < TOLERANCE
def test_wakeup_irq(context_factory, logger):
@@ -207,7 +208,7 @@ def test_wakeup_irq(context_factory, logger):
def test_stop(context_factory, logger):
serial_dev, jlink = context_factory("Test/stop.bin")
serial_dev.timeout = 65
serial_dev.timeout = 70
pattern = re.compile("Requested=(\\d*) Actual=(\\d*)")
while True:
@@ -229,6 +230,7 @@ def test_stop(context_factory, logger):
# Delays > 32sec have reduced resolution (1 sec)
assert abs(delta) < 1000
"sigrok-cli -C D3 -d fx2lafw -c samplerate=1M --time 1s -P timing:data=D3"
@@ -275,9 +277,10 @@ def measure_frequency(
return periods[::2], periods[1:][::2]
def test_lptim(context_factory, logger):
serial_dev, jlink = context_factory("Test/lptim.bin")
state0_periods, state1_periods = measure_frequency(1, "D1")
state0_periods, state1_periods = measure_frequency(1, "D0")
num_periods = min(len(state0_periods), len(state1_periods))
periods = [state0_periods[i] + state1_periods[i] for i in range(num_periods)]
freqs = list(map(lambda x: 1 / x, periods))