Merge branch 'feature/add_ota_resumption_testcase_for_ethernet' into 'master'

feat: added test for ota resumption over ethernet

Closes IDF-12086

See merge request espressif/esp-idf!37237
This commit is contained in:
Mahavir Jain
2025-03-11 18:36:09 +08:00
3 changed files with 26 additions and 40 deletions

View File

@@ -167,7 +167,7 @@ def test_examples_protocol_advanced_https_ota_example(dut: Dut) -> None:
thread1.terminate() thread1.terminate()
@pytest.mark.wifi_router @pytest.mark.ethernet_ota
@pytest.mark.parametrize('config', ['ota_resumption'], indirect=True) @pytest.mark.parametrize('config', ['ota_resumption'], indirect=True)
@idf_parametrize('target', ['esp32'], indirect=['target']) @idf_parametrize('target', ['esp32'], indirect=['target'])
def test_examples_protocol_advanced_https_ota_example_ota_resumption(dut: Dut) -> None: def test_examples_protocol_advanced_https_ota_example_ota_resumption(dut: Dut) -> None:
@@ -193,13 +193,6 @@ def test_examples_protocol_advanced_https_ota_example_ota_resumption(dut: Dut) -
# start test # start test
dut.expect('Loaded app from partition at offset', timeout=30) dut.expect('Loaded app from partition at offset', timeout=30)
if dut.app.sdkconfig.get('EXAMPLE_WIFI_SSID_PWD_FROM_STDIN') is True:
dut.expect('Please input ssid password:')
env_name = 'wifi_router'
ap_ssid = get_env_config_variable(env_name, 'ap_ssid')
ap_password = get_env_config_variable(env_name, 'ap_password')
dut.write(f'{ap_ssid} {ap_password}')
try: try:
ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode() ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()
print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) print('Connected to AP/Ethernet with IP: {}'.format(ip_address))
@@ -213,7 +206,7 @@ def test_examples_protocol_advanced_https_ota_example_ota_resumption(dut: Dut) -
dut.write('https://' + host_ip + ':' + str(server_port) + '/' + bin_name) dut.write('https://' + host_ip + ':' + str(server_port) + '/' + bin_name)
dut.expect('Starting OTA...', timeout=60) dut.expect('Starting OTA...', timeout=60)
restart_device_with_random_delay(dut, 10, 30) restart_device_with_random_delay(dut, 5, 15)
thread1.terminate() thread1.terminate()
# Start server # Start server
@@ -224,13 +217,6 @@ def test_examples_protocol_advanced_https_ota_example_ota_resumption(dut: Dut) -
# Validate that the device restarts correctly # Validate that the device restarts correctly
dut.expect('Loaded app from partition at offset', timeout=180) dut.expect('Loaded app from partition at offset', timeout=180)
if dut.app.sdkconfig.get('EXAMPLE_WIFI_SSID_PWD_FROM_STDIN') is True:
dut.expect('Please input ssid password:')
env_name = 'wifi_router'
ap_ssid = get_env_config_variable(env_name, 'ap_ssid')
ap_password = get_env_config_variable(env_name, 'ap_password')
dut.write(f'{ap_ssid} {ap_password}')
try: try:
ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode() ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()
print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) print('Connected to AP/Ethernet with IP: {}'.format(ip_address))
@@ -681,7 +667,7 @@ def test_examples_protocol_advanced_https_ota_example_partial_request(dut: Dut)
thread1.terminate() thread1.terminate()
@pytest.mark.wifi_router @pytest.mark.ethernet_ota
@pytest.mark.parametrize( @pytest.mark.parametrize(
'config', 'config',
[ [
@@ -719,13 +705,6 @@ def test_examples_protocol_advanced_https_ota_example_ota_resumption_partial_dow
# start test # start test
dut.expect('Loaded app from partition at offset', timeout=30) dut.expect('Loaded app from partition at offset', timeout=30)
if dut.app.sdkconfig.get('EXAMPLE_WIFI_SSID_PWD_FROM_STDIN') is True:
dut.expect('Please input ssid password:')
env_name = 'wifi_router'
ap_ssid = get_env_config_variable(env_name, 'ap_ssid')
ap_password = get_env_config_variable(env_name, 'ap_password')
dut.write(f'{ap_ssid} {ap_password}')
try: try:
ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode() ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()
print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) print('Connected to AP/Ethernet with IP: {}'.format(ip_address))
@@ -737,7 +716,7 @@ def test_examples_protocol_advanced_https_ota_example_ota_resumption_partial_dow
print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + bin_name)) print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + bin_name))
dut.write('https://' + host_ip + ':' + str(server_port) + '/' + bin_name) dut.write('https://' + host_ip + ':' + str(server_port) + '/' + bin_name)
restart_device_with_random_delay(dut, 10, 30) restart_device_with_random_delay(dut, 5, 15)
thread1.terminate() thread1.terminate()
# Start server # Start server
@@ -748,13 +727,6 @@ def test_examples_protocol_advanced_https_ota_example_ota_resumption_partial_dow
# Validate that the device restarts correctly # Validate that the device restarts correctly
dut.expect('Loaded app from partition at offset', timeout=180) dut.expect('Loaded app from partition at offset', timeout=180)
if dut.app.sdkconfig.get('EXAMPLE_WIFI_SSID_PWD_FROM_STDIN') is True:
dut.expect('Please input ssid password:')
env_name = 'wifi_router'
ap_ssid = get_env_config_variable(env_name, 'ap_ssid')
ap_password = get_env_config_variable(env_name, 'ap_password')
dut.write(f'{ap_ssid} {ap_password}')
try: try:
ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode() ip_address = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()
print('Connected to AP/Ethernet with IP: {}'.format(ip_address)) print('Connected to AP/Ethernet with IP: {}'.format(ip_address))

