Initial public release of the 2024A software.
This commit is contained in:
parent
7b9ad3edfd
commit
303e9e1dad
361 changed files with 60083 additions and 2 deletions
|
@ -0,0 +1,8 @@
|
|||
# The following lines of boilerplate have to be in your project's CMakeLists
|
||||
# in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components"
|
||||
"../../cmake_utilities")
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(cmake_utilities_test_apps)
|
|
@ -0,0 +1,10 @@
|
|||
idf_component_register( SRC_DIRS "."
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES cmake_utilities)
|
||||
|
||||
include(gcc)
|
||||
include(gen_compressed_ota)
|
||||
include(gen_single_bin)
|
||||
include(package_manager)
|
||||
include(relinker)
|
||||
cu_pkg_define_version(${CMAKE_CURRENT_LIST_DIR})
|
|
@ -0,0 +1,6 @@
|
|||
version: "3.2.1"
|
||||
description: Test2 for cmake utilities
|
||||
url: https://github.com/espressif/esp-iot-solution/tree/master/tools/cmake_utilities
|
||||
issues: https://github.com/espressif/esp-iot-solution/issues
|
||||
dependencies:
|
||||
idf: ">=4.1"
|
|
@ -0,0 +1,16 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int test_component2_version_major()
|
||||
{
|
||||
return TEST_COMPONENT2_VER_MAJOR;
|
||||
}
|
||||
|
||||
int test_component2_version_minor()
|
||||
{
|
||||
return TEST_COMPONENT2_VER_MINOR;
|
||||
}
|
||||
|
||||
int test_component2_version_patch()
|
||||
{
|
||||
return TEST_COMPONENT2_VER_PATCH;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#include <stdio.h>
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int test_component2_version_major();
|
||||
int test_component2_version_minor();
|
||||
int test_component2_version_patch();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,10 @@
|
|||
idf_component_register( SRC_DIRS "."
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES cmake_utilities)
|
||||
|
||||
include(gcc)
|
||||
include(gen_compressed_ota)
|
||||
include(gen_single_bin)
|
||||
include(package_manager)
|
||||
include(relinker)
|
||||
cu_pkg_define_version(${CMAKE_CURRENT_LIST_DIR})
|
|
@ -0,0 +1,6 @@
|
|||
version: "1.2.3"
|
||||
description: Test1 for cmake utilities
|
||||
url: https://github.com/espressif/esp-iot-solution/tree/master/tools/cmake_utilities
|
||||
issues: https://github.com/espressif/esp-iot-solution/issues
|
||||
dependencies:
|
||||
idf: ">=4.1"
|
|
@ -0,0 +1,16 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int test_component1_version_major()
|
||||
{
|
||||
return TEST_COMPONENT1_VER_MAJOR;
|
||||
}
|
||||
|
||||
int test_component1_version_minor()
|
||||
{
|
||||
return TEST_COMPONENT1_VER_MINOR;
|
||||
}
|
||||
|
||||
int test_component1_version_patch()
|
||||
{
|
||||
return TEST_COMPONENT1_VER_PATCH;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#include <stdio.h>
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int test_component1_version_major();
|
||||
int test_component1_version_minor();
|
||||
int test_component1_version_patch();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,3 @@
|
|||
idf_component_register(SRC_DIRS "."
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES unity test_utils test_component1 TEST-component2)
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_log.h"
|
||||
#include "unity.h"
|
||||
#include "test_component1.h"
|
||||
#include "test_component2.h"
|
||||
|
||||
|
||||
/* USB PIN fixed in esp32-s2, can not use io matrix */
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (-400)
|
||||
|
||||
TEST_CASE("Test package manager version", "[cmake_utilities][package_manager]")
|
||||
{
|
||||
esp_log_level_set("*", ESP_LOG_INFO);
|
||||
TEST_ASSERT_EQUAL_INT(test_component1_version_major(), 1);
|
||||
TEST_ASSERT_EQUAL_INT(test_component1_version_minor(), 2);
|
||||
TEST_ASSERT_EQUAL_INT(test_component1_version_patch(), 3);
|
||||
TEST_ASSERT_EQUAL_INT(test_component2_version_major(), 3);
|
||||
TEST_ASSERT_EQUAL_INT(test_component2_version_minor(), 2);
|
||||
TEST_ASSERT_EQUAL_INT(test_component2_version_patch(), 1);
|
||||
}
|
||||
|
||||
static size_t before_free_8bit;
|
||||
static size_t before_free_32bit;
|
||||
|
||||
static void check_leak(size_t before_free, size_t after_free, const char *type)
|
||||
{
|
||||
ssize_t delta = after_free - before_free;
|
||||
printf("MALLOC_CAP_%s: Before %u bytes free, After %u bytes free (delta %d)\n", type, before_free, after_free, delta);
|
||||
TEST_ASSERT_MESSAGE(delta >= TEST_MEMORY_LEAK_THRESHOLD, "memory leak");
|
||||
}
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||
before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||
size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
||||
check_leak(before_free_8bit, after_free_8bit, "8BIT");
|
||||
check_leak(before_free_32bit, after_free_32bit, "32BIT");
|
||||
}
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
printf("Cmake Utilities TEST \n");
|
||||
unity_run_menu();
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
'''
|
||||
Steps to run these cases:
|
||||
- Build
|
||||
- . ${IDF_PATH}/export.sh
|
||||
- pip install idf_build_apps
|
||||
- python tools/build_apps.py tools/cmake_utilities/test_apps -t esp32s2
|
||||
- Test
|
||||
- pip install -r tools/requirements/requirement.pytest.txt
|
||||
- pytest tools/cmake_utilities/test_apps --target esp32s2
|
||||
'''
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
@pytest.mark.target('esp32s3')
|
||||
@pytest.mark.env('generic')
|
||||
def test_cmake_utilities(dut: Dut)-> None:
|
||||
dut.expect_exact('Press ENTER to see the list of tests.')
|
||||
dut.write('*')
|
||||
dut.expect_unity_test_output(timeout = 1000)
|
Loading…
Add table
Add a link
Reference in a new issue