mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ppp-test: check if ppp interface is active and IP address correct before starting the test
Addressing stability of pppos test: * listing active network interfaces for presence of "ppp0" interface * fixed IPv6 address regex to prevent ttfw accept partial address only (less than 8 octets) * workaround crash after exiting app_main()
This commit is contained in:
parent
28efe511f4
commit
b3749e38f9
@ -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"))
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user