Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit 655c103

Browse files
committed
add support for out of tree native unit tests
1 parent 6448f1a commit 655c103

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

stack/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ IF(NOT CMAKE_BUILD_TYPE MATCHES Debug)
5050
ENDIF()
5151

5252
PROJECT (${PROJECT_NAME})
53+
enable_testing()
5354

5455
#Set the c standard to use
5556
INSERT_C_FLAGS(BEFORE -std=gnu99 -fno-common)

stack/cmake/toolchains/gcc.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@
2121
# Toolchain setup gcc
2222
#######################################
2323

24+
# -fshort enums is required as this seems to be default with gcc-arm-none-eabi and we do some static asserts using this assumption
25+
# we also set these for c++ as this otherwise gives problems when linking mocks (C) against our test code (C++)
26+
27+
SET(CMAKE_C_FLAGS_DEBUG "-g -fshort-enums -Wno-typedef-redefinition -Wno-switch -Wno-gnu-variable-sized-type-not-at-end")
28+
SET(CMAKE_CXX_FLAGS_DEBUG "-fshort-enums -g")

stack/modules/d7ap_fs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ MODULE_HEADER_DEFINE(
3737
MODULE_BUILD_SETTINGS_FILE()
3838

3939
#Export the module-specific header files to the application by using
40-
EXPORT_GLOBAL_INCLUDE_DIRECTORIES(.)
40+
EXPORT_GLOBAL_INCLUDE_DIRECTORIES(inc)
4141

4242
#By convention, each module should generate a single 'static' library that can be included by the application
4343
ADD_LIBRARY(d7ap_fs STATIC

stack/tests/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ limitations under the License.
1919

2020
#Add the 'BUILD_UNIT_TESTS' option
2121
OPTION(BUILD_UNIT_TESTS "Build unit tests applications" ON)
22+
23+
SET(TESTS_EXTRA_TESTS_DIR "" CACHE STRING "Path to directory containing extra, out of tree tests (optional)")
24+
25+
2226
LIST_SUBDIRS(TEST_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
27+
IF(NOT(TESTS_EXTRA_TESTS_DIR STREQUAL ""))
28+
LIST_SUBDIRS(EXTRA_TESTS_DIRS ${TESTS_EXTRA_TESTS_DIR})
29+
LIST(APPEND TEST_DIRS ${EXTRA_TESTS_DIRS})
30+
ENDIF()
2331

2432
#Add conditional options for all subdirs (which are individual applications)
2533
FOREACH(__dir ${TEST_DIRS})

0 commit comments

Comments
 (0)