summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-03-09 13:50:01 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-03-09 13:50:01 (GMT)
commitd1856e2e333001d0f106a3af86dfe000fd61b2b2 (patch)
tree0a9866e34c51145ff1dbb8d3ded6dcbac06af72e /Tests
parentca274d39b7172c603b2c8e66175aa2838627b70d (diff)
parenta4194debea02e723d21f6db83a4528254d885f13 (diff)
downloadCMake-d1856e2e333001d0f106a3af86dfe000fd61b2b2.zip
CMake-d1856e2e333001d0f106a3af86dfe000fd61b2b2.tar.gz
CMake-d1856e2e333001d0f106a3af86dfe000fd61b2b2.tar.bz2
Merge topic 'add-FindLTTngUST'
a4194deb Add FindLTTngUST module to find LTTng-UST library
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/CMakeOnly/AllFindModules/CMakeLists.txt2
-rw-r--r--Tests/FindLTTngUST/CMakeLists.txt10
-rw-r--r--Tests/FindLTTngUST/Test/CMakeLists.txt18
-rw-r--r--Tests/FindLTTngUST/Test/main.c31
5 files changed, 64 insertions, 1 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index ba493cb..c7d2138 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1371,6 +1371,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindJsonCpp)
endif()
+ if(CMake_TEST_FindLTTngUST)
+ add_subdirectory(FindLTTngUST)
+ endif()
+
if(CMake_TEST_FindOpenSSL)
add_subdirectory(FindOpenSSL)
endif()
diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
index 0aad161..1f39052 100644
--- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
+++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
@@ -81,7 +81,7 @@ endmacro()
# reported.
foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG
- HSPELL ICOTOOL JASPER LIBLZMA LIBXML2 LIBXSLT PERL PKG_CONFIG
+ HSPELL ICOTOOL JASPER LIBLZMA LIBXML2 LIBXSLT LTTNGUST PERL PKG_CONFIG
PostgreSQL TIFF ZLIB)
check_version_string(${VTEST} ${VTEST}_VERSION_STRING)
endforeach()
diff --git a/Tests/FindLTTngUST/CMakeLists.txt b/Tests/FindLTTngUST/CMakeLists.txt
new file mode 100644
index 0000000..c9c471d
--- /dev/null
+++ b/Tests/FindLTTngUST/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindLTTngUST.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindLTTngUST/Test"
+ "${CMake_BINARY_DIR}/Tests/FindLTTngUST/Test"
+ ${build_generator_args}
+ --build-project TestFindLTTngUST
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindLTTngUST/Test/CMakeLists.txt b/Tests/FindLTTngUST/Test/CMakeLists.txt
new file mode 100644
index 0000000..e5bd9f3
--- /dev/null
+++ b/Tests/FindLTTngUST/Test/CMakeLists.txt
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 3.5)
+project(TestFindLTTngUST C)
+include(CTest)
+
+find_package(LTTngUST REQUIRED)
+
+add_definitions(-DCMAKE_EXPECTED_LTTNGUST_VERSION="${LTTNGUST_VERSION_STRING}")
+add_definitions(-DCMAKE_LTTNGUST_HAS_TRACEF="${LTTNGUST_HAS_TRACEF}")
+add_definitions(-DCMAKE_LTTNGUST_HAS_TRACELOG="${LTTNGUST_HAS_TRACELOG}")
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt LTTng::UST)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_include_directories(test_var PRIVATE ${LTTNGUST_INCLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${LTTNGUST_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindLTTngUST/Test/main.c b/Tests/FindLTTngUST/Test/main.c
new file mode 100644
index 0000000..ac775a0
--- /dev/null
+++ b/Tests/FindLTTngUST/Test/main.c
@@ -0,0 +1,31 @@
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <lttng/ust-version.h>
+
+#ifdef CMAKE_LTTNGUST_HAS_TRACEF
+#include <lttng/tracef.h>
+#endif
+
+#ifdef CMAKE_LTTNGUST_HAS_TRACELOG
+#include <lttng/tracelog.h>
+#endif
+
+int main(void)
+{
+ char lttng_version_string[16];
+
+ snprintf(lttng_version_string, 16, "%u.%u.%u", LTTNG_UST_MAJOR_VERSION,
+ LTTNG_UST_MINOR_VERSION, LTTNG_UST_PATCHLEVEL_VERSION);
+ assert(!strcmp(lttng_version_string, CMAKE_EXPECTED_LTTNGUST_VERSION));
+
+#ifdef CMAKE_LTTNGUST_HAS_TRACEF
+ tracef("calling tracef()! %d %s", -23, CMAKE_EXPECTED_LTTNGUST_VERSION);
+#endif
+
+#ifdef CMAKE_LTTNGUST_HAS_TRACELOG
+ tracelog(TRACE_WARNING, "calling tracelog()! %d", 17);
+#endif
+
+ return 0;
+}