summaryrefslogtreecommitdiffstats
path: root/Tests/CTestCoverageCollectGCOV/test.cmake.in
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CTestCoverageCollectGCOV/test.cmake.in')
-rw-r--r--Tests/CTestCoverageCollectGCOV/test.cmake.in39
1 files changed, 39 insertions, 0 deletions
diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in
new file mode 100644
index 0000000..4bdcb10
--- /dev/null
+++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in
@@ -0,0 +1,39 @@
+cmake_minimum_required(VERSION 2.8.12)
+set(CTEST_PROJECT_NAME "SmallAndFast")
+set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTest/SmallAndFast")
+set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestCoverageCollectGCOV")
+set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
+ctest_start(Experimental)
+ctest_configure()
+ctest_build()
+ctest_test()
+
+file(WRITE ${CTEST_BINARY_DIRECTORY}/CMakeFiles/echoargs.dir/echoargs.gcda
+"dummy
+")
+
+include(CTestCoverageCollectGCOV)
+set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.tar)
+ctest_coverage_collect_gcov(
+ TARBALL "${tar_file}"
+ SOURCE "${CTEST_SOURCE_DIRECTORY}"
+ BUILD "${CTEST_BINARY_DIRECTORY}"
+ GCOV_COMMAND "${CMAKE_COMMAND}"
+ GCOV_OPTIONS -P "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/fakegcov.cmake")
+
+execute_process(COMMAND
+ ${CMAKE_COMMAND} -E tar tf ${tar_file}
+ OUTPUT_VARIABLE out
+ WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
+
+set(expected_out
+"Testing/CoverageInfo/echoargs.gcov
+Testing/CoverageInfo/data.json
+CMakeFiles/echoargs.dir/Labels.json
+")
+
+if("${out}" STREQUAL "${expected_out}")
+ message("PASSED with correct output: ${out}")
+else()
+ message(FATAL_ERROR "FAILED: expected:\n${expected_out}\nGot:\n${out}")
+endif()