Skip to content

Commit

Permalink
fix(ci): Fixed failing CI because of idf-build-apps v2.5
Browse files Browse the repository at this point in the history
- Upgraded class test_apps to v5.0
- Fixed idf-build-apps version to prevent future regressions
  • Loading branch information
tore-espressif committed Sep 27, 2024
1 parent dfcb08a commit 3243adc
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_run_test_app_usb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
shell: bash
run: |
. ${IDF_PATH}/export.sh
pip install idf-build-apps --upgrade
pip install idf-build-apps==2.4.3 --upgrade
export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes"
export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_idf_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
shell: bash
run: |
. ${IDF_PATH}/export.sh
pip install idf-component-manager==1.5.2 idf-build-apps --upgrade
pip install idf-component-manager==1.5.2 idf-build-apps==2.4.3 --upgrade
python .github/ci/override_managed_component.py esp_tinyusb device/esp_tinyusb ${IDF_PATH}/examples/peripherals/usb/device/tusb_*
cd ${IDF_PATH}
idf-build-apps find --path examples/peripherals/usb/device/ --recursive --target all --manifest-file examples/peripherals/.build-test-rules.yml
Expand Down
1 change: 0 additions & 1 deletion .idf_build_apps.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
target = "all"
exclude = [
"clang_tidy",
]
Expand Down
23 changes: 2 additions & 21 deletions host/class/cdc/usb_host_cdc_acm/test_app/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
include($ENV{IDF_PATH}/tools/cmake/version.cmake)
set (TINYUSB_LIB)
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
set(TINYUSB_LIB "esp_tinyusb")
else()
set(TINYUSB_LIB "tinyusb")
endif()

# TODO: once IDF_v4.4 is at the EOL support, use WHOLE_ARCHIVE
idf_component_register(SRCS "test_cdc_acm_host.c" "usb_device.c" "test_app_main.c"
INCLUDE_DIRS "."
REQUIRES usb_host_cdc_acm unity ${TINYUSB_LIB})

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE

# Due to the backward compatibility to IDFv4.4 (in which WHOLE_ARCHIVE is not implemented) we use following approach:
# Any non-static function test_app/main/*.c (apart from test_app_main.c) file is added as an undefined symbol
# because otherwise the linker will ignore test_app/main/*.c as it has no other files depending on any
# symbols in it.

# force-link test_cdc_acm_host.c
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u usb_lib_task")
REQUIRES usb_host_cdc_acm unity esp_tinyusb
WHOLE_ARCHIVE)
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Configure TinyUSB, it will be used to mock USB devices
CONFIG_TINYUSB=y
CONFIG_TINYUSB_MSC_ENABLED=n
CONFIG_TINYUSB_CDC_ENABLED=y
CONFIG_TINYUSB_CDC_COUNT=2
Expand Down
9 changes: 4 additions & 5 deletions host/class/hid/usb_host_hid/test_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)

set(EXTRA_COMPONENT_DIRS
../../usb_host_hid
../../../../../device/esp_tinyusb
)

# Set the components to include the tests for.
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
list(APPEND EXTRA_COMPONENT_DIRS ../../../../../device/esp_tinyusb)
endif()
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)

project(test_app_usb_host_hid)
project(test_app_usb_host_hid)
29 changes: 4 additions & 25 deletions host/class/hid/usb_host_hid/test_app/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
include($ENV{IDF_PATH}/tools/cmake/version.cmake)
set (TINYUSB_LIB)
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
set(TINYUSB_LIB "esp_tinyusb")
else()
set(TINYUSB_LIB "tinyusb")
endif()

# TODO: once IDF_v4.4 is at the EOL support, use WHOLE_ARCHIVE
idf_component_register(SRC_DIRS .
INCLUDE_DIRS .
REQUIRES unity usb usb_host_hid ${TINYUSB_LIB})

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE

# Due to the backward compatibility to IDFv4.4 (in which WHOLE_ARCHIVE is not implemented) we use following approach:
# Any non-static function test_app/main/*.c (apart from test_app_main.c) file is added as an undefined symbol
# because otherwise the linker will ignore test_app/main/*.c as it has no other files depending on any
# symbols in it.

# force-link test_hid_basic.c
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u test_hid_setup")
# force-link test_hid_err_handling.c
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u test_interface_callback_handler")
idf_component_register(SRC_DIRS .
INCLUDE_DIRS .
REQUIRES unity usb usb_host_hid esp_tinyusb
WHOLE_ARCHIVE)
1 change: 0 additions & 1 deletion host/class/hid/usb_host_hid/test_app/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Configure TinyUSB, it will be used to mock USB devices
CONFIG_TINYUSB=y
CONFIG_TINYUSB_MSC_ENABLED=n
CONFIG_TINYUSB_CDC_ENABLED=n
CONFIG_TINYUSB_CDC_COUNT=0
Expand Down
9 changes: 4 additions & 5 deletions host/class/msc/usb_host_msc/test_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)

set(EXTRA_COMPONENT_DIRS
../../usb_host_msc
../../../../../device/esp_tinyusb
)

# Set the components to include the tests for.
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
list(APPEND EXTRA_COMPONENT_DIRS ../../../../../device/esp_tinyusb)
endif()
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)

