Commit 156cfec0 by Vicent Marti

Cleanup Clar to make it SIMPLER

parent 036e81f7
/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
[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} )
# 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)
......
Subproject commit 161e8cd0f7642385d22153052fbcf770517de6c1
#!/usr/bin/env python
from __future__ import with_statement
from string import Template
import re, fnmatch, os, codecs
VERSION = "0.10.0"
TEST_FUNC_REGEX = r"^(void\s+(test_%s__(\w+))\(\s*void\s*\))\s*\{"
EVENT_CB_REGEX = re.compile(
r"^(void\s+clar_on_(\w+)\(\s*void\s*\))\s*\{",
re.MULTILINE)
SKIP_COMMENTS_REGEX = re.compile(
r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
re.DOTALL | re.MULTILINE)
CATEGORY_REGEX = re.compile(r"CL_IN_CATEGORY\(\s*\"([^\"]+)\"\s*\)")
CLAR_HEADER = """
/*
* Clar v%s
*
* This is an autogenerated file. Do not modify.
* To add new unit tests or suites, regenerate the whole
* file with `./clar`
*/
""" % VERSION
CLAR_EVENTS = [
'init',
'shutdown',
'test',
'suite'
]
def main():
from optparse import OptionParser
parser = OptionParser()
parser.add_option('-c', '--clar-path', dest='clar_path')
parser.add_option('-v', '--report-to', dest='print_mode', default='default')
options, args = parser.parse_args()
for folder in args or ['.']:
builder = ClarTestBuilder(folder,
clar_path = options.clar_path,
print_mode = options.print_mode)
builder.render()
class ClarTestBuilder:
def __init__(self, path, clar_path = None, print_mode = 'default'):
self.declarations = []
self.suite_names = []
self.callback_data = {}
self.suite_data = {}
self.category_data = {}
self.event_callbacks = []
self.clar_path = os.path.abspath(clar_path) if clar_path else None
self.path = os.path.abspath(path)
self.modules = [
"clar_sandbox.c",
"clar_fixtures.c",
"clar_fs.c",
"clar_categorize.c",
]
self.modules.append("clar_print_%s.c" % print_mode)
print("Loading test suites...")
for root, dirs, files in os.walk(self.path):
module_root = root[len(self.path):]
module_root = [c for c in module_root.split(os.sep) if c]
tests_in_module = fnmatch.filter(files, "*.c")
for test_file in tests_in_module:
full_path = os.path.join(root, test_file)
test_name = "_".join(module_root + [test_file[:-2]])
with codecs.open(full_path, 'r', 'utf-8') as f:
self._process_test_file(test_name, f.read())
if not self.suite_data:
raise RuntimeError(
'No tests found under "%s"' % path)
def render(self):
main_file = os.path.join(self.path, 'clar_main.c')
with open(main_file, "w") as out:
out.write(self._render_main())
header_file = os.path.join(self.path, 'clar.h')
with open(header_file, "w") as out:
out.write(self._render_header())
print ('Written Clar suite to "%s"' % self.path)
#####################################################
# Internal methods
#####################################################
def _render_cb(self, cb):
return '{"%s", &%s}' % (cb['short_name'], cb['symbol'])
def _render_suite(self, suite, index):
template = Template(
r"""
{
${suite_index},
"${clean_name}",
${initialize},
${cleanup},
${categories},
${cb_ptr}, ${cb_count}
}
""")
callbacks = {}
for cb in ['initialize', 'cleanup']:
callbacks[cb] = (self._render_cb(suite[cb])
if suite[cb] else "{NULL, NULL}")
if len(self.category_data[suite['name']]) > 0:
cats = "_clar_cat_%s" % suite['name']
else:
cats = "NULL"
return template.substitute(
suite_index = index,
clean_name = suite['name'].replace("_", "::"),
initialize = callbacks['initialize'],
cleanup = callbacks['cleanup'],
categories = cats,
cb_ptr = "_clar_cb_%s" % suite['name'],
cb_count = suite['cb_count']
).strip()
def _render_callbacks(self, suite_name, callbacks):
template = Template(
r"""
static const struct clar_func _clar_cb_${suite_name}[] = {
${callbacks}
};
""")
callbacks = [
self._render_cb(cb)
for cb in callbacks
if cb['short_name'] not in ('initialize', 'cleanup')
]
return template.substitute(
suite_name = suite_name,
callbacks = ",\n\t".join(callbacks)
).strip()
def _render_categories(self, suite_name, categories):
template = Template(
r"""
static const char *_clar_cat_${suite_name}[] = { "${categories}", NULL };
""")
if len(categories) > 0:
return template.substitute(
suite_name = suite_name,
categories = '","'.join(categories)
).strip()
else:
return ""
def _render_event_overrides(self):
overrides = []
for event in CLAR_EVENTS:
if event in self.event_callbacks:
continue
overrides.append(
"#define clar_on_%s() /* nop */" % event
)
return '\n'.join(overrides)
def _render_header(self):
template = Template(self._load_file('clar.h'))
declarations = "\n".join(
"extern %s;" % decl
for decl in sorted(self.declarations)
)
return template.substitute(
extern_declarations = declarations,
)
def _render_main(self):
template = Template(self._load_file('clar.c'))
suite_names = sorted(self.suite_names)
suite_data = [
self._render_suite(self.suite_data[s], i)
for i, s in enumerate(suite_names)
]
callbacks = [
self._render_callbacks(s, self.callback_data[s])
for s in suite_names
]
callback_count = sum(
len(cbs) for cbs in self.callback_data.values()
)
categories = [
self._render_categories(s, self.category_data[s])
for s in suite_names
]
return template.substitute(
clar_modules = self._get_modules(),
clar_callbacks = "\n".join(callbacks),
clar_categories = "".join(categories),
clar_suites = ",\n\t".join(suite_data),
clar_suite_count = len(suite_data),
clar_callback_count = callback_count,
clar_event_overrides = self._render_event_overrides(),
)
def _load_file(self, filename):
if self.clar_path:
filename = os.path.join(self.clar_path, filename)
with open(filename) as cfile:
return cfile.read()
else:
import zlib, base64, sys
content = CLAR_FILES[filename]
if sys.version_info >= (3, 0):
content = bytearray(content, 'utf_8')
content = base64.b64decode(content)
content = zlib.decompress(content)
return str(content, 'utf-8')
else:
content = base64.b64decode(content)
return zlib.decompress(content)
def _get_modules(self):
return "\n".join(self._load_file(f) for f in self.modules)
def _skip_comments(self, text):
def _replacer(match):
s = match.group(0)
return "" if s.startswith('/') else s
return re.sub(SKIP_COMMENTS_REGEX, _replacer, text)
def _process_test_file(self, suite_name, contents):
contents = self._skip_comments(contents)
self._process_events(contents)
self._process_declarations(suite_name, contents)
self._process_categories(suite_name, contents)
def _process_events(self, contents):
for (decl, event) in EVENT_CB_REGEX.findall(contents):
if event not in CLAR_EVENTS:
continue
self.declarations.append(decl)
self.event_callbacks.append(event)
def _process_declarations(self, suite_name, contents):
callbacks = []
initialize = cleanup = None
regex_string = TEST_FUNC_REGEX % suite_name
regex = re.compile(regex_string, re.MULTILINE)
for (declaration, symbol, short_name) in regex.findall(contents):
data = {
"short_name" : short_name,
"declaration" : declaration,
"symbol" : symbol
}
if short_name == 'initialize':
initialize = data
elif short_name == 'cleanup':
cleanup = data
else:
callbacks.append(data)
if not callbacks:
return
tests_in_suite = len(callbacks)
suite = {
"name" : suite_name,
"initialize" : initialize,
"cleanup" : cleanup,
"cb_count" : tests_in_suite
}
if initialize:
self.declarations.append(initialize['declaration'])
if cleanup:
self.declarations.append(cleanup['declaration'])
self.declarations += [
callback['declaration']
for callback in callbacks
]
callbacks.sort(key=lambda x: x['short_name'])
self.callback_data[suite_name] = callbacks
self.suite_data[suite_name] = suite
self.suite_names.append(suite_name)
print(" %s (%d tests)" % (suite_name, tests_in_suite))
def _process_categories(self, suite_name, contents):
self.category_data[suite_name] = [
cat for cat in CATEGORY_REGEX.findall(contents) ]
CLAR_FILES = {
"clar.c" : r"""eJytGmtT20jys/0rJs4FZBAEO1dXtziwlcpurqjbJZeEVLYqUCohjfEQWTIaKYFk/d+vu+ehGUmGpHb5gK2e7p7unn6O/FjkSVannD2PpeRltb84Hj62MMmr6+WqBavSTFx2YKJog0qRX/mwZVwtOoRxSVjDpzus5De1KHnK5kXJZJynl8UtMGE7T12SO/m0ultx2eIEYFnFpACA5ymfs+jDyemz6fDxwGJ9EXlafFGkDVTL3gDkgmdZvBItcArCJXqHAWwgcs6i31+cnEYvX7IoSlKeZM4SihOsQOcQvo5Z5D83eMtPwFgvL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yxxT0FfV12bbBimlMY0ZEnjlFzBlXj275PHY9VC7SjLzkrKaAQ9UoNW1tHhr5CpEWy2/rp4c5/jJd31n7HEwp3+hcMqepQhHDgiQNlCqsiAj8dPOWki27AyU2A0uE1s5gsxVe3uPZdD3/9PnhuwML17LOx2MLjdG0eN8gOUoIlalCr1xHiG2ymFOuUeETlDClyDOD/ee7pkApyZXGGSiGHSiQHjIOcpsmLTIuur1BFx44fbFczTE2q9XyvliNFrmgBQFK4hiFBHwbXKERsuueHpq4HWCz8zjw9SDufJMxqlmAwgYBnRYcjjCobHoU/nT43IAv4b0aYK6QSDXSMmd9uFutZhGjP/5DJ2rq3kmoC7eL/M5K9VF4B6Eujg2VSP9xnCpKfRN2/7Ra9Y9Cq2j/nXeKqqPvKppuLrcPm+7YOWq71QhdC3ZI1V5plx08S7GlXdF7kkUqqTERdIPL8vyVSMHFc5t9QaDHJ0PuWDO4hsthOBv1XxYV0lu6fi1LUJBL86cNCNswmhtXXY16PLf+lcHhSMt57dO1Pttq4qnLJqVdDpKu50Da2zHcERw96oJXwlVCNI2KYVAT+IU5MsvLgQtz912feLwfmDuQBGDeC2zzGoQfBvEdf+L5QyCnp5B2PfPXD+TXQP5hoMzJJl52uTdJDkRcdHODHAjvSWRUTJiO0gD0M7SIkaoU6cNvttFMCryf+WNtP+Z/AaQwXp0="""
}
if __name__ == '__main__':
main()
......@@ -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;
......
#ifndef __CLAR_LIBGIT2__
#define __CLAR_LIBGIT2__
#include "clar.h"
#include "clar/clar.h"
#include <git2.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 @@
#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"
......
#include "clar_libgit2.h"
CL_IN_CATEGORY("network")
static git_repository *_repo;
static int counter;
......
......@@ -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;
......
......@@ -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
......
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