aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules/AddCMockeryTest.cmake
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-12-28 13:41:33 +0100
committerAndreas Schneider <asn@cynapses.org>2010-12-28 22:14:47 +0100
commit17f592d4dd25eae98b1a8378625adc454976fcb6 (patch)
tree753072ed82b75b78801dd0e5786a8bbe9b272e64 /cmake/Modules/AddCMockeryTest.cmake
parent7dc183126ab53d0788d48066054a8282d63c0d17 (diff)
downloadlibssh-17f592d4dd25eae98b1a8378625adc454976fcb6.tar.gz
libssh-17f592d4dd25eae98b1a8378625adc454976fcb6.tar.xz
libssh-17f592d4dd25eae98b1a8378625adc454976fcb6.zip
tests: Start to migrate tests to cmockery.
https://code.google.com/p/cmockery/wiki/Cmockery_Unit_Testing_Framework
Diffstat (limited to 'cmake/Modules/AddCMockeryTest.cmake')
-rw-r--r--cmake/Modules/AddCMockeryTest.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/cmake/Modules/AddCMockeryTest.cmake b/cmake/Modules/AddCMockeryTest.cmake
new file mode 100644
index 00000000..ad086110
--- /dev/null
+++ b/cmake/Modules/AddCMockeryTest.cmake
@@ -0,0 +1,21 @@
+# - ADD_CHECK_TEST(test_name test_source linklib1 ... linklibN)
+
+# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
+# Copyright (c) 2007-2010 Andreas Schneider <asn@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+enable_testing()
+include(CTest)
+
+set(CMAKE_C_FLAGS_PROFILING "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags")
+set(CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
+set(CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
+set(CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
+
+function (ADD_CMOCKERY_TEST _testName _testSource)
+ add_executable(${_testName} ${_testSource})
+ target_link_libraries(${_testName} ${ARGN})
+ add_test(${_testName} ${CMAKE_CURRENT_BINARY_DIR}/${_testName})
+endfunction (ADD_CMOCKERY_TEST)