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.


* Original commit: espressif/esp-idf@16514f93f0
This commit is contained in:
Jakob Hasse
2021-11-18 14:27:30 +08:00
committed by gabsuren
parent c4c323666e
commit 525c70c0b2

View File

@ -1,28 +1,26 @@
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD /*
// * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Unlicense OR CC0-1.0
// You may obtain a copy of the License at *
// * This test code is in the Public Domain (or CC0 licensed, at your option.)
// http://www.apache.org/licenses/LICENSE-2.0 *
// * Unless required by applicable law or agreed to in writing, this
// Unless required by applicable law or agreed to in writing, software * software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// distributed under the License is distributed on an "AS IS" BASIS, * CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <esp_websocket_client.h> #include <esp_websocket_client.h>
#include "unity.h" #include "unity.h"
#include "test_utils.h" #include "memory_checks.h"
static void test_leak_setup(const char * file, long line) static void test_leak_setup(const char * file, long line)
{ {
printf("%s:%ld\n", file, line); printf("%s:%ld\n", file, line);
unity_reset_leak_checks(); test_utils_record_free_mem();
} }
TEST_CASE("websocket init and deinit", "[websocket][leaks=0]") TEST_CASE("websocket init and deinit", "[websocket][leaks=0]")