From: Petr Štetiar Date: Fri, 1 Nov 2019 08:13:42 +0000 (+0100) Subject: cmake: add unit testing option and shunit2 tests X-Git-Url: http://git.openwrt.org/openwrt/openwrt.git;lede-17.01?a=commitdiff_plain;h=a6e8bbefd8609a51d3e6e1e7ddd8902c14b940ab;p=project%2Fuci.git cmake: add unit testing option and shunit2 tests For convenient tests invocation. Signed-off-by: Petr Štetiar --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 578c021..5720a5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,11 @@ ADD_LIBRARY(ucimap STATIC ucimap.c) ADD_SUBDIRECTORY(lua) +IF(UNIT_TESTING) + ENABLE_TESTING() + ADD_SUBDIRECTORY(tests) +ENDIF() + INSTALL(FILES uci.h uci_config.h uci_blob.h ucimap.h DESTINATION include ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..b7a7ccb --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1 @@ +ADD_SUBDIRECTORY(shunit2) diff --git a/tests/shunit2/CMakeLists.txt b/tests/shunit2/CMakeLists.txt new file mode 100644 index 0000000..42cb43f --- /dev/null +++ b/tests/shunit2/CMakeLists.txt @@ -0,0 +1,7 @@ +ADD_TEST( + NAME shunit2 + COMMAND tests.sh + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + +SET_PROPERTY(TEST shunit2 APPEND PROPERTY ENVIRONMENT "UCI_BIN=$")