From a6e8bbefd8609a51d3e6e1e7ddd8902c14b940ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0tetiar?= Date: Fri, 1 Nov 2019 09:13:42 +0100 Subject: [PATCH] cmake: add unit testing option and shunit2 tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit For convenient tests invocation. Signed-off-by: Petr Å tetiar --- CMakeLists.txt | 5 +++++ tests/CMakeLists.txt | 1 + tests/shunit2/CMakeLists.txt | 7 +++++++ 3 files changed, 13 insertions(+) create mode 100644 tests/CMakeLists.txt create mode 100644 tests/shunit2/CMakeLists.txt 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=$") -- 2.25.1