From d69c11e01749b3f955c12036a97b894e3ff247e8 Mon Sep 17 00:00:00 2001 From: AndriiFilippov Date: Thu, 3 Feb 2022 17:23:29 +0100 Subject: [PATCH] ci/esp_eth: Replaced ethernet download task with ethernet download function Rename eth_download_task to eth_start_download. Remove eth_event_group's download bit Delete unused variables --- components/esp_eth/test/test_emac.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/components/esp_eth/test/test_emac.c b/components/esp_eth/test/test_emac.c index 404a4ab082..7c2bef237e 100644 --- a/components/esp_eth/test/test_emac.c +++ b/components/esp_eth/test/test_emac.c @@ -20,7 +20,6 @@ static const char *TAG = "esp32_eth_test"; #define ETH_STOP_BIT BIT(1) #define ETH_CONNECT_BIT BIT(2) #define ETH_GOT_IP_BIT BIT(3) -#define ETH_DOWNLOAD_END_BIT BIT(4) #define ETH_START_TIMEOUT_MS (10000) #define ETH_CONNECT_TIMEOUT_MS (40000) @@ -468,9 +467,8 @@ esp_err_t http_event_handle(esp_http_client_event_t *evt) return ESP_OK; } -static void eth_download_task(void *param) +static void eth_start_download(void) { - EventGroupHandle_t eth_event_group = (EventGroupHandle_t)param; esp_rom_md5_init(&md5_context); esp_http_client_config_t config = { .url = "https://dl.espressif.com/dl/misc/2MB.bin", @@ -483,8 +481,6 @@ static void eth_download_task(void *param) TEST_ESP_OK(esp_http_client_perform(client)); TEST_ESP_OK(esp_http_client_cleanup(client)); esp_rom_md5_final(digest, &md5_context); - xEventGroupSetBits(eth_event_group, ETH_DOWNLOAD_END_BIT); - vTaskDelete(NULL); } TEST_CASE("esp32 ethernet download test", "[ethernet][test_env=UT_T2_Ethernet][timeout=240]") @@ -518,10 +514,7 @@ TEST_CASE("esp32 ethernet download test", "[ethernet][test_env=UT_T2_Ethernet][t bits = xEventGroupWaitBits(eth_event_group, ETH_GOT_IP_BIT, true, true, pdMS_TO_TICKS(ETH_GET_IP_TIMEOUT_MS)); TEST_ASSERT((bits & ETH_GOT_IP_BIT) == ETH_GOT_IP_BIT); - xTaskCreate(eth_download_task, "eth_dl", 4096, eth_event_group, tskIDLE_PRIORITY + 2, NULL); - /* wait for download end */ - bits = xEventGroupWaitBits(eth_event_group, ETH_DOWNLOAD_END_BIT, true, true, pdMS_TO_TICKS(ETH_DOWNLOAD_END_TIMEOUT_MS)); - TEST_ASSERT_EQUAL(ETH_DOWNLOAD_END_BIT, bits & ETH_DOWNLOAD_END_BIT); + eth_start_download(); // check MD5 digest // MD5: df61db8564d145bbe67112aa8ecdccd8 uint8_t expect_digest[16] = {223, 97, 219, 133, 100, 209, 69, 187, 230, 113, 18, 170, 142, 205, 204, 216};