Commit 156cfec0 by Vicent Marti

Cleanup Clar to make it SIMPLER

parent 036e81f7
/tests-clar/clar.h /tests-clar/clar.suite
/tests-clar/clar_main.c /tests-clar/.clarcache
/tests-clar/clar_main.c.rule
/apidocs /apidocs
/trash-*.exe /trash-*.exe
/libgit2.pc /libgit2.pc
...@@ -28,4 +27,4 @@ CMake* ...@@ -28,4 +27,4 @@ CMake*
.DS_Store .DS_Store
*~ *~
tags tags
mkmf.log mkmf.log
\ No newline at end of file
[submodule "tests-clar/clar"]
path = tests-clar/clar
url = https://github.com/vmg/clar.git
...@@ -233,7 +233,6 @@ INSTALL(FILES include/git2.h DESTINATION ${INCLUDE_INSTALL_DIR} ) ...@@ -233,7 +233,6 @@ INSTALL(FILES include/git2.h DESTINATION ${INCLUDE_INSTALL_DIR} )
# Tests # Tests
IF (BUILD_CLAR) IF (BUILD_CLAR)
FIND_PACKAGE(PythonInterp REQUIRED) FIND_PACKAGE(PythonInterp REQUIRED)
SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/tests-clar/resources/") SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/tests-clar/resources/")
...@@ -243,23 +242,25 @@ IF (BUILD_CLAR) ...@@ -243,23 +242,25 @@ IF (BUILD_CLAR)
ADD_DEFINITIONS(-DCLAR_RESOURCES=\"${TEST_RESOURCES}\") ADD_DEFINITIONS(-DCLAR_RESOURCES=\"${TEST_RESOURCES}\")
INCLUDE_DIRECTORIES(${CLAR_PATH}) 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( ADD_CUSTOM_COMMAND(
OUTPUT ${CLAR_PATH}/clar_main.c ${CLAR_PATH}/clar.h OUTPUT ${CLAR_PATH}/clar.suite
COMMAND ${PYTHON_EXECUTABLE} clar . COMMAND ${PYTHON_EXECUTABLE} clar/generate.py .
DEPENDS ${CLAR_PATH}/clar ${SRC_TEST} DEPENDS ${CLAR_PATH}/clar.suite ${SRC_TEST}
WORKING_DIRECTORY ${CLAR_PATH} 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_LINK_LIBRARIES(libgit2_clar ${SSL_LIBRARIES})
TARGET_OS_LIBRARIES(libgit2_clar) TARGET_OS_LIBRARIES(libgit2_clar)
MSVC_SPLIT_SOURCES(libgit2_clar) MSVC_SPLIT_SOURCES(libgit2_clar)
IF (MSVC_IDE) IF (MSVC_IDE)
# Precompiled headers # Precompiled headers
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h") SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
ENDIF () ENDIF ()
ENABLE_TESTING() ENABLE_TESTING()
ADD_TEST(libgit2_clar libgit2_clar -iall) ADD_TEST(libgit2_clar libgit2_clar -iall)
......
Subproject commit 161e8cd0f7642385d22153052fbcf770517de6c1
...@@ -2,17 +2,6 @@ ...@@ -2,17 +2,6 @@
#include "posix.h" #include "posix.h"
#include "path.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) void cl_git_mkfile(const char *filename, const char *content)
{ {
int fd; int fd;
......
#ifndef __CLAR_LIBGIT2__ #ifndef __CLAR_LIBGIT2__
#define __CLAR_LIBGIT2__ #define __CLAR_LIBGIT2__
#include "clar.h" #include "clar/clar.h"
#include <git2.h> #include <git2.h>
#include "common.h" #include "common.h"
......
#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;
}
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include "git2/clone.h" #include "git2/clone.h"
#include "repository.h" #include "repository.h"
CL_IN_CATEGORY("network")
#define LIVE_REPO_URL "http://github.com/libgit2/TestGitRepository" #define LIVE_REPO_URL "http://github.com/libgit2/TestGitRepository"
#define LIVE_EMPTYREPO_URL "http://github.com/libgit2/TestEmptyRepository" #define LIVE_EMPTYREPO_URL "http://github.com/libgit2/TestEmptyRepository"
......
#include "clar_libgit2.h" #include "clar_libgit2.h"
CL_IN_CATEGORY("network")
static git_repository *_repo; static git_repository *_repo;
static int counter; static int counter;
......
...@@ -2,11 +2,9 @@ ...@@ -2,11 +2,9 @@
#include "repository.h" #include "repository.h"
#include "fetchhead.h" #include "fetchhead.h"
#include "fetchhead_data.h" #include "../fetchhead/fetchhead_data.h"
#include "git2/clone.h" #include "git2/clone.h"
CL_IN_CATEGORY("network")
#define LIVE_REPO_URL "git://github.com/libgit2/TestGitRepository" #define LIVE_REPO_URL "git://github.com/libgit2/TestGitRepository"
static git_repository *g_repo; static git_repository *g_repo;
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#include "../submodule/submodule_helpers.h" #include "../submodule/submodule_helpers.h"
#include "push_util.h" #include "push_util.h"
CL_IN_CATEGORY("network")
static git_repository *_repo; static git_repository *_repo;
static char *_remote_url; static char *_remote_url;
...@@ -112,7 +110,7 @@ static void do_verify_push_status(git_push *push, const push_status expected[], ...@@ -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 * Verifies that after git_push_finish(), refs on a remote have the expected
* names, oids, and order. * names, oids, and order.
* *
* @param remote remote to verify * @param remote remote to verify
* @param expected_refs expected remote refs after push * @param expected_refs expected remote refs after push
* @param expected_refs_len length of expected_refs * @param expected_refs_len length of expected_refs
...@@ -224,7 +222,7 @@ void test_network_push__cleanup(void) ...@@ -224,7 +222,7 @@ void test_network_push__cleanup(void)
/** /**
* Calls push and relists refs on remote to verify success. * Calls push and relists refs on remote to verify success.
* *
* @param refspecs refspecs to push * @param refspecs refspecs to push
* @param refspecs_len length of refspecs * @param refspecs_len length of refspecs
* @param expected_refs expected remote refs after push * @param expected_refs expected remote refs after push
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment