Skip to content

Commit

Permalink
change(ccomp_timer): move unit tests to component test app
Browse files Browse the repository at this point in the history
  • Loading branch information
igrr committed Sep 27, 2024
1 parent 102bda2 commit 26ebc98
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 10 deletions.
1 change: 1 addition & 0 deletions .idf_build_apps.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exclude = [
]
manifest_file = [
"bdc_motor/.build-test-rules.yml",
"ccomp_timer/.build-test-rules.yml",
".build-test-rules.yml",
]
check_warnings = true
Expand Down
4 changes: 4 additions & 0 deletions ccomp_timer/.build-test-rules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ccomp_timer/test_apps:
enable:
- if: IDF_TARGET in ["esp32", "esp32s2", "esp32c3"]
reason: "Testing on these targets is sufficient (xtensa, risc-v, single/dual core)."
10 changes: 0 additions & 10 deletions ccomp_timer/test/CMakeLists.txt

This file was deleted.

5 changes: 5 additions & 0 deletions ccomp_timer/test_apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.16)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(COMPONENTS main)
project(ccomp_timer_test)
14 changes: 14 additions & 0 deletions ccomp_timer/test_apps/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
idf_build_get_property(arch IDF_TARGET_ARCH)

set(priv_requires esp_timer unity)
if("${arch}" STREQUAL "xtensa")
list(APPEND priv_requires perfmon)
endif()

idf_component_register(SRCS "ccomp_timer_test.c"
"ccomp_timer_test_api.c"
"ccomp_timer_test_data.c"
"ccomp_timer_test_inst.c"
PRIV_INCLUDE_DIRS "."
PRIV_REQUIRES ${priv_requires}
WHOLE_ARCHIVE)
28 changes: 28 additions & 0 deletions ccomp_timer/test_apps/main/ccomp_timer_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "unity.h"
#include "unity_test_runner.h"
#include "esp_heap_caps.h"
#include "esp_newlib.h"
#include "unity_test_utils_memory.h"

void setUp(void)
{
unity_utils_record_free_mem();
}

void tearDown(void)
{
esp_reent_cleanup(); //clean up some of the newlib's lazy allocations
unity_utils_evaluate_leaks_direct(50);
}

void app_main(void)
{
printf("Running ccomp_timer component tests\n");
unity_run_menu();
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions ccomp_timer/test_apps/main/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
espressif/ccomp_timer:
version: "*"
override_path: ../../
6 changes: 6 additions & 0 deletions ccomp_timer/test_apps/pytest_ccomp_timer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import pytest


@pytest.mark.generic
def test_ccomp_timer(dut) -> None:
dut.run_all_single_board_cases()
4 changes: 4 additions & 0 deletions ccomp_timer/test_apps/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file was generated using idf.py save-defconfig. It can be edited manually.
# Espressif IoT Development Framework (ESP-IDF) 5.4.0 Project Minimal Configuration
#
CONFIG_ESP_TASK_WDT_INIT=n

0 comments on commit 26ebc98

Please sign in to comment.