From afa0a68c3104bdffe4f6eb7c3f512cd80dde5e92 Mon Sep 17 00:00:00 2001 From: Shubham Kulkarni Date: Mon, 15 Nov 2021 13:53:52 +0530 Subject: [PATCH 1/4] target-test.yml: Add EXAMPLE_ETH_OTA runner to OTA on ethernet based runners --- .gitlab/ci/target-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index aa551114cc..ff791f4a88 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -115,10 +115,9 @@ example_test_001D: example_test_OTA: extends: .example_test_esp32_template - parallel: 2 tags: - ESP32 - - Example_WIFI_OTA + - EXAMPLE_ETH_OTA example_test_protocols: extends: .example_test_esp32_template From 40a72ef3cf5701fec1472b10fddc7f0e80c5fc56 Mon Sep 17 00:00:00 2001 From: Shubham Kulkarni Date: Mon, 15 Nov 2021 13:54:44 +0530 Subject: [PATCH 2/4] simple_ota_example: Move redundant and failing example_tests to nightly run --- examples/system/ota/simple_ota_example/example_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/system/ota/simple_ota_example/example_test.py b/examples/system/ota/simple_ota_example/example_test.py index 50f752ba96..10b34b070e 100644 --- a/examples/system/ota/simple_ota_example/example_test.py +++ b/examples/system/ota/simple_ota_example/example_test.py @@ -114,7 +114,7 @@ def calc_all_sha256(dut): return sha256_bootloader, sha256_app -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA', nightly_run=True) def test_examples_protocol_simple_ota_example(env, extra_data): """ steps: | @@ -221,7 +221,7 @@ def test_examples_protocol_simple_ota_example_with_flash_encryption(env, extra_d dut1.expect('Starting OTA example', timeout=30) -@ttfw_idf.idf_example_test(env_tag='Example_Flash_Encryption_OTA_WiFi', target=['esp32c3']) +@ttfw_idf.idf_example_test(env_tag='Example_Flash_Encryption_OTA_WiFi', target=['esp32c3'], nightly_run=True) def test_examples_protocol_simple_ota_example_with_flash_encryption_wifi(env, extra_data): """ steps: | From 91ccac08f845841696db828211d41767ef7dcc64 Mon Sep 17 00:00:00 2001 From: Shubham Kulkarni Date: Mon, 15 Nov 2021 13:55:42 +0530 Subject: [PATCH 3/4] native_ota_example: Move all example tests to ethernet based runners --- .../ota/native_ota_example/example_test.py | 20 +++++++++---------- .../ota/native_ota_example/sdkconfig.ci | 10 ++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/examples/system/ota/native_ota_example/example_test.py b/examples/system/ota/native_ota_example/example_test.py index 6269748845..11b0a2ad0a 100644 --- a/examples/system/ota/native_ota_example/example_test.py +++ b/examples/system/ota/native_ota_example/example_test.py @@ -134,7 +134,7 @@ def start_chunked_server(ota_image_dir, server_port): return chunked_server -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_native_ota_example(env, extra_data): """ This is a positive test case, which downloads complete binary file multiple number of times. @@ -164,7 +164,7 @@ def test_examples_protocol_native_ota_example(env, extra_data): for i in range(iterations): dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') @@ -178,7 +178,7 @@ def test_examples_protocol_native_ota_example(env, extra_data): dut1.reset() -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_native_ota_example_truncated_bin(env, extra_data): """ Working of OTA if binary file is truncated is validated in this test case. @@ -217,7 +217,7 @@ def test_examples_protocol_native_ota_example_truncated_bin(env, extra_data): dut1.start_app() dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=60) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=60) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') @@ -229,7 +229,7 @@ def test_examples_protocol_native_ota_example_truncated_bin(env, extra_data): os.remove(binary_file) -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_native_ota_example_truncated_header(env, extra_data): """ Working of OTA if headers of binary file are truncated is vaildated in this test case. @@ -267,7 +267,7 @@ def test_examples_protocol_native_ota_example_truncated_header(env, extra_data): dut1.start_app() dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=60) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=60) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') @@ -279,7 +279,7 @@ def test_examples_protocol_native_ota_example_truncated_header(env, extra_data): os.remove(binary_file) -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_native_ota_example_random(env, extra_data): """ Working of OTA if random data is added in binary file are validated in this test case. @@ -316,7 +316,7 @@ def test_examples_protocol_native_ota_example_random(env, extra_data): dut1.start_app() dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=60) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=60) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') @@ -328,7 +328,7 @@ def test_examples_protocol_native_ota_example_random(env, extra_data): os.remove(binary_file) -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_native_ota_example_chunked(env, extra_data): """ This is a positive test case, which downloads complete binary file multiple number of times. @@ -351,7 +351,7 @@ def test_examples_protocol_native_ota_example_chunked(env, extra_data): dut1.start_app() dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') diff --git a/examples/system/ota/native_ota_example/sdkconfig.ci b/examples/system/ota/native_ota_example/sdkconfig.ci index 1908291986..3b3472741d 100644 --- a/examples/system/ota/native_ota_example/sdkconfig.ci +++ b/examples/system/ota/native_ota_example/sdkconfig.ci @@ -2,3 +2,13 @@ CONFIG_EXAMPLE_FIRMWARE_UPG_URL="FROM_STDIN" CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y CONFIG_EXAMPLE_SKIP_VERSION_CHECK=y CONFIG_EXAMPLE_OTA_RECV_TIMEOUT=3000 + +CONFIG_EXAMPLE_CONNECT_ETHERNET=y +CONFIG_EXAMPLE_CONNECT_WIFI=n +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 From d959a35e28a71d1207182c3bb12419e095111d99 Mon Sep 17 00:00:00 2001 From: Shubham Kulkarni Date: Mon, 15 Nov 2021 13:56:56 +0530 Subject: [PATCH 4/4] advanced_https_ota: Move example tests on ethernet runners Move BT tests to nightly run --- .../ota/advanced_https_ota/example_test.py | 40 +++++++++---------- .../ota/advanced_https_ota/sdkconfig.ci | 10 +++++ .../sdkconfig.ci.partial_download | 10 +++++ 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/examples/system/ota/advanced_https_ota/example_test.py b/examples/system/ota/advanced_https_ota/example_test.py index 4803ab873e..1d1c508213 100644 --- a/examples/system/ota/advanced_https_ota/example_test.py +++ b/examples/system/ota/advanced_https_ota/example_test.py @@ -168,7 +168,7 @@ def start_redirect_server(ota_image_dir, server_ip, server_port, redirection_por httpd.serve_forever() -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_advanced_https_ota_example(env, extra_data): """ This is a positive test case, which downloads complete binary file multiple number of times. @@ -198,7 +198,7 @@ def test_examples_protocol_advanced_https_ota_example(env, extra_data): for i in range(iterations): dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') @@ -212,7 +212,7 @@ def test_examples_protocol_advanced_https_ota_example(env, extra_data): dut1.reset() -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_advanced_https_ota_example_truncated_bin(env, extra_data): """ Working of OTA if binary file is truncated is validated in this test case. @@ -251,7 +251,7 @@ def test_examples_protocol_advanced_https_ota_example_truncated_bin(env, extra_d dut1.start_app() dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') @@ -263,7 +263,7 @@ def test_examples_protocol_advanced_https_ota_example_truncated_bin(env, extra_d os.remove(binary_file) -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_advanced_https_ota_example_truncated_header(env, extra_data): """ Working of OTA if headers of binary file are truncated is vaildated in this test case. @@ -301,7 +301,7 @@ def test_examples_protocol_advanced_https_ota_example_truncated_header(env, extr dut1.start_app() dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') @@ -313,7 +313,7 @@ def test_examples_protocol_advanced_https_ota_example_truncated_header(env, extr os.remove(binary_file) -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_advanced_https_ota_example_random(env, extra_data): """ Working of OTA if random data is added in binary file are validated in this test case. @@ -350,7 +350,7 @@ def test_examples_protocol_advanced_https_ota_example_random(env, extra_data): dut1.start_app() dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') @@ -362,7 +362,7 @@ def test_examples_protocol_advanced_https_ota_example_random(env, extra_data): os.remove(binary_file) -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_advanced_https_ota_example_chunked(env, extra_data): """ This is a positive test case, which downloads complete binary file multiple number of times. @@ -385,7 +385,7 @@ def test_examples_protocol_advanced_https_ota_example_chunked(env, extra_data): dut1.start_app() dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') @@ -400,7 +400,7 @@ def test_examples_protocol_advanced_https_ota_example_chunked(env, extra_data): os.remove(os.path.join(dut1.app.binary_path, 'server_key.pem')) -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_advanced_https_ota_example_redirect_url(env, extra_data): """ This is a positive test case, which starts a server and a redirection server. @@ -433,7 +433,7 @@ def test_examples_protocol_advanced_https_ota_example_redirect_url(env, extra_da dut1.start_app() dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') @@ -492,7 +492,7 @@ def test_examples_protocol_advanced_https_ota_example_anti_rollback(env, extra_d # Positive Case dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' eth ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') @@ -502,7 +502,7 @@ def test_examples_protocol_advanced_https_ota_example_anti_rollback(env, extra_d print('writing to device: {}'.format('https://' + host_ip + ':' + str(server_port) + '/' + bin_name)) dut1.write('https://' + host_ip + ':' + str(server_port) + '/' + bin_name) dut1.expect('Loaded app from partition at offset', timeout=60) - dut1.expect(re.compile(r' eth ip: ([^,]+),'), timeout=30) + dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) dut1.expect('App is valid, rollback cancelled successfully', 30) # Negative Case @@ -514,7 +514,7 @@ def test_examples_protocol_advanced_https_ota_example_anti_rollback(env, extra_d os.remove(anti_rollback_bin_name) -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_advanced_https_ota_example_partial_request(env, extra_data): """ This is a positive test case, to test OTA workflow with Range HTTP header. @@ -543,7 +543,7 @@ def test_examples_protocol_advanced_https_ota_example_partial_request(env, extra dut1.start_app() dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: Utility.console_log('ENV_TEST_FAILURE: Cannot connect to AP') @@ -559,7 +559,7 @@ def test_examples_protocol_advanced_https_ota_example_partial_request(env, extra dut1.reset() -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA', nightly_run=True) def test_examples_protocol_advanced_https_ota_example_nimble_gatts(env, extra_data): """ Run an OTA image update while a BLE GATT Server is running in background. This GATT server will be using NimBLE Host stack. @@ -602,7 +602,7 @@ def test_examples_protocol_advanced_https_ota_example_nimble_gatts(env, extra_da dut1.reset() -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA', nightly_run=True) def test_examples_protocol_advanced_https_ota_example_bluedroid_gatts(env, extra_data): """ Run an OTA image update while a BLE GATT Server is running in background. This GATT server will be using Bluedroid Host stack. @@ -645,7 +645,7 @@ def test_examples_protocol_advanced_https_ota_example_bluedroid_gatts(env, extra dut1.reset() -@ttfw_idf.idf_example_test(env_tag='Example_WIFI_OTA') +@ttfw_idf.idf_example_test(env_tag='EXAMPLE_ETH_OTA') def test_examples_protocol_advanced_https_ota_example_openssl_aligned_bin(env, extra_data): """ This is a test case for esp_http_client_read with binary size multiple of 289 bytes @@ -678,7 +678,7 @@ def test_examples_protocol_advanced_https_ota_example_openssl_aligned_bin(env, e dut1.start_app() dut1.expect('Loaded app from partition at offset', timeout=30) try: - ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) + ip_address = dut1.expect(re.compile(r' (sta|eth) ip: ([^,]+),'), timeout=30) print('Connected to AP with IP: {}'.format(ip_address)) except DUT.ExpectTimeout: raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') diff --git a/examples/system/ota/advanced_https_ota/sdkconfig.ci b/examples/system/ota/advanced_https_ota/sdkconfig.ci index 0edbed76b0..04a2c93441 100644 --- a/examples/system/ota/advanced_https_ota/sdkconfig.ci +++ b/examples/system/ota/advanced_https_ota/sdkconfig.ci @@ -2,3 +2,13 @@ CONFIG_EXAMPLE_FIRMWARE_UPGRADE_URL="FROM_STDIN" CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y CONFIG_EXAMPLE_SKIP_VERSION_CHECK=y CONFIG_EXAMPLE_OTA_RECV_TIMEOUT=3000 + +CONFIG_EXAMPLE_CONNECT_ETHERNET=y +CONFIG_EXAMPLE_CONNECT_WIFI=n +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 diff --git a/examples/system/ota/advanced_https_ota/sdkconfig.ci.partial_download b/examples/system/ota/advanced_https_ota/sdkconfig.ci.partial_download index a0d2e342f1..37413c2912 100644 --- a/examples/system/ota/advanced_https_ota/sdkconfig.ci.partial_download +++ b/examples/system/ota/advanced_https_ota/sdkconfig.ci.partial_download @@ -5,3 +5,13 @@ CONFIG_EXAMPLE_OTA_RECV_TIMEOUT=3000 CONFIG_EXAMPLE_ENABLE_PARTIAL_HTTP_DOWNLOAD=y CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y + +CONFIG_EXAMPLE_CONNECT_ETHERNET=y +CONFIG_EXAMPLE_CONNECT_WIFI=n +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