Exemple #1
0
def test_custom_bootloader_impl_example(app: IdfApp, dut: Dut) -> None:
    # Expect to read a message from the custom bootloader
    # This message is defined in the Kconfig file, retrieve it while deleting
    # leading and trailing quotes (")
    welcome_message = app.sdkconfig['EXAMPLE_BOOTLOADER_WELCOME_MESSAGE']
    dut.expect_exact(welcome_message)

    # Expect to read a message from the user application
    dut.expect_exact('Application started!')
def test_flash_suspend_example(dut: Dut) -> None:
    dut.expect_exact('found partition')
    res = dut.expect(r'During Erase, ISR callback function\(in flash\) response time:\s+(\d+(\.\d{1,2})) us')
    response_time = res.group(1).decode('utf8')
    assert 0 <= float(response_time) < 40

    res = dut.expect(r'During Erase, ISR callback function\(in iram\) response time:\s+(\d+(\.\d{1,2})) us')
    response_time = res.group(1).decode('utf8')
    assert 0 <= float(response_time) < 5
Exemple #3
0
def test_gptimer_example(dut: Dut) -> None:
    dut.expect_exact('install pcnt unit')
    dut.expect_exact('set glitch filter')
    dut.expect_exact('install pcnt channels')
    dut.expect_exact('set edge and level actions for pcnt channels')
    dut.expect_exact('add watch points and register callbacks')
    dut.expect_exact('clear pcnt unit')
    dut.expect_exact('start pcnt unit')
    res = dut.expect(r'Pulse count: (\d+)')
    count_val = res.group(1).decode('utf8')
    assert -100 <= int(count_val) <= 100
Exemple #4
0
def test_temp_sensor_example(dut: Dut) -> None:
    dut.expect_exact('Install temperature sensor')
    dut.expect_exact('Enable temperature sensor')
    dut.expect_exact('Read temperature')
    temp_value = dut.expect(r'Temperature value (\d+\.\d+) .*', timeout=5)
    # Because the example test only run in the normal temperature environment. So this assert range is meaningful
    assert 0 < float(temp_value.group(1).decode('utf8')) < 50
    temp_value = dut.expect(r'Temperature value (\d+\.\d+) .*', timeout=5)
    assert 0 < float(temp_value.group(1).decode('utf8')) < 50
def test_custom_bootloader_hooks_example(dut: Dut) -> None:
    # Expect to read both hooks messages
    dut.expect_exact('This hook is called BEFORE bootloader initialization')
    dut.expect_exact('This hook is called AFTER bootloader initialization')
Exemple #6
0
def test_temp_sensor_example(dut: Dut) -> None:
    dut.expect_exact('Initializing Temperature sensor')
    dut.expect_exact('Temperature sensor started')
    temp_value = dut.expect(r'Temperature out celsius (\d+\.\d+)', timeout=30)
    # Because the example test only run in the normal temperature environment. So this assert range is meaningful
    assert 0 < float(temp_value.group(1)) < 45