Skip to content

Commit d02f4f7

Browse files
committed
cmake: refactor add_clar_test into separate module
1 parent e6d9361 commit d02f4f7

File tree

4 files changed

+19
-30
lines changed

4 files changed

+19
-30
lines changed

ci/test.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ fi
156156

157157
# Run the tests that do not require network connectivity.
158158

159-
if [ -z "$SKIP_UTILITY_TESTS" ]; then
160-
run_test util
161-
fi
162-
163159
if [ -z "$SKIP_OFFLINE_TESTS" ]; then
164160
echo ""
165161
echo "##############################################################################"

cmake/AddClarTest.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function(ADD_CLAR_TEST project name)
2+
if(NOT USE_LEAK_CHECKER STREQUAL "OFF")
3+
add_test(${name} "${PROJECT_SOURCE_DIR}/script/${USE_LEAK_CHECKER}.sh" "${PROJECT_BINARY_DIR}/${project}" ${ARGN})
4+
else()
5+
add_test(${name} "${PROJECT_BINARY_DIR}/${project}" ${ARGN})
6+
endif()
7+
endfunction(ADD_CLAR_TEST)

tests/libgit2/CMakeLists.txt

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,13 @@ if(MSVC_IDE)
6363
set_source_files_properties("precompiled.c" COMPILE_FLAGS "/Ycprecompiled.h")
6464
endif()
6565

66-
function(ADD_CLAR_TEST name)
67-
if(NOT USE_LEAK_CHECKER STREQUAL "OFF")
68-
add_test(${name} "${PROJECT_SOURCE_DIR}/script/${USE_LEAK_CHECKER}.sh" "${PROJECT_BINARY_DIR}/libgit2_tests" ${ARGN})
69-
else()
70-
add_test(${name} "${PROJECT_BINARY_DIR}/libgit2_tests" ${ARGN})
71-
endif()
72-
endfunction(ADD_CLAR_TEST)
73-
74-
add_clar_test(offline -v -xonline)
75-
add_clar_test(invasive -v -score::ftruncate -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root)
76-
add_clar_test(online -v -sonline -xonline::customcert)
77-
add_clar_test(online_customcert -v -sonline::customcert)
78-
add_clar_test(gitdaemon -v -sonline::push)
79-
add_clar_test(ssh -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths -sonline::clone::path_whitespace_ssh)
80-
add_clar_test(proxy -v -sonline::clone::proxy)
81-
add_clar_test(auth_clone -v -sonline::clone::cred)
82-
add_clar_test(auth_clone_and_push -v -sonline::clone::push -sonline::push)
66+
include(AddClarTest)
67+
add_clar_test(libgit2_tests offline -v -xonline)
68+
add_clar_test(libgit2_tests invasive -v -score::ftruncate -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root)
69+
add_clar_test(libgit2_tests online -v -sonline -xonline::customcert)
70+
add_clar_test(libgit2_tests online_customcert -v -sonline::customcert)
71+
add_clar_test(libgit2_tests gitdaemon -v -sonline::push)
72+
add_clar_test(libgit2_tests ssh -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths -sonline::clone::path_whitespace_ssh)
73+
add_clar_test(libgit2_tests proxy -v -sonline::clone::proxy)
74+
add_clar_test(libgit2_tests auth_clone -v -sonline::clone::cred)
75+
add_clar_test(libgit2_tests auth_clone_and_push -v -sonline::clone::push -sonline::push)

tests/util/CMakeLists.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,7 @@ if(MSVC_IDE)
6262
set_source_files_properties("precompiled.c" COMPILE_FLAGS "/Ycprecompiled.h")
6363
endif()
6464

65-
function(ADD_CLAR_TEST name)
66-
if(NOT USE_LEAK_CHECKER STREQUAL "OFF")
67-
add_test(${name} "${libgit2_SOURCE_DIR}/script/${USE_LEAK_CHECKER}.sh" "${libgit2_BINARY_DIR}/util_tests" ${ARGN})
68-
else()
69-
add_test(${name} "${libgit2_BINARY_DIR}/util_tests" ${ARGN})
70-
endif()
71-
endfunction(ADD_CLAR_TEST)
72-
7365
enable_testing()
7466

75-
add_clar_test(util -v)
67+
include(AddClarTest)
68+
add_clar_test(util_tests util -v)

0 commit comments

Comments
 (0)