Skip to content

Commit

Permalink
ci(spi_nand_flash): run example and test on hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
igrr committed Oct 11, 2024
1 parent 692858b commit c8fb264
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/get_idf_build_apps_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def main():
print(f' - {file}')

modified_components = set()
excluded_dirs = ['.github', 'test_app']
excluded_dirs = ['.github']
for file in modified_files:
toplevel = file.split('/')[0]
if toplevel in excluded_dirs:
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/build_and_run_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ jobs:
*/examples/*/build_esp*/*.bin
*/examples/*/build_esp*/flasher_args.json
*/examples/*/build_esp*/config/sdkconfig.json
*/test_apps/**/build_esp*/bootloader/bootloader.bin
*/test_apps/**/build_esp*/partition_table/partition-table.bin
*/test_apps/**/build_esp*/*.bin
*/test_apps/**/build_esp*/flasher_args.json
*/test_apps/**/build_esp*/config/sdkconfig.json
*/test_app*/**/build_esp*/bootloader/bootloader.bin
*/test_app*/**/build_esp*/partition_table/partition-table.bin
*/test_app*/**/build_esp*/*.bin
*/test_app*/**/build_esp*/flasher_args.json
*/test_app*/**/build_esp*/config/sdkconfig.json
build_info*.json
run-target:
Expand All @@ -134,6 +134,9 @@ jobs:
- runs-on: "ESP32-ETHERNET-KIT"
marker: "ethernet"
target: "esp32"
- runs-on: "spi_nand_flash"
marker: "spi_nand_flash"
target: "esp32"
env:
TEST_RESULT_NAME: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }}
TEST_RESULT_FILE: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }}.xml
Expand All @@ -155,7 +158,7 @@ jobs:
run: |
python3 .github/get_pytest_args.py --target=${{ matrix.runner.target }} -v 'build_info*.json' pytest-args.txt
cat pytest-args.txt
pytest --suppress-no-test-exit-code $(cat pytest-args.txt) --ignore-glob '*/managed_components/*' --ignore=test_app --ignore=.github --junit-xml=${{ env.TEST_RESULT_FILE }} --target=${{ matrix.runner.target }} -m ${{ matrix.runner.marker }} --build-dir=build_${{ matrix.runner.target }}
pytest --suppress-no-test-exit-code $(cat pytest-args.txt) --ignore-glob '*/managed_components/*' --ignore=.github --junit-xml=${{ env.TEST_RESULT_FILE }} --target=${{ matrix.runner.target }} -m ${{ matrix.runner.marker }} --build-dir=build_${{ matrix.runner.target }}
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ markers =
# env markers
generic: generic runner
ethernet: ethernet runners
spi_nand_flash: runner with SPI NAND flash connected

# log related
log_cli = True
Expand Down
10 changes: 10 additions & 0 deletions spi_nand_flash/examples/nand_flash/pytest_nand_flash_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import pytest


@pytest.mark.spi_nand_flash
def test_nand_flash_example(dut) -> None:
dut.expect_exact("Opening file")
dut.expect_exact("File written")
dut.expect_exact("Reading file")
dut.expect_exact("Read from file:")
dut.expect_exact("Returned from app_main")
1 change: 1 addition & 0 deletions spi_nand_flash/examples/nand_flash/sdkconfig.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_EXAMPLE_FORMAT_IF_MOUNT_FAILED=y
6 changes: 6 additions & 0 deletions spi_nand_flash/test_app/pytest_spi_nand_flash.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import pytest


@pytest.mark.spi_nand_flash
def test_spi_nand_flash(dut) -> None:
dut.run_all_single_board_cases()

0 comments on commit c8fb264

Please sign in to comment.