Просмотр исходного кода

native_ota_example: Move all example tests to ethernet based runners

Shubham Kulkarni 4 лет назад
Родитель
Сommit
42e389263d

+ 10 - 10
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')
@@ -179,7 +179,7 @@ def test_examples_protocol_native_ota_example(env, extra_data):
     thread1.terminate()
 
 
-@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.
@@ -218,7 +218,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')
@@ -232,7 +232,7 @@ def test_examples_protocol_native_ota_example_truncated_bin(env, extra_data):
     thread1.terminate()
 
 
-@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.
@@ -270,7 +270,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')
@@ -284,7 +284,7 @@ def test_examples_protocol_native_ota_example_truncated_header(env, extra_data):
     thread1.terminate()
 
 
-@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.
@@ -321,7 +321,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')
@@ -335,7 +335,7 @@ def test_examples_protocol_native_ota_example_random(env, extra_data):
     thread1.terminate()
 
 
-@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.
@@ -358,7 +358,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')

+ 10 - 0
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