diff --git a/tools/test_apps/protocols/pppos/app_test.py b/tools/test_apps/protocols/pppos/app_test.py index 9111868e05..818fe17f5e 100644 --- a/tools/test_apps/protocols/pppos/app_test.py +++ b/tools/test_apps/protocols/pppos/app_test.py @@ -5,6 +5,7 @@ import socket import subprocess import ttfw_idf import time +import netifaces from threading import Thread, Event @@ -58,7 +59,13 @@ def test_examples_protocol_pppos_connect(env, extra_data): t = Thread(target=run_server, args=(server_stop, port, server_ip, client_ip)) t.start() try: - ip6_addr = dut1.expect(re.compile(r"Got IPv6 address ([0-9a-f\:]+)"), timeout=30)[0] + ppp_server_timeout = time.time() + 30 + while "ppp0" not in netifaces.interfaces(): + print("PPP server haven't yet setup its netif, list of active netifs:{}".format(netifaces.interfaces())) + time.sleep(0.5) + if time.time() > ppp_server_timeout: + raise ValueError("ENV_TEST_FAILURE: PPP server failed to setup ppp0 interface within timeout") + ip6_addr = dut1.expect(re.compile(r"Got IPv6 address (\w{4}\:\w{4}\:\w{4}\:\w{4}\:\w{4}\:\w{4}\:\w{4}\:\w{4})"), timeout=30)[0] print("IPv6 address of ESP: {}".format(ip6_addr)) dut1.expect(re.compile(r"Socket listening")) diff --git a/tools/test_apps/protocols/pppos/main/pppos_client_main.c b/tools/test_apps/protocols/pppos/main/pppos_client_main.c index 058257125d..568486df85 100644 --- a/tools/test_apps/protocols/pppos/main/pppos_client_main.c +++ b/tools/test_apps/protocols/pppos/main/pppos_client_main.c @@ -247,6 +247,8 @@ void app_main(void) ESP_LOGE(TAG, "IPv6 test failed!"); } + /* Wait for the PPP server to stop */ + vTaskDelay(30000 / portTICK_PERIOD_MS); ESP_ERROR_CHECK(esp_modem_stop_ppp(dte)); /* Destroy the netif adapter withe events, which internally frees also the esp-netif instance */ esp_modem_netif_clear_default_handlers(modem_netif_adapter);