Skip to content

Commit 9e24739

Browse files
committed
Merge branch 'ci/linux_host_test_with_pytest' into 'master'
CI: Linux host test with pytest Closes IDFCI-1571 See merge request espressif/esp-idf!21907
2 parents 46a1165 + 51adb9a commit 9e24739

File tree

24 files changed

+247
-153
lines changed

24 files changed

+247
-153
lines changed

.gitlab/ci/build.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ build_pytest_examples_esp32:
176176
extends:
177177
- .build_pytest_no_jtag_template
178178
- .rules:build:example_test-esp32
179-
parallel: 4
179+
parallel: 6
180180
variables:
181181
IDF_TARGET: esp32
182182
TEST_DIR: examples
@@ -203,7 +203,7 @@ build_pytest_examples_esp32c3:
203203
extends:
204204
- .build_pytest_no_jtag_template
205205
- .rules:build:example_test-esp32c3
206-
parallel: 3
206+
parallel: 4
207207
variables:
208208
IDF_TARGET: esp32c3
209209
TEST_DIR: examples
@@ -212,6 +212,7 @@ build_pytest_examples_esp32c2:
212212
extends:
213213
- .build_pytest_no_jtag_template
214214
- .rules:build:example_test-esp32c2
215+
parallel: 2
215216
variables:
216217
IDF_TARGET: esp32c2
217218
TEST_DIR: examples
@@ -244,6 +245,7 @@ build_pytest_examples_esp32c6:
244245
extends:
245246
- .build_pytest_template
246247
- .rules:build:example_test-esp32c6
248+
parallel: 2
247249
variables:
248250
IDF_TARGET: esp32c6
249251
TEST_DIR: examples
@@ -252,7 +254,7 @@ build_pytest_components_esp32:
252254
extends:
253255
- .build_pytest_template
254256
- .rules:build:component_ut-esp32
255-
parallel: 2
257+
parallel: 5
256258
variables:
257259
IDF_TARGET: esp32
258260
TEST_DIR: components
@@ -261,7 +263,7 @@ build_pytest_components_esp32s2:
261263
extends:
262264
- .build_pytest_template
263265
- .rules:build:component_ut-esp32s2
264-
parallel: 2
266+
parallel: 4
265267
variables:
266268
IDF_TARGET: esp32s2
267269
TEST_DIR: components
@@ -270,7 +272,7 @@ build_pytest_components_esp32s3:
270272
extends:
271273
- .build_pytest_template
272274
- .rules:build:component_ut-esp32s3
273-
parallel: 2
275+
parallel: 4
274276
variables:
275277
IDF_TARGET: esp32s3
276278
TEST_DIR: components
@@ -279,7 +281,7 @@ build_pytest_components_esp32c3:
279281
extends:
280282
- .build_pytest_template
281283
- .rules:build:component_ut-esp32c3
282-
parallel: 2
284+
parallel: 4
283285
variables:
284286
IDF_TARGET: esp32c3
285287
TEST_DIR: components
@@ -288,6 +290,7 @@ build_pytest_components_esp32c2:
288290
extends:
289291
- .build_pytest_template
290292
- .rules:build:component_ut-esp32c2
293+
parallel: 3
291294
variables:
292295
IDF_TARGET: esp32c2
293296
TEST_DIR: components
@@ -296,6 +299,7 @@ build_pytest_components_esp32c6:
296299
extends:
297300
- .build_pytest_template
298301
- .rules:build:component_ut-esp32c6
302+
parallel: 3
299303
variables:
300304
IDF_TARGET: esp32c6
301305
TEST_DIR: components
@@ -304,7 +308,7 @@ build_non_test_components_apps:
304308
extends:
305309
- .build_cmake_template
306310
- .rules:build:component_ut
307-
parallel: 2
311+
parallel: 5
308312
script:
309313
- set_component_ut_vars
310314
# CI specific options start from "--collect-size-info xxx". could ignore when running locally
@@ -358,6 +362,7 @@ build_pytest_test_apps_esp32s3:
358362
extends:
359363
- .build_pytest_test_apps_template
360364
- .rules:build:custom_test-esp32s3
365+
parallel: 2
361366
variables:
362367
IDF_TARGET: esp32s3
363368
TEST_DIR: tools/test_apps
@@ -519,15 +524,13 @@ build_esp_idf_tests_cmake_esp32:
519524
extends:
520525
- .build_esp_idf_tests_cmake_template
521526
- .rules:build:unit_test-esp32
522-
parallel: 2
523527
variables:
524528
IDF_TARGET: esp32
525529

526530
build_esp_idf_tests_cmake_esp32s2:
527531
extends:
528532
- .build_esp_idf_tests_cmake_template
529533
- .rules:build:unit_test-esp32s2
530-
parallel: 2
531534
variables:
532535
IDF_TARGET: esp32s2
533536

