From a06dbc11a71212fee11effdeabff64f1910cd85d Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 16 Mar 2021 16:13:22 +0530 Subject: [PATCH] https_mbedtls_example: Add minimum free heap print in the example and respective check in the example_test.py --- examples/protocols/https_mbedtls/example_test.py | 9 ++++++++- .../https_mbedtls/main/https_mbedtls_example_main.c | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/protocols/https_mbedtls/example_test.py b/examples/protocols/https_mbedtls/example_test.py index 41f151e30d..f3d77083ce 100644 --- a/examples/protocols/https_mbedtls/example_test.py +++ b/examples/protocols/https_mbedtls/example_test.py @@ -30,7 +30,8 @@ def test_examples_protocol_https_mbedtls(env, extra_data): # type: (tiny_test_f 2. connect to www.howsmyssl.com:443 3. send http request """ - dut1 = env.get_dut('https_mbedtls', 'examples/protocols/https_mbedtls', dut_class=ttfw_idf.ESP32DUT) + app_name = 'https_mbedtls' + dut1 = env.get_dut(app_name, 'examples/protocols/https_mbedtls', dut_class=ttfw_idf.ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, 'https-mbedtls.bin') bin_size = os.path.getsize(binary_file) @@ -46,6 +47,12 @@ def test_examples_protocol_https_mbedtls(env, extra_data): # type: (tiny_test_f dut1.expect('Reading HTTP response...') dut1.expect(re.compile(r'Completed (\d) requests')) + # Read free heap size + res = dut1.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) + if not res: + raise ValueError('Maximum heap size info not found') + ttfw_idf.print_heap_size(app_name, dut1.app.config_name, dut1.TARGET, res[0]) + if __name__ == '__main__': test_examples_protocol_https_mbedtls() # pylint: disable=no-value-for-parameter diff --git a/examples/protocols/https_mbedtls/main/https_mbedtls_example_main.c b/examples/protocols/https_mbedtls/main/https_mbedtls_example_main.c index 788b23a1d2..c28c1b31e8 100644 --- a/examples/protocols/https_mbedtls/main/https_mbedtls_example_main.c +++ b/examples/protocols/https_mbedtls/main/https_mbedtls_example_main.c @@ -249,6 +249,7 @@ static void https_get_task(void *pvParameters) static int request_count; ESP_LOGI(TAG, "Completed %d requests", ++request_count); + printf("Minimum free heap size: %d bytes\n", esp_get_minimum_free_heap_size()); for(int countdown = 10; countdown >= 0; countdown--) { ESP_LOGI(TAG, "%d...", countdown);