ci: add qemu example

This commit is contained in:
Fu Hanxi
2022-05-18 14:59:34 +08:00
parent 7e71c0cff2
commit 4746a71028
9 changed files with 89 additions and 39 deletions

View File

@@ -24,12 +24,10 @@ Below is short explanation of remaining files in the project folder.
```
├── CMakeLists.txt
├── example_test.py Python script used for automated example testing
├── pytest_hello_world.py Python script used for automated testing
├── main
   ├── CMakeLists.txt
   ├── component.mk Component make file
│   └── hello_world_main.c
├── Makefile Makefile used by legacy GNU Make
├── CMakeLists.txt
└── hello_world_main.c
└── README.md This is the file you are currently reading
```

View File

@@ -1,20 +0,0 @@
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals
import ttfw_idf
@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32'])
def test_examples_hello_world(env, extra_data):
app_name = 'hello_world'
dut = env.get_dut(app_name, 'examples/get-started/hello_world')
dut.start_app()
res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE)
if not res:
raise ValueError('Maximum heap size info not found')
ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0])
if __name__ == '__main__':
test_examples_hello_world()

View File

@@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
from typing import Callable
import pytest
from pytest_embedded_idf.dut import IdfDut
from pytest_embedded_qemu.dut import QemuDut
@pytest.mark.supported_targets
@pytest.mark.generic
def test_hello_world(dut: IdfDut, log_minimum_free_heap_size: Callable[..., None]) -> None:
dut.expect('Hello world!')
log_minimum_free_heap_size()
@pytest.mark.esp32 # we only support qemu on esp32 for now
@pytest.mark.host_test
@pytest.mark.qemu
def test_hello_world_host(dut: QemuDut) -> None:
dut.expect('Hello world!')