added test-framework
This commit is contained in:
16
test/CMakeLists.txt
Normal file
16
test/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
||||
# This is the project CMakeLists.txt file for the test subproject
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# Include the components directory of the main application:
|
||||
#
|
||||
set(EXTRA_COMPONENT_DIRS "../components")
|
||||
|
||||
# Set the components to include the tests for.
|
||||
# This can be overriden from CMake cache:
|
||||
# - when invoking CMake directly: cmake -D TEST_COMPONENTS="xxxxx" ..
|
||||
# - when using idf.py: idf.py -T xxxxx build
|
||||
#
|
||||
set(TEST_COMPONENTS "mesh_ota" CACHE STRING "List of components to test")
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(unit_test_test)
|
17
test/Makefile
Normal file
17
test/Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# This is a project Makefile for the test subproject.
|
||||
#
|
||||
|
||||
PROJECT_NAME := unit_test_test
|
||||
|
||||
# Include the components directory of the main application:
|
||||
#
|
||||
EXTRA_COMPONENT_DIRS := $(realpath ../components)
|
||||
|
||||
# Set the components to include the tests for.
|
||||
# This can be overriden from the command line
|
||||
# (e.g. 'make TEST_COMPONENTS=xxxx flash monitor')
|
||||
#
|
||||
TEST_COMPONENTS ?= mesh_ota
|
||||
|
||||
include $(IDF_PATH)/make/project.mk
|
2
test/main/CMakeLists.txt
Normal file
2
test/main/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
idf_component_register(SRCS "example_unit_test_test.c"
|
||||
INCLUDE_DIRS ".")
|
0
test/main/component.mk
Normal file
0
test/main/component.mk
Normal file
58
test/main/example_unit_test_test.c
Normal file
58
test/main/example_unit_test_test.c
Normal file
@ -0,0 +1,58 @@
|
||||
/* Example test application for testable component.
|
||||
|
||||
This example 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 <stdio.h>
|
||||
#include <string.h>
|
||||
#include "unity.h"
|
||||
|
||||
static void print_banner(const char* text);
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
/* These are the different ways of running registered tests.
|
||||
* In practice, only one of them is usually needed.
|
||||
*
|
||||
* UNITY_BEGIN() and UNITY_END() calls tell Unity to print a summary
|
||||
* (number of tests executed/failed/ignored) of tests executed between these calls.
|
||||
*/
|
||||
|
||||
/*
|
||||
print_banner("Executing one test by its name");
|
||||
UNITY_BEGIN();
|
||||
unity_run_test_by_name("Mean of an empty array is zero");
|
||||
UNITY_END();
|
||||
|
||||
print_banner("Running tests with [mean] tag");
|
||||
UNITY_BEGIN();
|
||||
unity_run_tests_by_tag("[mean]", false);
|
||||
UNITY_END();
|
||||
|
||||
print_banner("Running tests without [fails] tag");
|
||||
UNITY_BEGIN();
|
||||
unity_run_tests_by_tag("[fails]", true);
|
||||
UNITY_END();
|
||||
*/
|
||||
|
||||
|
||||
print_banner("Running all the registered tests");
|
||||
UNITY_BEGIN();
|
||||
unity_run_all_tests();
|
||||
UNITY_END();
|
||||
|
||||
print_banner("Starting interactive test menu");
|
||||
/* This function will not return, and will be busy waiting for UART input.
|
||||
* Make sure that task watchdog is disabled if you use this function.
|
||||
*/
|
||||
unity_run_menu();
|
||||
}
|
||||
|
||||
static void print_banner(const char* text)
|
||||
{
|
||||
printf("\n#### %s #####\n\n", text);
|
||||
}
|
1201
test/sdkconfig
Normal file
1201
test/sdkconfig
Normal file
File diff suppressed because it is too large
Load Diff
1
test/sdkconfig.defaults
Normal file
1
test/sdkconfig.defaults
Normal file
@ -0,0 +1 @@
|
||||
CONFIG_ESP_TASK_WDT=n
|
Reference in New Issue
Block a user