Commit 911ff94e by Vicent Martí

Merge pull request #540 from libgit2/clay-rename

Rename the Clay test suite to Clar
parents a9fe8ae0 32dc20b5
/tests-clay/clay.h
/tests-clay/clay_main.c
/tests-clar/clar.h
/tests-clar/clar_main.c
/apidocs
/trash-*.exe
/libgit2.pc
......
......@@ -48,7 +48,7 @@ SET(INSTALL_INC include CACHE PATH "Where to install headers to.")
OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF)
OPTION (BUILD_TESTS "Build Tests" ON)
OPTION (BUILD_CLAY "Build Tests using the Clay suite" OFF)
OPTION (BUILD_CLAR "Build Tests using the Clar suite" OFF)
OPTION (TAGS "Generate tags" OFF)
# Platform specific compilation flags
......@@ -142,32 +142,32 @@ IF (BUILD_TESTS)
ADD_TEST(libgit2_test libgit2_test)
ENDIF ()
IF (BUILD_CLAY)
IF (BUILD_CLAR)
FIND_PACKAGE(PythonInterp REQUIRED)
SET(CLAY_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources/")
SET(CLAY_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tests-clay")
ADD_DEFINITIONS(-DCLAY_FIXTURE_PATH=\"${CLAY_FIXTURES}\")
SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources/")
SET(CLAR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tests-clar")
ADD_DEFINITIONS(-DCLAR_FIXTURE_PATH=\"${CLAR_FIXTURES}\")
INCLUDE_DIRECTORIES(${CLAY_PATH})
FILE(GLOB_RECURSE SRC_TEST ${CLAY_PATH}/*/*.c ${CLAY_PATH}/clay_helpers.c ${CLAY_PATH}/testlib.c)
INCLUDE_DIRECTORIES(${CLAR_PATH})
FILE(GLOB_RECURSE SRC_TEST ${CLAR_PATH}/*/*.c ${CLAR_PATH}/clar_helpers.c ${CLAR_PATH}/testlib.c)
ADD_CUSTOM_COMMAND(
OUTPUT ${CLAY_PATH}/clay_main.c ${CLAY_PATH}/clay.h
COMMAND ${PYTHON_EXECUTABLE} clay -vtap .
DEPENDS ${CLAY_PATH}/clay ${SRC_TEST}
WORKING_DIRECTORY ${CLAY_PATH}
OUTPUT ${CLAR_PATH}/clar_main.c ${CLAR_PATH}/clar.h
COMMAND ${PYTHON_EXECUTABLE} clar -vtap .
DEPENDS ${CLAR_PATH}/clar ${SRC_TEST}
WORKING_DIRECTORY ${CLAR_PATH}
)
ADD_EXECUTABLE(libgit2_clay ${SRC} ${CLAY_PATH}/clay_main.c ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP})
TARGET_LINK_LIBRARIES(libgit2_clay ${CMAKE_THREAD_LIBS_INIT})
ADD_EXECUTABLE(libgit2_clar ${SRC} ${CLAR_PATH}/clar_main.c ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP})
TARGET_LINK_LIBRARIES(libgit2_clar ${CMAKE_THREAD_LIBS_INIT})
IF (WIN32)
TARGET_LINK_LIBRARIES(libgit2_clay ws2_32)
TARGET_LINK_LIBRARIES(libgit2_clar ws2_32)
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
TARGET_LINK_LIBRARIES(libgit2_clay socket nsl)
TARGET_LINK_LIBRARIES(libgit2_clar socket nsl)
ENDIF ()
ENABLE_TESTING()
ADD_TEST(libgit2_clay libgit2_clay)
ADD_TEST(libgit2_clar libgit2_clar)
ENDIF ()
IF (TAGS)
......
Writing Clay tests for libgit2
Writing Clar tests for libgit2
==============================
For information on the Clay testing framework and a detailed introduction
For information on the Clar testing framework and a detailed introduction
please visit:
https://github.com/tanoku/clay
https://github.com/tanoku/clar
* Write your modules and tests. Use good, meaningful names.
* Make sure you actually build the tests by setting:
cmake -DBUILD_CLAY=ON build/
cmake -DBUILD_CLAR=ON build/
* Test:
./build/libgit2_clay
./build/libgit2_clar
* Make sure everything is fine.
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "attr_file.h"
#define get_rule(X) ((git_attr_rule *)git_vector_get(&file->rules,(X)))
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "attr_file.h"
void test_attr_lookup__simple(void)
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "fileops.h"
#include "git2/attr.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "buffer.h"
static const char *test_string = "Have you seen that? Have you seeeen that??";
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "posix.h"
void clay_on_init(void)
void clar_on_init(void)
{
git_threads_init();
}
void clay_on_shutdown(void)
void clar_on_shutdown(void)
{
git_threads_shutdown();
}
......
#ifndef __CLAY_LIBGIT2__
#define __CLAY_LIBGIT2__
#ifndef __CLAR_LIBGIT2__
#define __CLAR_LIBGIT2__
#include "clay.h"
#include "clar.h"
#include <git2.h>
#include "common.h"
/**
* Special wrapper for `clay_must_pass` that passes
* Special wrapper for `clar_must_pass` that passes
* the last library error as the test failure message.
*
* Use this wrapper around all `git_` library calls that
......@@ -15,11 +15,11 @@
#define cl_git_pass(expr) do { \
git_clearerror(); \
if ((expr) != GIT_SUCCESS) \
clay__assert(0, __FILE__, __LINE__, "Function call failed: " #expr, git_lasterror(), 1); \
clar__assert(0, __FILE__, __LINE__, "Function call failed: " #expr, git_lasterror(), 1); \
} while(0)
/**
* Wrapper for `clay_must_fail` -- this one is
* Wrapper for `clar_must_fail` -- this one is
* just for consistency. Use with `git_` library
* calls that are supposed to fail!
*/
......@@ -38,7 +38,7 @@ GIT_INLINE(void) cl_assert_strequal_internal(
if (!match) {
char buf[4096];
snprintf(buf, 4096, "'%s' != '%s'", a, b);
clay__assert(0, file, line, buf, err, 1);
clar__assert(0, file, line, buf, err, 1);
}
}
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
void test_config_add__initialize(void)
{
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "filebuf.h"
#include "fileops.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
void test_config_read__simple_read(void)
{
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "filebuf.h"
#include "fileops.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
void test_config_write__initialize(void)
{
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "buffer.h"
#define TESTSTR "Have you seen that? Have you seeeen that??"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "fileops.h"
typedef struct name_data {
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "filebuf.h"
/* make sure git_filebuf_open doesn't delete an existing lock */
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "util.h"
void test_core_hex__fromhex(void)
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
static git_oid id;
const char *str_oid = "ae90f12eea699729ed24555e40b9fd669da12a12";
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include <fileops.h>
static void
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "fileops.h"
static const char *empty_tmp_dir = "test_gitfo_rmdir_recurs_test";
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
/* compare prefixes */
void test_core_string__0(void)
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
void test_core_strtol__int32(void)
{
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "vector.h"
/* initial size of 1 would cause writing past array bounds */
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "posix.h"
/* Test that reading and writing a tree is a no-op */
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "posix.h"
void test_index_rename__single_file(void)
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
static git_remote *_remote;
static git_repository *_repo;
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "transport.h"
#include "buffer.h"
#include "path.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
static git_remote *_remote;
static git_repository *_repo;
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "posix.h"
static git_repository *repo;
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "odb.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "odb.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "odb.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "odb.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "odb.h"
#include "hash.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "odb.h"
#include "hash.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "odb.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "odb.h"
#include "hash.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "tree.h"
#include "repository.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
static git_repository *repo;
const char *tree_with_subtrees_oid = "ae90f12eea699729ed24555e40b9fd669da12a12";
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "odb.h"
#include "posix.h"
#include "loose_data.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "odb.h"
#include "pack_data.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "git2/odb_backend.h"
#include "odb.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
void test_refs_crashes__double_free(void)
{
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
void test_repo_getters__initialize(void)
{
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "fileops.h"
enum repo_mode {
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "posix.h"
void test_repo_open__bare_empty_repo(void)
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "fileops.h"
#include "git2/attr.h"
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "posix.h"
static void
......
#include "clay_libgit2.h"
#include "clar_libgit2.h"
#include "fileops.h"
#include "ignore.h"
#include "status_data.h"
......
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