diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 21 | ||||
m---------[-rwxr-xr-x] | tests-clar/clar | 346 | ||||
-rw-r--r-- | tests-clar/clar_helpers.c | 11 | ||||
-rw-r--r-- | tests-clar/clar_libgit2.h | 2 | ||||
-rw-r--r-- | tests-clar/main.c | 16 | ||||
-rw-r--r-- | tests-clar/online/clone.c (renamed from tests-clar/clone/network.c) | 2 | ||||
-rw-r--r-- | tests-clar/online/fetch.c (renamed from tests-clar/network/fetch.c) | 2 | ||||
-rw-r--r-- | tests-clar/online/fetchhead.c (renamed from tests-clar/fetchhead/network.c) | 4 | ||||
-rw-r--r-- | tests-clar/online/push.c (renamed from tests-clar/network/push.c) | 6 | ||||
-rw-r--r-- | tests-clar/online/push_util.c (renamed from tests-clar/network/push_util.c) | 0 | ||||
-rw-r--r-- | tests-clar/online/push_util.h (renamed from tests-clar/network/push_util.h) | 0 |
13 files changed, 37 insertions, 383 deletions
diff --git a/.gitignore b/.gitignore index 5441aa597..b81a1b13c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ -/tests-clar/clar.h -/tests-clar/clar_main.c -/tests-clar/clar_main.c.rule +/tests-clar/clar.suite +/tests-clar/.clarcache /apidocs /trash-*.exe /libgit2.pc @@ -28,4 +27,4 @@ CMake* .DS_Store *~ tags -mkmf.log
\ No newline at end of file +mkmf.log diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..5d7eda9ac --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tests-clar/clar"] + path = tests-clar/clar + url = https://github.com/vmg/clar.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 696d6a088..fe9f5afa1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,7 +233,6 @@ INSTALL(FILES include/git2.h DESTINATION ${INCLUDE_INSTALL_DIR} ) # Tests IF (BUILD_CLAR) - FIND_PACKAGE(PythonInterp REQUIRED) SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/tests-clar/resources/") @@ -243,23 +242,25 @@ IF (BUILD_CLAR) ADD_DEFINITIONS(-DCLAR_RESOURCES=\"${TEST_RESOURCES}\") INCLUDE_DIRECTORIES(${CLAR_PATH}) - FILE(GLOB_RECURSE SRC_TEST ${CLAR_PATH}/*/*.c ${CLAR_PATH}/clar_helpers.c ${CLAR_PATH}/testlib.c) + FILE(GLOB_RECURSE SRC_TEST ${CLAR_PATH}/*/*.c ${CLAR_PATH}/clar_helpers.c) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes") ADD_CUSTOM_COMMAND( - OUTPUT ${CLAR_PATH}/clar_main.c ${CLAR_PATH}/clar.h - COMMAND ${PYTHON_EXECUTABLE} clar . - DEPENDS ${CLAR_PATH}/clar ${SRC_TEST} + OUTPUT ${CLAR_PATH}/clar.suite + COMMAND ${PYTHON_EXECUTABLE} clar/generate.py . + DEPENDS ${CLAR_PATH}/clar.suite ${SRC_TEST} WORKING_DIRECTORY ${CLAR_PATH} ) - ADD_EXECUTABLE(libgit2_clar ${SRC_GIT2} ${SRC_OS} ${CLAR_PATH}/clar_main.c ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1}) + + ADD_EXECUTABLE(libgit2_clar ${SRC_GIT2} ${SRC_OS} ${CLAR_PATH}/main.c ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1}) TARGET_LINK_LIBRARIES(libgit2_clar ${SSL_LIBRARIES}) TARGET_OS_LIBRARIES(libgit2_clar) MSVC_SPLIT_SOURCES(libgit2_clar) - IF (MSVC_IDE) - # Precompiled headers - SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h") - ENDIF () + IF (MSVC_IDE) + # Precompiled headers + SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h") + ENDIF () ENABLE_TESTING() ADD_TEST(libgit2_clar libgit2_clar -iall) diff --git a/tests-clar/clar b/tests-clar/clar +Subproject 161e8cd0f7642385d22153052fbcf770517de6c diff --git a/tests-clar/clar_helpers.c b/tests-clar/clar_helpers.c index b718d4305..ce3ec4af4 100644 --- a/tests-clar/clar_helpers.c +++ b/tests-clar/clar_helpers.c @@ -2,17 +2,6 @@ #include "posix.h" #include "path.h" -void clar_on_init(void) -{ - git_threads_init(); -} - -void clar_on_shutdown(void) -{ - giterr_clear(); - git_threads_shutdown(); -} - void cl_git_mkfile(const char *filename, const char *content) { int fd; diff --git a/tests-clar/clar_libgit2.h b/tests-clar/clar_libgit2.h index 91a542654..15b5daaf3 100644 --- a/tests-clar/clar_libgit2.h +++ b/tests-clar/clar_libgit2.h @@ -1,7 +1,7 @@ #ifndef __CLAR_LIBGIT2__ #define __CLAR_LIBGIT2__ -#include "clar.h" +#include "clar/clar.h" #include <git2.h> #include "common.h" diff --git a/tests-clar/main.c b/tests-clar/main.c new file mode 100644 index 000000000..e9b3b641c --- /dev/null +++ b/tests-clar/main.c @@ -0,0 +1,16 @@ +#include "clar_libgit2.h" + +int main(int argc, char *argv[]) +{ + int res; + + git_threads_init(); + + /* Run the test suite */ + res = clar_test(argc, argv); + + giterr_clear(); + git_threads_shutdown(); + + return res; +} diff --git a/tests-clar/clone/network.c b/tests-clar/online/clone.c index d3009660e..f783a5a8b 100644 --- a/tests-clar/clone/network.c +++ b/tests-clar/online/clone.c @@ -3,8 +3,6 @@ #include "git2/clone.h" #include "repository.h" -CL_IN_CATEGORY("network") - #define LIVE_REPO_URL "http://github.com/libgit2/TestGitRepository" #define LIVE_EMPTYREPO_URL "http://github.com/libgit2/TestEmptyRepository" diff --git a/tests-clar/network/fetch.c b/tests-clar/online/fetch.c index 4cc23318d..979b02303 100644 --- a/tests-clar/network/fetch.c +++ b/tests-clar/online/fetch.c @@ -1,7 +1,5 @@ #include "clar_libgit2.h" -CL_IN_CATEGORY("network") - static git_repository *_repo; static int counter; diff --git a/tests-clar/fetchhead/network.c b/tests-clar/online/fetchhead.c index dc223e2aa..a6b8a6ffd 100644 --- a/tests-clar/fetchhead/network.c +++ b/tests-clar/online/fetchhead.c @@ -2,11 +2,9 @@ #include "repository.h" #include "fetchhead.h" -#include "fetchhead_data.h" +#include "../fetchhead/fetchhead_data.h" #include "git2/clone.h" -CL_IN_CATEGORY("network") - #define LIVE_REPO_URL "git://github.com/libgit2/TestGitRepository" static git_repository *g_repo; diff --git a/tests-clar/network/push.c b/tests-clar/online/push.c index 788af5267..8878e6356 100644 --- a/tests-clar/network/push.c +++ b/tests-clar/online/push.c @@ -5,8 +5,6 @@ #include "../submodule/submodule_helpers.h" #include "push_util.h" -CL_IN_CATEGORY("network") - static git_repository *_repo; static char *_remote_url; @@ -112,7 +110,7 @@ static void do_verify_push_status(git_push *push, const push_status expected[], /** * Verifies that after git_push_finish(), refs on a remote have the expected * names, oids, and order. - * + * * @param remote remote to verify * @param expected_refs expected remote refs after push * @param expected_refs_len length of expected_refs @@ -224,7 +222,7 @@ void test_network_push__cleanup(void) /** * Calls push and relists refs on remote to verify success. - * + * * @param refspecs refspecs to push * @param refspecs_len length of refspecs * @param expected_refs expected remote refs after push diff --git a/tests-clar/network/push_util.c b/tests-clar/online/push_util.c index 2e457844d..2e457844d 100644 --- a/tests-clar/network/push_util.c +++ b/tests-clar/online/push_util.c diff --git a/tests-clar/network/push_util.h b/tests-clar/online/push_util.h index 759122aa6..759122aa6 100644 --- a/tests-clar/network/push_util.h +++ b/tests-clar/online/push_util.h |