@@ -563,7 +566,7 @@ build_examples_cmake_esp32:
563566
extends:
564567
- .build_cmake_template
565568
- .rules:build:example_test-esp32
566-
parallel: 9
569+
parallel: 8
567570
variables:
568571
IDF_TARGET: esp32
569572
TEST_DIR: examples
@@ -572,7 +575,7 @@ build_examples_cmake_esp32s2:
572575
extends:
573576
- .build_cmake_template
574577
- .rules:build:example_test-esp32s2
575-
parallel: 6
578+
parallel: 7
576579
variables:
577580
IDF_TARGET: esp32s2
578581
TEST_DIR: examples
@@ -590,7 +593,7 @@ build_examples_cmake_esp32c2:
590593
extends:
591594
- .build_cmake_template
592595
- .rules:build:example_test-esp32c2
593-
parallel: 4
596+
parallel: 6
594597
variables:
595598
IDF_TARGET: esp32c2
596599
TEST_DIR: examples
@@ -616,7 +619,7 @@ build_examples_cmake_esp32c6:
616619
extends:
617620
- .build_cmake_template
618621
- .rules:build:example_test-esp32c6
619-
parallel: 4
622+
parallel: 6
620623
variables:
621624
IDF_TARGET: esp32c6
622625
TEST_DIR: examples

.gitlab/ci/host-test.yml

Lines changed: 23 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ test_nvs_on_host:
2020
- cd components/nvs_flash/test_nvs_host
2121
- make test
2222

23-
test_nvs_on_host_cmake:
24-
extends: .host_test_template
25-
script:
26-
- cd ${IDF_PATH}/components/nvs_flash/host_test/nvs_host_test
27-
- idf.py build
28-
- build/nvs_host_test.elf
29-
3023
test_nvs_coverage:
3124
extends:
3225
- .host_test_template
@@ -340,132 +333,20 @@ test_split_path_by_spaces:
340333
- cd ${IDF_PATH}/tools
341334
- python -m unittest split_paths_by_spaces.py
342335

343-
test_nvs_page:
344-
extends: .host_test_template
345-
script:
346-
- cd ${IDF_PATH}/components/nvs_flash/host_test/nvs_page_test
347-
- idf.py build
348-
- build/test_nvs_page_host.elf
349-
350336
test_mqtt_on_host:
351337
extends: .host_test_template
352338
script:
353339
- cd ${IDF_PATH}/components/mqtt/esp-mqtt/host_test
354340
- idf.py build
355341
- LSAN_OPTIONS=verbosity=1:log_threads=1 build/host_mqtt_client_test.elf
356342

357-
test_log:
358-
extends: .host_test_template
359-
script:
360-
- cd ${IDF_PATH}/components/log/host_test/log_test
361-
- idf.py build
362-
- build/test_log_host.elf
363-
364-
test_esp_event:
365-
extends: .host_test_template
366-
script:
367-
- cd ${IDF_PATH}/components/esp_event/host_test/esp_event_unit_test
368-
- idf.py build
369-
- build/test_esp_event_host.elf
370-
371-
test_hello_world_linux_compatible_example:
372-
extends: .host_test_template
373-
script:
374-
- cd ${IDF_PATH}/tools/test_apps/linux_compatible/hello_world_linux_compatible
375-
- idf.py --preview set-target linux
376-
- idf.py build
377-
- timeout 15 build/hello_world.elf | tee test.txt
378-
- grep "Hello world!" test.txt
379-
380-
test_esp_system:
381-
extends: .host_test_template
382-
script:
383-
- cd ${IDF_PATH}/components/esp_system/host_test/test_esp_system/
384-
- idf.py build
385-
- echo "*" | timeout 5 build/test_esp_system.elf | tee log.txt || true
386-
- grep "6 Tests 0 Failures 0 Ignored" log.txt
387-
388-
test_heap_linux:
389-
extends: .host_test_template
390-
script:
391-
- cd ${IDF_PATH}/components/heap/host_test/host_test_linux/
392-
- idf.py build
393-
- echo "*" | timeout 5 build/test_heap.elf | tee log.txt || true
394-
- grep "4 Tests 0 Failures 0 Ignored" log.txt
395-
396-
test_esp_hw_support_linux:
397-
extends: .host_test_template
398-
script:
399-
- cd ${IDF_PATH}/components/esp_hw_support/host_test/host_test_linux/
400-
- idf.py build
401-
- echo "*" | timeout 5 build/test_hw_support_linux.elf | tee log.txt || true
402-
- grep "2 Tests 0 Failures 0 Ignored" log.txt
403-
404-
test_esp_timer_cxx:
405-
extends: .host_test_template
406-
script:
407-
- cd ${IDF_PATH}/examples/cxx/experimental/experimental_cpp_component/host_test/esp_timer
408-
- idf.py build
409-
- build/test_esp_timer_cxx_host.elf
410-
411343
test_eh_frame_parser:
412344
extends: .host_test_template
413345
script:
414346
- cd ${IDF_PATH}/components/esp_system/test_eh_frame_parser
415347
- make
416348
- ./eh_frame_test
417349