View File

@@ -3,10 +3,17 @@ CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y
CONFIG_EXAMPLE_SKIP_VERSION_CHECK=y CONFIG_EXAMPLE_SKIP_VERSION_CHECK=y
CONFIG_EXAMPLE_OTA_RECV_TIMEOUT=3000 CONFIG_EXAMPLE_OTA_RECV_TIMEOUT=3000
CONFIG_EXAMPLE_ENABLE_OTA_RESUMPTION=y CONFIG_EXAMPLE_ENABLE_OTA_RESUMPTION=y
CONFIG_EXAMPLE_CONNECT_ETHERNET=n
CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=n CONFIG_EXAMPLE_CONNECT_ETHERNET=y
CONFIG_EXAMPLE_CONNECT_WIFI=y CONFIG_EXAMPLE_CONNECT_WIFI=n
CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN=y CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y
CONFIG_EXAMPLE_ETH_PHY_IP101=y
CONFIG_EXAMPLE_ETH_MDC_GPIO=23
CONFIG_EXAMPLE_ETH_MDIO_GPIO=18
CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5
CONFIG_EXAMPLE_ETH_PHY_ADDR=1
CONFIG_EXAMPLE_CONNECT_IPV6=y
CONFIG_EXAMPLE_ETHERNET_EMAC_TASK_STACK_SIZE=3072
CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y
CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y

View File

@@ -4,10 +4,17 @@ CONFIG_EXAMPLE_SKIP_VERSION_CHECK=y
CONFIG_EXAMPLE_OTA_RECV_TIMEOUT=3000 CONFIG_EXAMPLE_OTA_RECV_TIMEOUT=3000
CONFIG_EXAMPLE_ENABLE_PARTIAL_HTTP_DOWNLOAD=y CONFIG_EXAMPLE_ENABLE_PARTIAL_HTTP_DOWNLOAD=y
CONFIG_EXAMPLE_ENABLE_OTA_RESUMPTION=y CONFIG_EXAMPLE_ENABLE_OTA_RESUMPTION=y
CONFIG_EXAMPLE_CONNECT_ETHERNET=n
CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=n CONFIG_EXAMPLE_CONNECT_ETHERNET=y
CONFIG_EXAMPLE_CONNECT_WIFI=y CONFIG_EXAMPLE_CONNECT_WIFI=n
CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN=y CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y
CONFIG_EXAMPLE_ETH_PHY_IP101=y
CONFIG_EXAMPLE_ETH_MDC_GPIO=23
CONFIG_EXAMPLE_ETH_MDIO_GPIO=18
CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5
CONFIG_EXAMPLE_ETH_PHY_ADDR=1
CONFIG_EXAMPLE_CONNECT_IPV6=y
CONFIG_EXAMPLE_ETHERNET_EMAC_TASK_STACK_SIZE=3072
CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y
CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y