Merge branch 'bugfix/protocols_test_on_eth' into 'master'

ci/mqtt: Move protocol tests to eth runners

Closes IDFCI-653

See merge request espressif/esp-idf!16752
This commit is contained in:
David Čermák 2022-01-19 14:44:00 +00:00
commit 1c94345737
16 changed files with 86 additions and 17 deletions

View File

@ -395,6 +395,12 @@ test_app_test_002:
- ESP32 - ESP32
- Example_WIFI - Example_WIFI
test_app_test_eth:
extends: .test_app_esp32_template
tags:
- ESP32
- Example_EthKitV1
test_app_test_003: test_app_test_003:
extends: .test_app_esp32_template extends: .test_app_esp32_template
tags: tags:

View File

@ -103,12 +103,12 @@ def mdns_server(esp_host):
continue continue
@ttfw_idf.idf_example_test(env_tag='Example_WIFI_Protocols') @ttfw_idf.idf_example_test(env_tag='Example_EthKitV1')
def test_examples_protocol_mdns(env, extra_data): def test_examples_protocol_mdns(env, extra_data):
global stop_mdns_server global stop_mdns_server
""" """
steps: | steps: |
1. join AP + init mdns example 1. obtain IP address + init mdns example
2. get the dut host name (and IP address) 2. get the dut host name (and IP address)
3. check the mdns name is accessible 3. check the mdns name is accessible
4. check DUT output if mdns advertized host is resolved 4. check DUT output if mdns advertized host is resolved
@ -124,7 +124,7 @@ def test_examples_protocol_mdns(env, extra_data):
specific_host = dut1.expect(re.compile(r'mdns hostname set to: \[([^\]]+)\]'), timeout=30)[0] specific_host = dut1.expect(re.compile(r'mdns hostname set to: \[([^\]]+)\]'), timeout=30)[0]
mdns_responder = Thread(target=mdns_server, args=(str(specific_host),)) mdns_responder = Thread(target=mdns_server, args=(str(specific_host),))
try: try:
ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30)[0] ip_address = dut1.expect(re.compile(r' eth ip: ([^,]+),'), timeout=30)[0]
console_log('Connected to AP with IP: {}'.format(ip_address)) console_log('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,12 @@ CONFIG_MDNS_RESOLVE_TEST_SERVICES=y
CONFIG_MDNS_ADD_MAC_TO_HOSTNAME=y CONFIG_MDNS_ADD_MAC_TO_HOSTNAME=y
CONFIG_MDNS_PUBLISH_DELEGATE_HOST=y CONFIG_MDNS_PUBLISH_DELEGATE_HOST=y
CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=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

View File

@ -58,7 +58,7 @@ def on_message(client, userdata, msg):
message_log += 'Received data:' + msg.topic + ' ' + payload + '\n' message_log += 'Received data:' + msg.topic + ' ' + payload + '\n'
@ttfw_idf.idf_example_test(env_tag='Example_WIFI_Protocols') @ttfw_idf.idf_example_test(env_tag='Example_EthKitV1')
def test_examples_protocol_mqtt_ssl(env, extra_data): def test_examples_protocol_mqtt_ssl(env, extra_data):
broker_url = '' broker_url = ''
broker_port = 0 broker_port = 0
@ -110,7 +110,7 @@ def test_examples_protocol_mqtt_ssl(env, extra_data):
raise ValueError('ENV_TEST_FAILURE: Test script cannot connect to broker: {}'.format(broker_url)) raise ValueError('ENV_TEST_FAILURE: Test script cannot connect to broker: {}'.format(broker_url))
dut1.start_app() dut1.start_app()
try: try:
ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) ip_address = dut1.expect(re.compile(r' 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:
print('ENV_TEST_FAILURE: Cannot connect to AP') print('ENV_TEST_FAILURE: Cannot connect to AP')

View File

@ -11,3 +11,12 @@ CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384
CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096
CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n
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

View File

@ -53,7 +53,7 @@ def mqqt_server_sketch(my_ip, port):
print('server closed') print('server closed')
@ttfw_idf.idf_example_test(env_tag='Example_WIFI_Protocols') @ttfw_idf.idf_example_test(env_tag='Example_EthKitV1')
def test_examples_protocol_mqtt_qos1(env, extra_data): def test_examples_protocol_mqtt_qos1(env, extra_data):
global msgid global msgid
""" """
@ -76,7 +76,7 @@ def test_examples_protocol_mqtt_qos1(env, extra_data):
dut1.start_app() dut1.start_app()
# waiting for getting the IP address # waiting for getting the IP address
try: try:
ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) ip_address = dut1.expect(re.compile(r' 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

@ -1,3 +1,12 @@
CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
CONFIG_BROKER_URL="FROM_STDIN" CONFIG_BROKER_URL="FROM_STDIN"
CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n
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

View File

@ -39,7 +39,7 @@ def on_message(client, userdata, msg):
message_log += 'Received data:' + msg.topic + ' ' + payload + '\n' message_log += 'Received data:' + msg.topic + ' ' + payload + '\n'
@ttfw_idf.idf_example_test(env_tag='Example_WIFI_Protocols') @ttfw_idf.idf_example_test(env_tag='Example_EthKitV1')
def test_examples_protocol_mqtt_ws(env, extra_data): def test_examples_protocol_mqtt_ws(env, extra_data):
broker_url = '' broker_url = ''
broker_port = 0 broker_port = 0
@ -83,7 +83,7 @@ def test_examples_protocol_mqtt_ws(env, extra_data):
raise ValueError('ENV_TEST_FAILURE: Test script cannot connect to broker: {}'.format(broker_url)) raise ValueError('ENV_TEST_FAILURE: Test script cannot connect to broker: {}'.format(broker_url))
dut1.start_app() dut1.start_app()
try: try:
ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) ip_address = dut1.expect(re.compile(r' 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:
print('ENV_TEST_FAILURE: Cannot connect to AP') print('ENV_TEST_FAILURE: Cannot connect to AP')

View File

@ -1,2 +1,11 @@
CONFIG_BROKER_URI="ws://${EXAMPLE_MQTT_BROKER_WS}/ws" CONFIG_BROKER_URI="ws://${EXAMPLE_MQTT_BROKER_WS}/ws"
CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n
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

View File

@ -40,7 +40,7 @@ def on_message(client, userdata, msg):
message_log += 'Received data:' + msg.topic + ' ' + payload + '\n' message_log += 'Received data:' + msg.topic + ' ' + payload + '\n'
@ttfw_idf.idf_example_test(env_tag='Example_WIFI_Protocols') @ttfw_idf.idf_example_test(env_tag='Example_EthKitV1')
def test_examples_protocol_mqtt_wss(env, extra_data): def test_examples_protocol_mqtt_wss(env, extra_data):
broker_url = '' broker_url = ''
broker_port = 0 broker_port = 0
@ -87,7 +87,7 @@ def test_examples_protocol_mqtt_wss(env, extra_data):
raise ValueError('ENV_TEST_FAILURE: Test script cannot connect to broker: {}'.format(broker_url)) raise ValueError('ENV_TEST_FAILURE: Test script cannot connect to broker: {}'.format(broker_url))
dut1.start_app() dut1.start_app()
try: try:
ip_address = dut1.expect(re.compile(r' sta ip: ([^,]+),'), timeout=30) ip_address = dut1.expect(re.compile(r' 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:
print('ENV_TEST_FAILURE: Cannot connect to AP') print('ENV_TEST_FAILURE: Cannot connect to AP')

View File

@ -1,3 +1,12 @@
CONFIG_BROKER_URI="wss://${EXAMPLE_MQTT_BROKER_WSS}/ws" CONFIG_BROKER_URI="wss://${EXAMPLE_MQTT_BROKER_WSS}/ws"
CONFIG_BROKER_CERTIFICATE_OVERRIDE="${EXAMPLE_MQTT_BROKER_CERTIFICATE}" CONFIG_BROKER_CERTIFICATE_OVERRIDE="${EXAMPLE_MQTT_BROKER_CERTIFICATE}"
CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n
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

View File

@ -68,7 +68,7 @@ class Websocket(object):
def test_echo(dut): def test_echo(dut):
dut.expect('WEBSOCKET_EVENT_CONNECTED') dut.expect('WEBSOCKET_EVENT_CONNECTED')
for i in range(0, 10): for i in range(0, 5):
dut.expect(re.compile(r'Received=hello (\d)'), timeout=30) dut.expect(re.compile(r'Received=hello (\d)'), timeout=30)
print('All echos received') print('All echos received')
@ -97,11 +97,11 @@ def test_recv_long_msg(dut, websocket, msg_len, repeats):
\nreceived: {}\nwith length {}'.format(send_msg, len(send_msg), recv_msg, len(recv_msg))) \nreceived: {}\nwith length {}'.format(send_msg, len(send_msg), recv_msg, len(recv_msg)))
@ttfw_idf.idf_example_test(env_tag='Example_WIFI_Protocols') @ttfw_idf.idf_example_test(env_tag='Example_EthKitV1')
def test_examples_protocol_websocket(env, extra_data): def test_examples_protocol_websocket(env, extra_data):
""" """
steps: steps:
1. join AP 1. obtain IP address
2. connect to uri specified in the config 2. connect to uri specified in the config
3. send and receive data 3. send and receive data
""" """

View File

@ -24,7 +24,7 @@
#include "esp_websocket_client.h" #include "esp_websocket_client.h"
#include "esp_event.h" #include "esp_event.h"
#define NO_DATA_TIMEOUT_SEC 10 #define NO_DATA_TIMEOUT_SEC 5
static const char *TAG = "WEBSOCKET"; static const char *TAG = "WEBSOCKET";
@ -115,7 +115,7 @@ static void websocket_app_start(void)
xTimerStart(shutdown_signal_timer, portMAX_DELAY); xTimerStart(shutdown_signal_timer, portMAX_DELAY);
char data[32]; char data[32];
int i = 0; int i = 0;
while (i < 10) { while (i < 5) {
if (esp_websocket_client_is_connected(client)) { if (esp_websocket_client_is_connected(client)) {
int len = sprintf(data, "hello %04d", i++); int len = sprintf(data, "hello %04d", i++);
ESP_LOGI(TAG, "Sending %s", data); ESP_LOGI(TAG, "Sending %s", data);

View File

@ -1,2 +1,11 @@
CONFIG_WEBSOCKET_URI_FROM_STDIN=y CONFIG_WEBSOCKET_URI_FROM_STDIN=y
CONFIG_WEBSOCKET_URI_FROM_STRING=n CONFIG_WEBSOCKET_URI_FROM_STRING=n
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

View File

@ -307,7 +307,7 @@ def connection_tests(dut, cases):
teardown_connection_suite() teardown_connection_suite()
@ttfw_idf.idf_custom_test(env_tag='Example_WIFI', group='test-apps') @ttfw_idf.idf_custom_test(env_tag='Example_EthKitV1', group='test-apps')
def test_app_protocol_mqtt_publish_connect(env, extra_data): def test_app_protocol_mqtt_publish_connect(env, extra_data):
""" """
steps: steps:

View File

@ -9,3 +9,12 @@ CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=16384
CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n
CONFIG_ESP_TLS_INSECURE=y CONFIG_ESP_TLS_INSECURE=y
CONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY=y CONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY=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