From 760d3592767d1a6c80ce2d161018f5d9584d2076 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 21 Sep 2021 17:56:50 +0530 Subject: [PATCH] mqtt_test_app: Fix the invalid esp-tls error code values in mqtt test app --- .../protocols/mqtt/publish_connect_test/app_test.py | 6 +++--- .../protocols/mqtt/publish_connect_test/main/connect_test.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/test_apps/protocols/mqtt/publish_connect_test/app_test.py b/tools/test_apps/protocols/mqtt/publish_connect_test/app_test.py index 738951bd0d..2a0e2b5371 100644 --- a/tools/test_apps/protocols/mqtt/publish_connect_test/app_test.py +++ b/tools/test_apps/protocols/mqtt/publish_connect_test/app_test.py @@ -267,7 +267,7 @@ def connection_tests(dut, cases): with TlsServer(server_port, client_cert=True) as s: test_nr = start_connection_case(case, 'server with client verification - handshake error since client presents no client certificate') dut.expect('MQTT_EVENT_ERROR: Test={}'.format(test_nr), timeout=30) - dut.expect('ESP-TLS ERROR: 0x8010') # expect ... handshake error (PEER_DID_NOT_RETURN_A_CERTIFICATE) + dut.expect('ESP-TLS ERROR: ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED') # expect ... handshake error (PEER_DID_NOT_RETURN_A_CERTIFICATE) if 'PEER_DID_NOT_RETURN_A_CERTIFICATE' not in s.get_last_ssl_error(): raise('Unexpected ssl error from the server {}'.format(s.get_last_ssl_error())) @@ -281,7 +281,7 @@ def connection_tests(dut, cases): with TlsServer(server_port) as s: test_nr = start_connection_case(case, 'invalid server certificate on default server - expect ssl handshake error') dut.expect('MQTT_EVENT_ERROR: Test={}'.format(test_nr), timeout=30) - dut.expect('ESP-TLS ERROR: 0x8010') # expect ... handshake error (TLSV1_ALERT_UNKNOWN_CA) + dut.expect('ESP-TLS ERROR: ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED') # expect ... handshake error (TLSV1_ALERT_UNKNOWN_CA) if 'alert unknown ca' not in s.get_last_ssl_error(): raise Exception('Unexpected ssl error from the server {}'.format(s.get_last_ssl_error())) @@ -289,7 +289,7 @@ def connection_tests(dut, cases): with TlsServer(server_port, client_cert=True) as s: test_nr = start_connection_case(case, 'Invalid client certificate on server with client verification - expect ssl handshake error') dut.expect('MQTT_EVENT_ERROR: Test={}'.format(test_nr), timeout=30) - dut.expect('ESP-TLS ERROR: 0x8010') # expect ... handshake error (CERTIFICATE_VERIFY_FAILED) + dut.expect('ESP-TLS ERROR: ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED') # expect ... handshake error (CERTIFICATE_VERIFY_FAILED) if 'CERTIFICATE_VERIFY_FAILED' not in s.get_last_ssl_error(): raise Exception('Unexpected ssl error from the server {}'.format(s.get_last_ssl_error())) diff --git a/tools/test_apps/protocols/mqtt/publish_connect_test/main/connect_test.c b/tools/test_apps/protocols/mqtt/publish_connect_test/main/connect_test.c index aa03f1988c..86f48fd136 100644 --- a/tools/test_apps/protocols/mqtt/publish_connect_test/main/connect_test.c +++ b/tools/test_apps/protocols/mqtt/publish_connect_test/main/connect_test.c @@ -48,7 +48,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_ case MQTT_EVENT_ERROR: ESP_LOGI(TAG, "MQTT_EVENT_ERROR: Test=%d", running_test_case); if (event->error_handle->error_type == MQTT_ERROR_TYPE_ESP_TLS) { - ESP_LOGI(TAG, "ESP-TLS ERROR: 0x%x", event->error_handle->esp_tls_last_esp_err); + ESP_LOGI(TAG, "ESP-TLS ERROR: %s", esp_err_to_name(event->error_handle->esp_tls_last_esp_err)); } else if (event->error_handle->error_type == MQTT_ERROR_TYPE_CONNECTION_REFUSED) { ESP_LOGI(TAG, "MQTT ERROR: 0x%x", event->error_handle->connect_return_code); } else {