native_ota_example: Move all example tests to ethernet based runners

This commit is contained in:
Shubham Kulkarni 2021-11-15 13:55:42 +05:30
parent 40a72ef3cf
commit 91ccac08f8
2 changed files with 20 additions and 10 deletions

View File

@ -134,7 +134,7 @@ def start_chunked_server(ota_image_dir, server_port):
return chunked_server 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): 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. 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): for i in range(iterations):
dut1.expect('Loaded app from partition at offset', timeout=30) dut1.expect('Loaded app from partition at offset', timeout=30)
try: 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)) print('Connected to AP with IP: {}'.format(ip_address))
except DUT.ExpectTimeout: except DUT.ExpectTimeout:
raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') 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() 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): 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. 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.start_app()
dut1.expect('Loaded app from partition at offset', timeout=30) dut1.expect('Loaded app from partition at offset', timeout=30)
try: 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)) print('Connected to AP with IP: {}'.format(ip_address))
except DUT.ExpectTimeout: except DUT.ExpectTimeout:
raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') 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) 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): 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. 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.start_app()
dut1.expect('Loaded app from partition at offset', timeout=30) dut1.expect('Loaded app from partition at offset', timeout=30)
try: 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)) print('Connected to AP with IP: {}'.format(ip_address))
except DUT.ExpectTimeout: except DUT.ExpectTimeout:
raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') 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) 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): 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. 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.start_app()
dut1.expect('Loaded app from partition at offset', timeout=30) dut1.expect('Loaded app from partition at offset', timeout=30)
try: 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)) print('Connected to AP with IP: {}'.format(ip_address))
except DUT.ExpectTimeout: except DUT.ExpectTimeout:
raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') 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) 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): 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. 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.start_app()
dut1.expect('Loaded app from partition at offset', timeout=30) dut1.expect('Loaded app from partition at offset', timeout=30)
try: 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)) print('Connected to AP with IP: {}'.format(ip_address))
except DUT.ExpectTimeout: except DUT.ExpectTimeout:
raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP') raise ValueError('ENV_TEST_FAILURE: Cannot connect to AP')

View File

@ -2,3 +2,13 @@ CONFIG_EXAMPLE_FIRMWARE_UPG_URL="FROM_STDIN"
CONFIG_EXAMPLE_SKIP_COMMON_NAME_CHECK=y 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_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