forked from espressif/esp-protocols
fix(modem): Remove catch dependency
This commit is contained in:
@ -1,6 +1,5 @@
|
|||||||
idf_component_register(SRCS "pppd_test.cpp"
|
idf_component_register(SRCS "pppd_test.cpp"
|
||||||
"NetworkDCE.cpp"
|
"NetworkDCE.cpp"
|
||||||
INCLUDE_DIRS "$ENV{IDF_PATH}/tools/catch"
|
|
||||||
REQUIRES esp_modem)
|
REQUIRES esp_modem)
|
||||||
|
|
||||||
set_target_properties(${COMPONENT_LIB} PROPERTIES
|
set_target_properties(${COMPONENT_LIB} PROPERTIES
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
@ -17,9 +17,6 @@
|
|||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/event_groups.h"
|
#include "freertos/event_groups.h"
|
||||||
|
|
||||||
#define CATCH_CONFIG_MAIN
|
|
||||||
#include "catch.hpp"
|
|
||||||
|
|
||||||
static const char *TAG = "pppd_test";
|
static const char *TAG = "pppd_test";
|
||||||
static EventGroupHandle_t event_group = NULL;
|
static EventGroupHandle_t event_group = NULL;
|
||||||
|
|
||||||
@ -76,6 +73,9 @@ esp_err_t modem_init_network(esp_netif_t *netif);
|
|||||||
void modem_start_network();
|
void modem_start_network();
|
||||||
void modem_stop_network();
|
void modem_stop_network();
|
||||||
|
|
||||||
|
bool test_connect();
|
||||||
|
bool test_disconnect();
|
||||||
|
|
||||||
extern "C" void app_main(void)
|
extern "C" void app_main(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -99,41 +99,27 @@ extern "C" void app_main(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
modem_start_network();
|
modem_start_network();
|
||||||
Catch::Session session;
|
|
||||||
int numFailed = session.run();
|
bool t1 = test_connect();
|
||||||
if (numFailed > 0) {
|
bool t2 = test_disconnect();
|
||||||
ESP_LOGE(TAG, "Test FAILED!");
|
|
||||||
|
if (t1 && t2) {
|
||||||
|
ESP_LOGI(TAG, "All tests passed");
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGI(TAG, "Test passed!");
|
ESP_LOGE(TAG, "Test FAILED!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Connect test", "[esp_modem]")
|
bool test_connect() //("Connect test", "[esp_modem]")
|
||||||
{
|
{
|
||||||
EventBits_t b = xEventGroupWaitBits(event_group, 1, pdTRUE, pdFALSE, pdMS_TO_TICKS(15000));
|
EventBits_t b = xEventGroupWaitBits(event_group, 1, pdTRUE, pdFALSE, pdMS_TO_TICKS(15000));
|
||||||
CHECK(b == 1);
|
return b == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Disconnection test", "[esp_modem]")
|
bool test_disconnect() //("Disconnection test", "[esp_modem]")
|
||||||
{
|
{
|
||||||
modem_stop_network();
|
modem_stop_network();
|
||||||
EventBits_t b = xEventGroupWaitBits(event_group, 2, pdTRUE, pdFALSE, pdMS_TO_TICKS(15000));
|
EventBits_t b = xEventGroupWaitBits(event_group, 2, pdTRUE, pdFALSE, pdMS_TO_TICKS(15000));
|
||||||
CHECK(b == 2);
|
return b == 2;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
static void handle(int nr)
|
|
||||||
{
|
|
||||||
ESP_LOGE(TAG, "Signal handler %d", nr);
|
|
||||||
}
|
|
||||||
|
|
||||||
_sig_func_ptr signal (int nr, _sig_func_ptr)
|
|
||||||
{
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user