Skip to content

Commit

Permalink
feat(modem): host test support of the latest ESP-IDF release
Browse files Browse the repository at this point in the history
  • Loading branch information
suren-gabrielyan-espressif committed Dec 7, 2023
1 parent 1bf6843 commit c9afe4a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/modem__build-host-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
if: contains(github.event.pull_request.labels.*.name, 'modem') || github.event_name == 'push'
uses: "./.github/workflows/run-host-tests.yml"
with:
idf_version: "release-v4.3"
idf_version: "latest"
app_name: "host_modem_test"
app_path: "esp-protocols/components/esp_modem/test/host_test"
component_path: "esp-protocols/components/esp_modem"
Expand Down
5 changes: 3 additions & 2 deletions components/esp_modem/test/host_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)

set(EXTRA_COMPONENT_DIRS # Add esp_modem component and linux port components
../..
../../port/linux)
../../port/linux
"$ENV{IDF_PATH}/tools/mocks/freertos/")

set(COMPONENTS main)
set(COMPONENTS esp_modem main)
project(host_modem_test)

idf_component_get_property(esp_modem esp_modem COMPONENT_LIB)
Expand Down
23 changes: 9 additions & 14 deletions components/esp_modem/test/host_test/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
idf_version=$1
component=$2

if [[ "$idf_version" == "release-v4.3" ]] && [[ "$component" == "esp_modem" ]]; then
lwip=lwip-2.1.2
lwip_uri=http://download.savannah.nongnu.org/releases/lwip
lwip_contrib=contrib-2.1.0
lwip=lwip-2.1.2
lwip_uri=http://download.savannah.nongnu.org/releases/lwip
lwip_contrib=contrib-2.1.0

wget --no-verbose ${lwip_uri}/${lwip}.zip
unzip -oq ${lwip}.zip
wget --no-verbose ${lwip_uri}/${lwip_contrib}.zip
unzip -oq ${lwip_contrib}.zip
wget --no-verbose ${lwip_uri}/${lwip}.zip
unzip -oq ${lwip}.zip
wget --no-verbose ${lwip_uri}/${lwip_contrib}.zip
unzip -oq ${lwip_contrib}.zip

apt-get update && apt-get install -y gcc-8 g++-8
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8
rm /usr/bin/gcov && ln -s /usr/bin/gcov-8 /usr/bin/gcov
export LWIP_PATH=`pwd`/$lwip
export LWIP_CONTRIB_PATH=`pwd`/$lwip_contrib
fi
export LWIP_PATH=`pwd`/$lwip
export LWIP_CONTRIB_PATH=`pwd`/$lwip_contrib
5 changes: 3 additions & 2 deletions components/esp_modem/test/host_test/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
idf_component_register(SRCS "test_modem.cpp" "LoopbackTerm.cpp"
INCLUDE_DIRS "$ENV{IDF_PATH}/tools/catch"
REQUIRES esp_modem)
REQUIRES esp_modem WHOLE_ARCHIVE)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(${COMPONENT_LIB} PRIVATE Threads::Threads)

target_link_libraries(${COMPONENT_LIB} PRIVATE Catch2WithMain)

set_target_properties(${COMPONENT_LIB} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
Expand Down
4 changes: 4 additions & 0 deletions components/esp_modem/test/host_test/main/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
espressif/catch2: "^3.4.0"
idf:
version: ">=5.0"
2 changes: 1 addition & 1 deletion components/esp_modem/test/host_test/main/test_modem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define CATCH_CONFIG_MAIN // This tells the catch header to generate a main
#include <memory>
#include <future>
#include "catch.hpp"
#include <catch2/catch_test_macros.hpp>
#include "cxx_include/esp_modem_api.hpp"
#include "LoopbackTerm.h"

Expand Down

0 comments on commit c9afe4a

Please sign in to comment.