418-
test_rom_on_linux_works:
419-
extends: .host_test_template
420-
script:
421-
- cd ${IDF_PATH}/components/esp_rom/host_test/rom_test
422-
- idf.py build
423-
- build/test_rom_host.elf
424-
425-
test_cxx_gpio:
426-
extends: .host_test_template
427-
script:
428-
- cd ${IDF_PATH}/examples/cxx/experimental/experimental_cpp_component/host_test/gpio
429-
- idf.py build
430-
- build/test_gpio_cxx_host.elf
431-
432-
test_i2c_cxx:
433-
extends: .host_test_template
434-
script:
435-
- cd ${IDF_PATH}/examples/cxx/experimental/experimental_cpp_component/host_test/i2c
436-
- idf.py build
437-
- build/test_i2c_cxx_host.elf
438-
439-
test_spi_cxx:
440-
extends: .host_test_template
441-
script:
442-
- cd ${IDF_PATH}/examples/cxx/experimental/experimental_cpp_component/host_test/spi
443-
- idf.py build
444-
- build/test_spi_cxx_host.elf
445-
446-
test_system_cxx:
447-
extends: .host_test_template
448-
script:
449-
- cd ${IDF_PATH}/examples/cxx/experimental/experimental_cpp_component/host_test/system
450-
- idf.py build
451-
- build/test_system_cxx_host.elf
452-
453-
test_partition_api_host:
454-
extends: .host_test_template
455-
script:
456-
- cd ${IDF_PATH}/components/esp_partition/host_test/partition_api_test
457-
- idf.py build
458-
- timeout 5 ./build/partition_api_test.elf | tee test.txt
459-
- grep " 0 Failures" test.txt
460-
461-
test_spiffs_host:
462-
extends: .host_test_template
463-
script:
464-
- cd ${IDF_PATH}/components/spiffs/host_test
465-
- idf.py build
466-
- timeout 5 ./build/host_test_spiffs.elf | tee test.txt
467-
- grep " 0 Failures" test.txt
468-
469350
test_gen_soc_caps_kconfig:
470351
extends: .host_test_template
471352
script:
@@ -497,3 +378,26 @@ test_pytest_qemu:
497378
--embedded-services idf,qemu
498379
--junitxml=XUNIT_RESULT.xml
499380
--known-failure-cases-file known_failure_cases/known_failure_cases.txt
381+
382+
test_pytest_linux:
383+
extends:
384+
- .host_test_template
385+
artifacts:
386+
when: always
387+
paths:
388+
- XUNIT_RESULT.xml
389+
- pytest_embedded_log/
390+
reports:
391+
junit: XUNIT_RESULT.xml
392+
expire_in: 1 week
393+
script:
394+
# TODO: fix the warnings in build flags and ignore-warning-str: IDF-6637
395+
# Record the warnings regexes in file tools/ci/ignore_build_warnings_linux.txt to avoid using parentheses and
396+
# doublequotes with bash.
397+
# Please remove that file while fixing all the warnings.
398+
- run_cmd python tools/ci/ci_build_apps.py components examples tools/test_apps -vv
399+
--target linux
400+
--pytest-apps
401+
-m host_test
402+
--ignore-warning-file tools/ci/ignore_build_warnings_linux.txt
403+
- run_cmd pytest --target linux -m host_test --junitxml=XUNIT_RESULT.xml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
2+
# SPDX-License-Identifier: Unlicense OR CC0-1.0
3+
import pytest
4+
from pytest_embedded import Dut
5+
6+
7+
@pytest.mark.linux
8+
@pytest.mark.host_test
9+
def test_esp_event_linux(dut: Dut) -> None:
10+
dut.expect_exact('All tests passed', timeout=5)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
2+
# SPDX-License-Identifier: Unlicense OR CC0-1.0
3+
import pytest
4+
from pytest_embedded import Dut
5+
6+
7+
@pytest.mark.linux
8+
@pytest.mark.host_test
9+
def test_esp_hw_support_linux(dut: Dut) -> None:
10+
dut.expect_exact('Press ENTER to see the list of tests.')
11+
dut.write('*')
12+
dut.expect_unity_test_output(timeout=5)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
2+
# SPDX-License-Identifier: Unlicense OR CC0-1.0
3+
import pytest
4+
from pytest_embedded import Dut
5+
6+
7+
@pytest.mark.linux
8+
@pytest.mark.host_test
9+
def test_esp_partition_linux(dut: Dut) -> None:
10+
dut.expect_unity_test_output(timeout=5)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
2+
# SPDX-License-Identifier: Unlicense OR CC0-1.0
3+
import pytest
4+
from pytest_embedded import Dut
5+
6+
7+
@pytest.mark.linux
8+
@pytest.mark.host_test
9+
def test_esp_rom_linux(dut: Dut) -> None:
10+
dut.expect_exact('All tests passed', timeout=5)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
2+
# SPDX-License-Identifier: Unlicense OR CC0-1.0
3+
import pytest
4+
from pytest_embedded import Dut
5+
6+
7+
@pytest.mark.linux
8+
@pytest.mark.host_test
9+
def test_esp_system_linux(dut: Dut) -> None:
10+
dut.expect_exact('Press ENTER to see the list of tests.')
11+
dut.write('*')
12+
dut.expect_unity_test_output(timeout=10)

0 commit comments

Comments
 (0)