From 174c6781de0506e29bf981db3c351537aeb54127 Mon Sep 17 00:00:00 2001 From: Jakob Hasse Date: Thu, 18 Nov 2021 14:27:30 +0800 Subject: [PATCH] refactor (test_utils)!: separate file for memory check functions Memory check (leaks and heap tracing) functions for unit tests now have a separate file now and are renamed for more consistency. BREAKING CHANGE: renamed memory check function names which may be used in unit tests outside IDF. --- components/mqtt/test/test_mqtt.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/components/mqtt/test/test_mqtt.c b/components/mqtt/test/test_mqtt.c index ede3b31..e103b59 100644 --- a/components/mqtt/test/test_mqtt.c +++ b/components/mqtt/test/test_mqtt.c @@ -1,8 +1,21 @@ +/* + * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + * + * This test code is in the Public Domain (or CC0 licensed, at your option.) + * + * Unless required by applicable law or agreed to in writing, this + * software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. + */ + #include #include "freertos/FreeRTOS.h" #include "freertos/event_groups.h" #include "unity.h" #include "test_utils.h" +#include "memory_checks.h" #include "mqtt_client.h" #include "nvs_flash.h" #include "esp_ota_ops.h" @@ -17,7 +30,7 @@ static void test_leak_setup(const char * file, long line) gettimeofday(&te, NULL); // get current time esp_read_mac(mac, ESP_MAC_WIFI_STA); printf("%s:%ld: time=%ld.%lds, mac:" MACSTR "\n", file, line, te.tv_sec, te.tv_usec, MAC2STR(mac)); - unity_reset_leak_checks(); + test_utils_record_free_mem(); } TEST_CASE("mqtt init with invalid url", "[mqtt][leaks=0]")