Commit 25bc84fb by Edward Thomson

refactor: move clar into separate directory

parent 3344fddc
......@@ -2,9 +2,11 @@
These are the unit and integration tests for the libgit2 projects.
* `libgit2`
* `clar`
This is [clar](https://github.com/clar-test/clar) the common test framework.
* `libgit2`
These tests exercise the core git functionality in libgit2 itself.
* `resources`
* `resources`
These are the resources for the tests, including files and git
repositories.
......
......@@ -8,8 +8,9 @@ if(NOT PYTHONINTERP_FOUND)
"Make sure python is available, or pass -DBUILD_TESTS=OFF to skip building the tests")
ENDIF()
set(CLAR_PATH "${PROJECT_SOURCE_DIR}/tests/clar")
set(CLAR_FIXTURES "${PROJECT_SOURCE_DIR}/tests/resources/")
set(CLAR_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
set(TEST_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
add_definitions(-DCLAR_FIXTURE_PATH=\"${CLAR_FIXTURES}\")
add_definitions(-DCLAR_TMPDIR=\"libgit2_tests\")
add_definitions(-DCLAR_WIN32_LONGPATHS)
......@@ -18,19 +19,19 @@ add_definitions(-D_FILE_OFFSET_BITS=64)
# Ensure that we do not use deprecated functions internally
add_definitions(-DGIT_DEPRECATE_HARD)
set(TEST_INCLUDES "${CLAR_PATH}" "${CMAKE_CURRENT_BINARY_DIR}")
file(GLOB_RECURSE SRC_TEST ${CLAR_PATH}/*/*.c ${CLAR_PATH}/*/*.h)
set(SRC_CLAR "main.c" "clar_libgit2.c" "clar_libgit2_trace.c" "clar_libgit2_timer.c" "clar.c")
set(TEST_INCLUDES "${CLAR_PATH}" "${TEST_PATH}" "${CMAKE_CURRENT_BINARY_DIR}")
file(GLOB_RECURSE SRC_TEST ${TEST_PATH}/*/*.c ${TEST_PATH}/*/*.h)
file(GLOB_RECURSE SRC_CLAR ${CLAR_PATH}/*.c ${CLAR_PATH}/*.h)
if(MSVC_IDE)
list(APPEND SRC_CLAR "precompiled.c")
list(APPEND SRC_TEST "precompiled.c")
endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/clar.suite ${CMAKE_CURRENT_BINARY_DIR}/clar_suite.h
COMMAND ${PYTHON_EXECUTABLE} generate.py -o "${CMAKE_CURRENT_BINARY_DIR}" -f -xonline -xstress -xperf .
COMMAND ${PYTHON_EXECUTABLE} ${CLAR_PATH}/generate.py -o "${CMAKE_CURRENT_BINARY_DIR}" -f -xonline -xstress -xperf .
DEPENDS ${SRC_TEST}
WORKING_DIRECTORY ${CLAR_PATH}
WORKING_DIRECTORY ${TEST_PATH}
)
set_source_files_properties(
......
#include "../clar_libgit2.h"
#include "clar_libgit2.h"
#include "remote.h"
#include "repository.h"
......@@ -82,9 +82,9 @@ static void do_time_travelling_fetch(git_oid *commit1id, git_oid *commit2id,
cl_git_pass(git_treebuilder_write(&empty_tree_id, tb));
cl_git_pass(git_tree_lookup(&empty_tree, repo1, &empty_tree_id));
cl_git_pass(git_signature_default(&sig, repo1));
cl_git_pass(git_commit_create(commit1id, repo1, REPO1_REFNAME, sig,
cl_git_pass(git_commit_create(commit1id, repo1, REPO1_REFNAME, sig,
sig, NULL, "one", empty_tree, 0, NULL));
cl_git_pass(git_commit_create_v(commit2id, repo1, REPO1_REFNAME, sig,
cl_git_pass(git_commit_create_v(commit2id, repo1, REPO1_REFNAME, sig,
sig, NULL, "two", empty_tree, 1, commit1id));
git_tree_free(empty_tree);
......@@ -118,7 +118,7 @@ static void do_time_travelling_fetch(git_oid *commit1id, git_oid *commit2id,
git_reference *ref;
git_reference *ref2;
cl_git_pass(git_reference_lookup(&ref, repo1, REPO1_REFNAME));
cl_git_pass(git_reference_set_target(&ref2, ref, commit1id,
cl_git_pass(git_reference_set_target(&ref2, ref, commit1id,
"rollback"));
git_reference_free(ref);
git_reference_free(ref2);
......
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