diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 294fe3b05..3c5f6c535 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1686,6 +1686,38 @@ UT_016_04: - UT_T1_I2S - psram +UT_017_01: + <<: *unit_test_template + tags: + - ESP32_IDF + - UT_T2_1 + +UT_017_02: + <<: *unit_test_template + tags: + - ESP32_IDF + - UT_T2_1 + +UT_017_03: + <<: *unit_test_template + tags: + - ESP32_IDF + - UT_T2_1 + +UT_017_04: + <<: *unit_test_template + tags: + - ESP32_IDF + - UT_T2_1 + - psram + +UT_017_05: + <<: *unit_test_template + tags: + - ESP32_IDF + - UT_T2_1 + - 8Mpsram + UT_601_01: <<: *unit_test_template tags: diff --git a/components/esp32/test/test_wifi.c b/components/esp32/test/test_wifi.c index ec35ce5ad..833d5bbca 100644 --- a/components/esp32/test/test_wifi.c +++ b/components/esp32/test/test_wifi.c @@ -10,6 +10,7 @@ #include "esp_log.h" #include "nvs_flash.h" #include "test_utils.h" +#include "freertos/task.h" static const char* TAG = "test_wifi"; @@ -121,3 +122,68 @@ TEST_CASE("wifi stop and deinit","[wifi]") TEST_IGNORE_MESSAGE("this test case is ignored due to the critical memory leak of tcpip_adapter and event_loop."); } + +static void start_wifi_as_softap(void) +{ + wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); + cfg.nvs_enable = false; + + wifi_config_t w_config = { + .ap.ssid = "default_ssid", + .ap.password = "default_password", + .ap.ssid_len = 0, + .ap.channel = 1, + .ap.authmode = WIFI_AUTH_WPA2_PSK, + .ap.ssid_hidden = false, + .ap.max_connection = 4, + .ap.beacon_interval = 100, + }; + + TEST_ESP_OK(esp_wifi_init(&cfg)); + TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_AP)); + TEST_ESP_OK(esp_wifi_set_config(WIFI_IF_AP, &w_config)); + TEST_ESP_OK(esp_wifi_start()); + +} + +static void stop_wifi(void) +{ + TEST_ESP_OK(esp_wifi_stop()); + TEST_ESP_OK(esp_wifi_deinit()); +} + +static void receive_ds2ds_packet(void) +{ + start_wifi_as_softap(); + unity_wait_for_signal("sender ready"); + unity_send_signal("receiver ready"); + + // wait for sender to send packets + vTaskDelay(1000/portTICK_PERIOD_MS); + stop_wifi(); + +} + +static const char ds2ds_pdu[] = { + 0x48, 0x03, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xE8, 0x65, 0xD4, 0xCB, 0x74, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x60, 0x94, 0xE8, 0x65, 0xD4, 0xCB, 0x74, 0x1C, 0x26, 0xB9, + 0x0D, 0x02, 0x7D, 0x13, 0x00, 0x00, 0x01, 0xE8, 0x65, 0xD4, 0xCB, 0x74, + 0x1C, 0x00, 0x00, 0x26, 0xB9, 0x00, 0x00, 0x00, 0x00 +}; + +static void send_ds2ds_packet(void) +{ + start_wifi_as_softap(); + unity_send_signal("sender ready"); + unity_wait_for_signal("receiver ready"); + + // send packet 20 times to make sure receiver will get this packet + for (uint16_t i = 0; i < 20; i++) { + esp_wifi_80211_tx(ESP_IF_WIFI_AP, ds2ds_pdu, sizeof(ds2ds_pdu), true); + vTaskDelay(50 / portTICK_PERIOD_MS); + } + stop_wifi(); +} + +TEST_CASE_MULTIPLE_DEVICES("receive ds2ds packet without exception", "[wifi][test_env=UT_T2_1]", receive_ds2ds_packet, send_ds2ds_packet); diff --git a/tools/tiny-test-fw/DUT.py b/tools/tiny-test-fw/DUT.py index 88894fd49..899c7e885 100644 --- a/tools/tiny-test-fw/DUT.py +++ b/tools/tiny-test-fw/DUT.py @@ -530,7 +530,7 @@ class BaseDUT(object): data = BaseDUT.u_to_bytearray(data) match = pattern.search(data) if match: - ret = tuple(x.decode() for x in match.groups()) + ret = tuple(None if x is None else x.decode() for x in match.groups()) index = match.end() else: index = -1 diff --git a/tools/unit-test-app/unit_test.py b/tools/unit-test-app/unit_test.py index 1aae0315b..eb3005641 100755 --- a/tools/unit-test-app/unit_test.py +++ b/tools/unit-test-app/unit_test.py @@ -45,7 +45,7 @@ EXCEPTION_PATTERN = re.compile(r"(Guru Meditation Error: Core\s+\d panic'ed \([\ ABORT_PATTERN = re.compile(r"(abort\(\) was called at PC 0x[a-fA-F\d]{8} on core \d)") FINISH_PATTERN = re.compile(r"1 Tests (\d) Failures (\d) Ignored") END_LIST_STR = r'\r?\nEnter test for running' -TEST_PATTERN = re.compile(r'\((\d+)\)\s+"([^"]+)" ([^\r]+)\r?\n(' + END_LIST_STR + r')?') +TEST_PATTERN = re.compile(r'\((\d+)\)\s+"([^"]+)" ([^\r\n]+)\r?\n(' + END_LIST_STR + r')?') TEST_SUBMENU_PATTERN = re.compile(r'\s+\((\d+)\)\s+"[^"]+"\r?\n(?=(?=\()|(' + END_LIST_STR + r'))') SIMPLE_TEST_ID = 0