diff --git a/.build-test-rules.yml b/.build-test-rules.yml index b44c0599..de510803 100644 --- a/.build-test-rules.yml +++ b/.build-test-rules.yml @@ -5,3 +5,7 @@ device/esp_tinyusb: host/class: enable: - if: SOC_USB_OTG_SUPPORTED == 1 + +host/class/cdc/usb_host_cdc_acm/host_test: + enable: + - if: IDF_TARGET in ["linux"] diff --git a/.github/workflows/build_and_run_test_app_usb.yml b/.github/workflows/build_and_run_test_app_usb.yml index c43bccbe..aaae54b7 100644 --- a/.github/workflows/build_and_run_test_app_usb.yml +++ b/.github/workflows/build_and_run_test_app_usb.yml @@ -29,6 +29,10 @@ jobs: export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}" idf-build-apps find idf-build-apps build + - name: Run Host tests + run: | + pip install pytest pytest-cpp + pytest host/class/cdc/usb_host_cdc_acm/host_test/build_linux - uses: actions/upload-artifact@v4 with: name: usb_test_app_bin_${{ matrix.idf_ver }} @@ -63,4 +67,4 @@ jobs: PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi/" run: pip install --only-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pyserial pyusb - name: Run USB Test App on target - run: pytest --target=${{ matrix.idf_target }} -m usb_host --build-dir=build_${{ matrix.idf_target }} + run: pytest --embedded-services esp,idf --target=${{ matrix.idf_target }} -m usb_host --build-dir=build_${{ matrix.idf_target }} diff --git a/host/class/cdc/usb_host_cdc_acm/host_test/CMakeLists.txt b/host/class/cdc/usb_host_cdc_acm/host_test/CMakeLists.txt index f2429fe3..460a5156 100644 --- a/host/class/cdc/usb_host_cdc_acm/host_test/CMakeLists.txt +++ b/host/class/cdc/usb_host_cdc_acm/host_test/CMakeLists.txt @@ -5,6 +5,7 @@ set(COMPONENTS main) list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/usb/" + "$ENV{IDF_PATH}/tools/mocks/freertos/" ) -project(usb_cdc_host_test) +project(host_test_usb_cdc) diff --git a/host/class/cdc/usb_host_cdc_acm/host_test/main/CMakeLists.txt b/host/class/cdc/usb_host_cdc_acm/host_test/main/CMakeLists.txt index b0cb9e77..6fa86b66 100644 --- a/host/class/cdc/usb_host_cdc_acm/host_test/main/CMakeLists.txt +++ b/host/class/cdc/usb_host_cdc_acm/host_test/main/CMakeLists.txt @@ -3,3 +3,7 @@ idf_component_register(SRC_DIRS . INCLUDE_DIRS . PRIV_INCLUDE_DIRS "../../private_include" WHOLE_ARCHIVE) + +# Currently 'main' for IDF_TARGET=linux is defined in freertos component. +# Since we are using a freertos mock here, need to let Catch2 provide 'main'. +target_link_libraries(${COMPONENT_LIB} PRIVATE Catch2WithMain) diff --git a/host/class/cdc/usb_host_cdc_acm/host_test/main/cdc_descriptors.hpp b/host/class/cdc/usb_host_cdc_acm/host_test/main/cdc_descriptors.hpp index 832791f5..1bafa042 100644 --- a/host/class/cdc/usb_host_cdc_acm/host_test/main/cdc_descriptors.hpp +++ b/host/class/cdc/usb_host_cdc_acm/host_test/main/cdc_descriptors.hpp @@ -20,12 +20,12 @@ - ASIX Electronics Corp. AX88772B (i-tec) - Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter (AXAGON) - Modems: - - Qualcomm / Option SimTech SIM7080 (SIM7070G) + - NOT TESTED: Qualcomm / Option SimTech SIM7080 (SIM7070G) - Quectel Wireless Solutions Co., Ltd. BG96 CAT-M1/NB-IoT modem - - Qualcomm / Option SimTech SIM7000 (SIM7000E) - Qualcomm / Option SimTech, Incorporated (SIM7600E) - - Qualcomm / Option SimTech SIM7080 (SIM7080G) - - Qualcomm / Option A76XX Series LTE Module (SIMA7672E) + - NOT TESTED: Qualcomm / Option SimTech SIM7000 (SIM7000E) + - NOT TESTED: Qualcomm / Option SimTech SIM7080 (SIM7080G) + - NOT TESTED: Qualcomm / Option A76XX Series LTE Module (SIMA7672E) - USB dongle: - NOT TESTED: Shenzhen Rapoo Technology Co., Ltd. Rapoo 2.4G Wireless Device - NOT TESTED: Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) diff --git a/host/class/cdc/usb_host_cdc_acm/host_test/sdkconfig.defaults b/host/class/cdc/usb_host_cdc_acm/host_test/sdkconfig.defaults index 2c101e76..14bc2aef 100644 --- a/host/class/cdc/usb_host_cdc_acm/host_test/sdkconfig.defaults +++ b/host/class/cdc/usb_host_cdc_acm/host_test/sdkconfig.defaults @@ -5,5 +5,4 @@ CONFIG_IDF_TARGET="linux" CONFIG_COMPILER_CXX_EXCEPTIONS=y CONFIG_ESP_MAIN_TASK_STACK_SIZE=12000 CONFIG_FREERTOS_HZ=1000 -CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n diff --git a/pytest.ini b/pytest.ini index 1f07f269..dc82314c 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,11 +1,11 @@ [pytest] # only the files with prefix `pytest_` would be recognized as pytest test scripts. python_files = pytest_*.py +cpp_files = host_test_*.elf # set traceback to "short" to prevent the overwhelming tracebacks addopts = -s - --embedded-services esp,idf --tb short markers =