Commit bc57b80b by Vicent Marti

Update to Clay 0.10.0

Comes with support for global events; this fixes #496.
parent b5daae68
......@@ -4,19 +4,34 @@ from __future__ import with_statement
from string import Template
import re, fnmatch, os
VERSION = "0.9.0"
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+clay_on_(\w+)\(\s*void\s*\))\s*\{",
re.MULTILINE)
SKIP_COMMENTS_REGEX = re.compile(
r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
re.DOTALL | re.MULTILINE)
CLAY_HEADER = """
/*
* Clay v0.9.0
* Clay v%s
*
* This is an autogenerated file. Do not modify.
* To add new unit tests or suites, regenerate the whole
* file with `./clay`
*/
"""
""" % VERSION
CLAY_EVENTS = [
'init',
'shutdown',
'test',
'suite'
]
def main():
from optparse import OptionParser
......@@ -42,6 +57,7 @@ class ClayTestBuilder:
self.suite_names = []
self.callback_data = {}
self.suite_data = {}
self.event_callbacks = []
self.clay_path = os.path.abspath(clay_path) if clay_path else None
......@@ -133,6 +149,18 @@ static const struct clay_func _clay_cb_${suite_name}[] = {
callbacks = ",\n\t".join(callbacks)
).strip()
def _render_event_overrides(self):
overrides = []
for event in CLAY_EVENTS:
if event in self.event_callbacks:
continue
overrides.append(
"#define clay_on_%s() /* nop */" % event
)
return '\n'.join(overrides)
def _render_header(self):
template = Template(self._load_file('clay.h'))
......@@ -169,6 +197,7 @@ static const struct clay_func _clay_cb_${suite_name}[] = {
clay_suites = ",\n\t".join(suite_data),
clay_suite_count = len(suite_data),
clay_callback_count = callback_count,
clay_event_overrides = self._render_event_overrides(),
)
def _load_file(self, filename):
......@@ -193,21 +222,34 @@ static const struct clay_func _clay_cb_${suite_name}[] = {
def _get_modules(self):
return "\n".join(self._load_file(f) for f in self.modules)
def _parse_comment(self, comment):
comment = comment[2:-2]
comment = comment.splitlines()
comment = [line.strip() for line in comment]
comment = "\n".join(comment)
def _skip_comments(self, text):
def _replacer(match):
s = match.group(0)
return "" if s.startswith('/') else s
return comment
return re.sub(SKIP_COMMENTS_REGEX, _replacer, text)
def _process_test_file(self, suite_name, contents):
regex_string = TEST_FUNC_REGEX % suite_name
regex = re.compile(regex_string, re.MULTILINE)
contents = self._skip_comments(contents)
self._process_events(contents)
self._process_declarations(suite_name, contents)
def _process_events(self, contents):
for (decl, event) in EVENT_CB_REGEX.findall(contents):
if event not in CLAY_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,
......@@ -255,9 +297,9 @@ static const struct clay_func _clay_cb_${suite_name}[] = {
CLAY_FILES = {
"clay.c" : r"""eJydWVtv3DYWftb8CnayjTW2PL7kzdMYCLKbwtjWBRIHKRAbAkfieLiRSFWkYnvT+e89PCQl6jJO0bx4dG48PJePh8wLLrKiyRn5iSrFar3cXs5etDTF9P/KakDTecHXIxqXQ1LNxX2fVlK9HSnSGqVmJ4ekZn80vGY52ciaKCrytXwEI+TwJFR5Uif6qWJqYAnISlPcAJA3OduQ9NPV9avz2YuolXrgIpcPVrWjOt87gtqyoqAVH5BzcC5zK0SwABeMpL++ubpO374laZrlLCsClnEnrmDPCfxckLT/3cmVX8CwY5QyZyDakQK5bNsSSRp8dBI0y5hSfVNjWuhhnTdVDH/QvfbDbIJvBMYw/fXq+udPr87TFIhRVdP7kpJMliUTOoZKSMgcw/XqfG4sB6ZFVj3FWiZkU8syIVqmiv8fXHKsVCHTkb1UevP+4/XbNzf/CY19Sn/7Lzk9Dygf0qsP/756Hz8uSBw/kpckBco7oCzID6/JaahcftGsrFIfgoIJDPCICCpM5Hwzi0x5mb2Do02mbeLIh5s3N+nNavaCFYr1igUq74FyUxcEitj8rHge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+r8Ro/B6JRWOo5RG5OuxM6QZYUeGfVAcdM9B6b3lRlpqr8ya4gu/363wZ0W9oekNjt4udvVA1N/1oNxuQvfiHc342TdbTYNa0u2XPiN9I/NV464Qs/e1a8PxiLJvClb63wD3Q6FA""",
......
......@@ -57,6 +57,8 @@ void cl_fixture_cleanup(const char *fixture_name);
/**
* Test method declarations
*/
extern void clay_on_init(void);
extern void clay_on_shutdown(void);
extern void test_buf_basic__printf(void);
extern void test_buf_basic__resize(void);
extern void test_config_add__cleanup(void);
......
#include "clay_libgit2.h"
void clay_on_init(void)
{
git_threads_init();
}
void clay_on_shutdown(void)
{
git_threads_shutdown();
}
......@@ -103,6 +103,10 @@ static void clay_print_onabort(const char *msg, ...);
static void clay_unsandbox(void);
static int clay_sandbox(void);
/* Event callback overrides */
#define clay_on_test() /* nop */
#define clay_on_suite() /* nop */
/* Autogenerated test data by clay */
static const struct clay_func _clay_cb_buf_basic[] = {
{"printf", &test_buf_basic__printf},
......@@ -528,6 +532,7 @@ clay_run_test(
{
int error_st = _clay.suite_errors;
clay_on_test();
_clay.trampoline_enabled = 1;
if (setjmp(_clay.trampoline) == 0) {
......@@ -583,6 +588,7 @@ clay_run_suite(const struct clay_suite *suite)
size_t i;
clay_print_onsuite(suite->name);
clay_on_suite();
_clay.active_suite = suite->name;
_clay.suite_errors = 0;
......@@ -661,11 +667,12 @@ clay_test(int argc, char **argv)
);
if (clay_sandbox() < 0) {
fprintf(stderr,
"Failed to sandbox the test runner.\n"
"Testing will proceed without sandboxing.\n");
clay_print_onabort("Failed to sandbox the test runner.\n");
exit(-1);
}
clay_on_init();
if (argc > 1) {
clay_parse_args(argc, argv);
} else {
......@@ -675,11 +682,13 @@ clay_test(int argc, char **argv)
}
clay_print_shutdown(
(int)_clay_callback_count,
_clay.test_count,
(int)_clay_suite_count,
_clay.total_errors
);
clay_on_shutdown();
clay_unsandbox();
return _clay.total_errors;
}
......@@ -1049,10 +1058,10 @@ cl_fs_cleanup(void)
static void clay_print_init(int test_count, int suite_count, const char *suite_names)
{
(void)test_count;
(void)suite_names;
(void)suite_count;
printf("TAP version 13\n");
printf("1..%d\n", test_count);
}
static void clay_print_shutdown(int test_count, int suite_count, int error_count)
......@@ -1061,7 +1070,12 @@ static void clay_print_shutdown(int test_count, int suite_count, int error_count
(void)suite_count;
(void)error_count;
printf("\n");
if (!error_count)
printf("# passed all %d test(s)\n", test_count);
else
printf("# failed %d among %d test(s)\n", error_count,
test_count);
printf("1..%d\n", test_count);
}
static void clay_print_error(int num, const struct clay_error *error)
......
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