project(test_app_usb_host_msc)
project(test_app_usb_host_msc)
24 changes: 2 additions & 22 deletions host/class/msc/usb_host_msc/test_app/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
include($ENV{IDF_PATH}/tools/cmake/version.cmake)
set (TINYUSB_LIB)
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
set(TINYUSB_LIB "esp_tinyusb")
else()
set(TINYUSB_LIB "tinyusb")
endif()

# TODO: once IDF_v4.4 is at the EOL support, use WHOLE_ARCHIVE
idf_component_register(SRC_DIRS .
INCLUDE_DIRS .
REQUIRES unity usb usb_host_msc ${TINYUSB_LIB})

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE

# Due to the backward compatibility to IDFv4.4 (in which WHOLE_ARCHIVE is not implemented) we use following approach:
# Any non-static function test_app/main/*.c (apart from test_app_main.c) file is added as an undefined symbol
# because otherwise the linker will ignore test_app/main/*.c as it has no other files depending on any
# symbols in it.

# force-link test_msc.c - void function linker_hook created because:
# no non-static function
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u linker_hook")
REQUIRES unity usb usb_host_msc esp_tinyusb
WHOLE_ARCHIVE)
3 changes: 0 additions & 3 deletions host/class/msc/usb_host_msc/test_app/main/test_msc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

#if SOC_USB_OTG_SUPPORTED

// idf_component_register(WHOLE_ARCHIVE) backward compatibility to IDF_v4.4
void linker_hook(void) {};

static const char *TAG = "APP";

#define ESP_OK_ASSERT(exp) TEST_ASSERT_EQUAL(ESP_OK, exp)
Expand Down
1 change: 0 additions & 1 deletion host/class/msc/usb_host_msc/test_app/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Configure TinyUSB, it will be used to mock USB devices
CONFIG_TINYUSB=y
CONFIG_TINYUSB_MSC_ENABLED=y
CONFIG_TINYUSB_CDC_ENABLED=n
CONFIG_TINYUSB_CDC_COUNT=0
Expand Down
5 changes: 4 additions & 1 deletion host/class/uac/usb_host_uac/test_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ set(EXTRA_COMPONENT_DIRS
${EXTRA_COMPONENT_DIRS}
)

project(test_app_usb_host_uac)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)

project(test_app_usb_host_uac)
8 changes: 3 additions & 5 deletions host/class/uvc/usb_host_uvc/test_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ set(EXTRA_COMPONENT_DIRS
../../usb_host_uvc
)

# Set the components to include the tests for.
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
list(APPEND EXTRA_COMPONENT_DIRS ../../../../../device/esp_tinyusb)
endif()
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)

project(test_app_usb_host_uvc)
project(test_app_usb_host_uvc)
24 changes: 2 additions & 22 deletions host/class/uvc/usb_host_uvc/test_app/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
include($ENV{IDF_PATH}/tools/cmake/version.cmake)
set (TINYUSB_LIB)
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
set(TINYUSB_LIB "esp_tinyusb")
else()
set(TINYUSB_LIB "tinyusb")
endif()

# TODO: once IDF_v4.4 is at the EOL support, use WHOLE_ARCHIVE
idf_component_register(SRCS "test_uvc.c" "libusb_parse.c" "test_app_main.c"
INCLUDE_DIRS "." "../../private_include"
REQUIRES usb_host_uvc usb unity)

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE

# Due to the backward compatibility to IDFv4.4 (in which WHOLE_ARCHIVE is not implemented) we use following approach:
# Any non-static function from test_app/main/*.c (apart from test_app_main.c) file is added as an undefined symbol
# because otherwise the linker will ignore test_app/main/*.c as it has no other files depending on any
# symbols in it.

# force-link test_uvc.c - void function linker_hook created because:
# no non-static function
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u linker_hook")
REQUIRES usb_host_uvc usb unity
WHOLE_ARCHIVE)
3 changes: 0 additions & 3 deletions host/class/uvc/usb_host_uvc/test_app/main/test_uvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
int libusb_parse_configuration(struct libusb_config_descriptor *config, const uint8_t *buffer, int size);
void libusb_clear_config_descriptor(struct libusb_config_descriptor *config);

// idf_component_register(WHOLE_ARCHIVE) backward compatibility to IDF_v4.4
void linker_hook(void) {};

const uint8_t CANYON_CNE_CWC2[] = {
0x09, 0x02, 0x7d, 0x02, 0x04, 0x01, 0x00, 0x80, 0xfa, 0x08, 0x0b, 0x00, 0x02, 0x0e, 0x03, 0x00,
0x05, 0x09, 0x04, 0x00, 0x00, 0x01, 0x0e, 0x01, 0x00, 0x05, 0x0d, 0x24, 0x01, 0x00, 0x01, 0x4d,
Expand Down
1 change: 0 additions & 1 deletion host/class/uvc/usb_host_uvc/test_app/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Configure TinyUSB, it will be used to mock USB devices
CONFIG_TINYUSB=y
CONFIG_TINYUSB_MSC_ENABLED=n
CONFIG_TINYUSB_CDC_ENABLED=n
CONFIG_TINYUSB_CDC_COUNT=0
Expand Down

0 comments on commit 3243adc

Please sign in to comment.