Skip to content

Commit a2d73f5

Browse files
committed
clar: introduce CLAR_XML option
Introduce a CLAR_XML option, to run the `ctest` commands with the new `-r` flag to clar. Permitted values are `OFF`, `ON` and a directory to write the XML test results to.
1 parent baa5c20 commit a2d73f5

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ OPTION(USE_EXT_HTTP_PARSER "Use system HTTP_Parser if available" ON)
6262
OPTION(DEBUG_POOL "Enable debug pool allocator" OFF)
6363
OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF)
6464
OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF)
65+
SET(CLAR_XML "OFF" CACHE STRING
66+
"Writes test results in XML format. One of ON, OFF or the directory to write to; this does not affect the output executables, this only affects the behavior of the ctest command.")
6567

6668
IF (UNIX AND NOT APPLE)
6769
OPTION(ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF)

tests/CMakeLists.txt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,22 @@ IF (MSVC_IDE)
5454
SET_SOURCE_FILES_PROPERTIES("precompiled.c" COMPILE_FLAGS "/Ycprecompiled.h")
5555
ENDIF ()
5656

57-
ADD_TEST(offline "${libgit2_BINARY_DIR}/libgit2_clar" -v -xonline)
58-
ADD_TEST(online "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline)
59-
ADD_TEST(gitdaemon "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::push)
60-
ADD_TEST(ssh "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths)
61-
ADD_TEST(proxy "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::proxy_credentials_in_url -sonline::clone::proxy_credentials_request)
57+
IF (CLAR_XML)
58+
IF (CLAR_XML STREQUAL "ON")
59+
SET(XML_PATH "")
60+
ELSE ()
61+
SET(XML_PATH "${CLAR_XML}/")
62+
ENDIF ()
63+
64+
SET(TESTS_OFFLINE_XML "-r${XML_PATH}results_offline.xml")
65+
SET(TESTS_ONLINE_XML "-r${XML_PATH}results_online.xml")
66+
SET(TESTS_GITDAEMON_XML "-r${XML_PATH}results_gitdaemon.xml")
67+
SET(TESTS_SSH_XML "-r${XML_PATH}results_ssh.xml")
68+
SET(TESTS_PROXY_XML "-r${XML_PATH}results_proxy.xml")
69+
ENDIF ()
70+
71+
ADD_TEST(offline "${libgit2_BINARY_DIR}/libgit2_clar" -v ${TESTS_OFFLINE_XML} -xonline)
72+
ADD_TEST(online "${libgit2_BINARY_DIR}/libgit2_clar" -v ${TESTS_ONLINE_XML} -sonline)
73+
ADD_TEST(gitdaemon "${libgit2_BINARY_DIR}/libgit2_clar" -v ${TESTS_GITDAEMON_XML} -sonline::push)
74+
ADD_TEST(ssh "${libgit2_BINARY_DIR}/libgit2_clar" -v ${TESTS_SSH_XML} -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths)
75+
ADD_TEST(proxy "${libgit2_BINARY_DIR}/libgit2_clar" -v ${TESTS_PROXY_XML} -sonline::clone::proxy_credentials_in_url -sonline::clone::proxy_credentials_request)

0 commit comments

Comments
 (0)