Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
d02a7d83
Commit
d02a7d83
authored
Sep 28, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Clay
parent
35e9407c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
109 deletions
+77
-109
tests-clay/clay
+31
-57
tests-clay/clay.h
+36
-1
tests-clay/clay_main.c
+10
-51
No files found.
tests-clay/clay
View file @
d02a7d83
...
@@ -4,45 +4,19 @@ from __future__ import with_statement
...
@@ -4,45 +4,19 @@ from __future__ import with_statement
from
string
import
Template
from
string
import
Template
import
re
,
fnmatch
,
os
import
re
,
fnmatch
,
os
VERSION
=
"0.
7
.0"
VERSION
=
"0.
8
.0"
TEST_FUNC_REGEX
=
r"^(void\s+(test_
%
s__(\w+))\(\s*(void)?\s*\))\s*\{"
TEST_FUNC_REGEX
=
r"^(void\s+(test_
%
s__(\w+))\(\s*(void)?\s*\))\s*\{"
TEMPLATE_MAIN
=
Template
(
CLAY_HEADER
=
"""
r"""
/*
/*
* Clay v
${version}
* Clay v
0.7.0
*
*
* This is an autogenerated file. Do not modify.
* This is an autogenerated file. Do not modify.
* To add new unit tests or suites, regenerate the whole
* To add new unit tests or suites, regenerate the whole
* file with `./clay`
* file with `./clay`
*/
*/
"""
#define clay_print(...) ${clay_print}
${clay_library}
${extern_declarations}
static const struct clay_func _all_callbacks[] = {
${test_callbacks}
};
static const struct clay_suite _all_suites[] = {
${test_suites}
};
static const char _suites_str[] = "${suites_str}";
int _CC main(int argc, char *argv[])
{
return clay_test(
argc, argv, _suites_str,
_all_callbacks, ${cb_count},
_all_suites, ${suite_count}
);
}
"""
)
TEMPLATE_SUITE
=
Template
(
TEMPLATE_SUITE
=
Template
(
r"""
r"""
...
@@ -60,7 +34,6 @@ def main():
...
@@ -60,7 +34,6 @@ def main():
parser
=
OptionParser
()
parser
=
OptionParser
()
parser
.
add_option
(
'-c'
,
'--clay-path'
,
dest
=
'clay_path'
)
parser
.
add_option
(
'-c'
,
'--clay-path'
,
dest
=
'clay_path'
)
parser
.
add_option
(
'-o'
,
'--output'
,
dest
=
'output'
)
parser
.
add_option
(
'-v'
,
'--report-to'
,
dest
=
'print_mode'
,
default
=
'stdout'
)
parser
.
add_option
(
'-v'
,
'--report-to'
,
dest
=
'print_mode'
,
default
=
'stdout'
)
options
,
args
=
parser
.
parse_args
()
options
,
args
=
parser
.
parse_args
()
...
@@ -68,14 +41,13 @@ def main():
...
@@ -68,14 +41,13 @@ def main():
for
folder
in
args
:
for
folder
in
args
:
builder
=
ClayTestBuilder
(
folder
,
builder
=
ClayTestBuilder
(
folder
,
clay_path
=
options
.
clay_path
,
clay_path
=
options
.
clay_path
,
output_folder
=
options
.
output
,
print_mode
=
options
.
print_mode
)
print_mode
=
options
.
print_mode
)
builder
.
render
()
builder
.
render
()
class
ClayTestBuilder
:
class
ClayTestBuilder
:
def
__init__
(
self
,
folder_name
,
output_folder
=
None
,
clay_path
=
None
,
print_mode
=
'stdout'
):
def
__init__
(
self
,
path
,
clay_path
=
None
,
print_mode
=
'stdout'
):
self
.
declarations
=
[]
self
.
declarations
=
[]
self
.
callbacks
=
[]
self
.
callbacks
=
[]
self
.
suites
=
[]
self
.
suites
=
[]
...
@@ -84,22 +56,17 @@ class ClayTestBuilder:
...
@@ -84,22 +56,17 @@ class ClayTestBuilder:
self
.
clay_path
=
os
.
path
.
abspath
(
clay_path
)
if
clay_path
else
None
self
.
clay_path
=
os
.
path
.
abspath
(
clay_path
)
if
clay_path
else
None
self
.
print_mode
=
print_mode
self
.
print_mode
=
print_mode
folder_name
=
os
.
path
.
abspath
(
folder_name
)
self
.
path
=
os
.
path
.
abspath
(
path
)
if
not
output_folder
:
self
.
modules
=
[
"clay_sandbox.c"
,
"clay_fixtures.c"
,
"clay_fs.c"
]
output_folder
=
folder_name
self
.
output
=
os
.
path
.
join
(
output_folder
,
"clay_main.c"
)
self
.
output_header
=
os
.
path
.
join
(
output_folder
,
"clay.h"
)
self
.
modules
=
[
"clay.c"
,
"clay_sandbox.c"
,
"clay_fixtures.c"
,
"clay_fs.c"
]
print
(
"Loading test suites..."
)
print
(
"Loading test suites..."
)
for
root
,
dirs
,
files
in
os
.
walk
(
folder_name
):
for
root
,
dirs
,
files
in
os
.
walk
(
self
.
path
):
module_root
=
root
[
len
(
folder_name
):]
module_root
=
root
[
len
(
self
.
path
):]
module_root
=
[
c
for
c
in
module_root
.
split
(
os
.
sep
)
if
c
]
module_root
=
[
c
for
c
in
module_root
.
split
(
os
.
sep
)
if
c
]
tests_in_module
=
fnmatch
.
filter
(
files
,
"*.c"
)
tests_in_module
=
fnmatch
.
filter
(
files
,
"*.c"
)
tests_in_module
.
sort
()
for
test_file
in
tests_in_module
:
for
test_file
in
tests_in_module
:
full_path
=
os
.
path
.
join
(
root
,
test_file
)
full_path
=
os
.
path
.
join
(
root
,
test_file
)
...
@@ -113,11 +80,13 @@ class ClayTestBuilder:
...
@@ -113,11 +80,13 @@ class ClayTestBuilder:
'No tests found under "
%
s"'
%
folder_name
)
'No tests found under "
%
s"'
%
folder_name
)
def
render
(
self
):
def
render
(
self
):
template
=
TEMPLATE_MAIN
.
substitute
(
main_file
=
os
.
path
.
join
(
self
.
path
,
'clay_main.c'
)
version
=
VERSION
,
with
open
(
main_file
,
"w"
)
as
out
:
template
=
Template
(
self
.
_load_file
(
'clay.c'
))
output
=
template
.
substitute
(
clay_print
=
self
.
_get_print_method
(),
clay_print
=
self
.
_get_print_method
(),
clay_library
=
self
.
_get_library
(),
clay_modules
=
self
.
_get_modules
(),
extern_declarations
=
"
\n
"
.
join
(
self
.
declarations
),
suites_str
=
", "
.
join
(
self
.
suite_list
),
suites_str
=
", "
.
join
(
self
.
suite_list
),
...
@@ -128,14 +97,19 @@ class ClayTestBuilder:
...
@@ -128,14 +97,19 @@ class ClayTestBuilder:
suite_count
=
len
(
self
.
suites
),
suite_count
=
len
(
self
.
suites
),
)
)
with
open
(
self
.
output
,
"w"
)
as
out
:
out
.
write
(
output
)
out
.
write
(
template
)
header_file
=
os
.
path
.
join
(
self
.
path
,
'clay.h'
)
with
open
(
header_file
,
"w"
)
as
out
:
template
=
Template
(
self
.
_load_file
(
'clay.h'
))
output
=
template
.
substitute
(
extern_declarations
=
"
\n
"
.
join
(
self
.
declarations
),
)
with
open
(
self
.
output_header
,
"w"
)
as
out
:
out
.
write
(
output
)
out
.
write
(
self
.
_load_file
(
'clay.h'
))
print
(
'Written test suite to "
%
s"'
%
self
.
output
)
print
(
'Written Clay suite to "
%
s"'
%
self
.
path
)
print
(
'Written header to "
%
s"'
%
self
.
output_header
)
#####################################################
#####################################################
# Internal methods
# Internal methods
...
@@ -166,7 +140,7 @@ class ClayTestBuilder:
...
@@ -166,7 +140,7 @@ class ClayTestBuilder:
content
=
base64
.
b64decode
(
content
)
content
=
base64
.
b64decode
(
content
)
return
zlib
.
decompress
(
content
)
return
zlib
.
decompress
(
content
)
def
_get_
library
(
self
):
def
_get_
modules
(
self
):
return
"
\n
"
.
join
(
self
.
_load_file
(
f
)
for
f
in
self
.
modules
)
return
"
\n
"
.
join
(
self
.
_load_file
(
f
)
for
f
in
self
.
modules
)
def
_parse_comment
(
self
,
comment
):
def
_parse_comment
(
self
,
comment
):
...
@@ -217,11 +191,11 @@ class ClayTestBuilder:
...
@@ -217,11 +191,11 @@ class ClayTestBuilder:
print
(
"
%
s (
%
d tests)"
%
(
clean_name
,
len
(
callbacks
)))
print
(
"
%
s (
%
d tests)"
%
(
clean_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YXaKbgO7o9XVzCN2B4ziIncIOmWkDezrym9qYdj+7hmZSMZcoe6R9HEevVAkuXtpNeBVnQtMVlSXaZ7e6GdeD8y9HzfSeU79VEEhL5X6MI8EtstJF7GZwHMD6df8LLiKMPg
=="""
"clay.h"
:
r"""eJy9V
ctu2zAQPEdfsbV6sAQhTq9pGsAIbMSAERStg7YngqZWEVGZVEmqcVH030NSfkm2qqYHn0wtOTuzu0M65JlIMQNC7ubjb2Qx+bwg94QEoQ1ygUfxIOSCFVWKcKNNWvDlZX4bBD8lT4EV9BchVGtUZhhccGGASZFyw6VIggu71jaSUwVxxgtM6iOFZWntolJStWIpaqZ4ucnlgDqXVZESupTKRO93GohGQ1iBVFTl0MeG8eYzqr/jKIF6IUv6o0IL3mIz3YC6tCHPXH98F6azr4vHTxPycby4Dw7VOShfm0rhsFmmjxFBVw2WTVhTkS7l+jWQrbq/QEK0Pc+CYBTHAcQw9vOwbYMVZUpqeOYmB1yXBWfcgO81rFBr+oT2/Gg3ecu6qrQhpZ0oGVqASsBNIWoO2u9EcPsBrhLrlulsPiHEreazB78aTCvBvABGiwIyamefXsMAwn3OBN5FR8TuZD/xTSfvZF0iM5hC1hBgpNfQo6Am6ad/01235Ve2r46YaxDSgFEVnuLdzuouR/b9P+bEHO5Mg7qKjpnPPKlTEs4wqKuo51IJ+Y/XaSOpecPqYAIPj/P56cvQgtVd74Rtyt9hto5uArqt11fN3nR7jkMjdgrbe6YN7KnIH2pjOuqZSsWcoWxG+zaOnqkSXDy1a/AiTnimyykLtK9ufTEuB6cfjg3Ta7J+qSGQVsr9GEeCa2SVc9j14IT/vI4VmlymdtOSKOrOal/f29+4NqgEOdz5E2z/GF4ABeagMA
=="""
}
}
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
tests-clay/clay.h
View file @
d02a7d83
...
@@ -48,11 +48,46 @@ void cl_fixture_cleanup(const char *fixture_name);
...
@@ -48,11 +48,46 @@ void cl_fixture_cleanup(const char *fixture_name);
#define cl_check_fail(expr) cl_check_fail_((expr), NULL)
#define cl_check_fail(expr) cl_check_fail_((expr), NULL)
#define cl_check(expr) cl_check_((expr), NULL)
#define cl_check(expr) cl_check_((expr), NULL)
/**
/**
* Forced failure/warning
* Forced failure/warning
*/
*/
#define cl_fail(desc) clay__assert(0, __FILE__, __LINE__, "Test failed.", desc, 1)
#define cl_fail(desc) clay__assert(0, __FILE__, __LINE__, "Test failed.", desc, 1)
#define cl_warning(desc) clay__assert(0, __FILE__, __LINE__, "Warning during test execution:", desc, 0)
#define cl_warning(desc) clay__assert(0, __FILE__, __LINE__, "Warning during test execution:", desc, 0)
/**
* Test method declarations
*/
extern
void
test_core_dirent__dont_traverse_dot
(
void
);
extern
void
test_core_dirent__traverse_subfolder
(
void
);
extern
void
test_core_dirent__traverse_slash_terminated_folder
(
void
);
extern
void
test_core_dirent__dont_traverse_empty_folders
(
void
);
extern
void
test_core_dirent__traverse_weird_filenames
(
void
);
extern
void
test_core_filebuf__0
(
void
);
extern
void
test_core_filebuf__1
(
void
);
extern
void
test_core_filebuf__2
(
void
);
extern
void
test_core_path__0
(
void
);
extern
void
test_core_path__1
(
void
);
extern
void
test_core_path__2
(
void
);
extern
void
test_core_path__5
(
void
);
extern
void
test_core_path__6
(
void
);
extern
void
test_core_rmdir__initialize
(
void
);
extern
void
test_core_rmdir__delete_recursive
(
void
);
extern
void
test_core_rmdir__fail_to_delete_non_empty_dir
(
void
);
extern
void
test_core_string__0
(
void
);
extern
void
test_core_string__1
(
void
);
extern
void
test_core_vector__0
(
void
);
extern
void
test_core_vector__1
(
void
);
extern
void
test_core_vector__2
(
void
);
extern
void
test_network_remotes__initialize
(
void
);
extern
void
test_network_remotes__cleanup
(
void
);
extern
void
test_network_remotes__parsing
(
void
);
extern
void
test_network_remotes__refspec_parsing
(
void
);
extern
void
test_network_remotes__fnmatch
(
void
);
extern
void
test_network_remotes__transform
(
void
);
extern
void
test_status_single__hash_single_file
(
void
);
extern
void
test_status_worktree__initialize
(
void
);
extern
void
test_status_worktree__cleanup
(
void
);
extern
void
test_status_worktree__whole_repository
(
void
);
extern
void
test_status_worktree__empty_repository
(
void
);
#endif
#endif
tests-clay/clay_main.c
View file @
d02a7d83
/*
* Clay v0.7.0
*
* This is an autogenerated file. Do not modify.
* To add new unit tests or suites, regenerate the whole
* file with `./clay`
*/
#define clay_print(...) printf(__VA_ARGS__)
#include <assert.h>
#include <assert.h>
#include <setjmp.h>
#include <setjmp.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -20,6 +9,8 @@
...
@@ -20,6 +9,8 @@
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
#define clay_print(...) printf(__VA_ARGS__)
#ifdef _WIN32
#ifdef _WIN32
# include <windows.h>
# include <windows.h>
# include <io.h>
# include <io.h>
...
@@ -27,7 +18,7 @@
...
@@ -27,7 +18,7 @@
# include <direct.h>
# include <direct.h>
# pragma comment(lib, "shell32")
# pragma comment(lib, "shell32")
# define _CC __cdecl
# define _
MAIN_
CC __cdecl
# define stat(path, st) _stat(path, st)
# define stat(path, st) _stat(path, st)
# define mkdir(path, mode) _mkdir(path)
# define mkdir(path, mode) _mkdir(path)
...
@@ -42,8 +33,9 @@
...
@@ -42,8 +33,9 @@
# endif
# endif
typedef
struct
_stat
STAT_T
;
typedef
struct
_stat
STAT_T
;
#else
#else
# include <sys/wait.h>
/* waitpid(2) */
# include <unistd.h>
# include <unistd.h>
# define _CC
# define _
MAIN_
CC
typedef
struct
stat
STAT_T
;
typedef
struct
stat
STAT_T
;
#endif
#endif
...
@@ -455,8 +447,11 @@ static int build_sandbox_path(void)
...
@@ -455,8 +447,11 @@ static int build_sandbox_path(void)
#ifdef _MSC_VER
#ifdef _MSC_VER
if
(
_mktemp_s
(
_clay_path
,
sizeof
(
_clay_path
))
!=
0
)
if
(
_mktemp_s
(
_clay_path
,
sizeof
(
_clay_path
))
!=
0
)
return
-
1
;
return
-
1
;
if
(
mkdir
(
_clay_path
,
0700
)
!=
0
)
return
-
1
;
#else
#else
if
(
mktemp
(
_clay_path
)
==
NULL
)
if
(
mk
d
temp
(
_clay_path
)
==
NULL
)
return
-
1
;
return
-
1
;
#endif
#endif
...
@@ -468,9 +463,6 @@ static int clay_sandbox(void)
...
@@ -468,9 +463,6 @@ static int clay_sandbox(void)
if
(
_clay_path
[
0
]
==
'\0'
&&
build_sandbox_path
()
<
0
)
if
(
_clay_path
[
0
]
==
'\0'
&&
build_sandbox_path
()
<
0
)
return
-
1
;
return
-
1
;
if
(
mkdir
(
_clay_path
,
0700
)
!=
0
)
return
-
1
;
if
(
chdir
(
_clay_path
)
!=
0
)
if
(
chdir
(
_clay_path
)
!=
0
)
return
-
1
;
return
-
1
;
...
@@ -665,39 +657,6 @@ cl_fs_cleanup(void)
...
@@ -665,39 +657,6 @@ cl_fs_cleanup(void)
#endif
#endif
extern
void
test_core_dirent__dont_traverse_dot
(
void
);
extern
void
test_core_dirent__traverse_subfolder
(
void
);
extern
void
test_core_dirent__traverse_slash_terminated_folder
(
void
);
extern
void
test_core_dirent__dont_traverse_empty_folders
(
void
);
extern
void
test_core_dirent__traverse_weird_filenames
(
void
);
extern
void
test_core_filebuf__0
(
void
);
extern
void
test_core_filebuf__1
(
void
);
extern
void
test_core_filebuf__2
(
void
);
extern
void
test_core_path__0
(
void
);
extern
void
test_core_path__1
(
void
);
extern
void
test_core_path__2
(
void
);
extern
void
test_core_path__5
(
void
);
extern
void
test_core_path__6
(
void
);
extern
void
test_core_rmdir__initialize
(
void
);
extern
void
test_core_rmdir__delete_recursive
(
void
);
extern
void
test_core_rmdir__fail_to_delete_non_empty_dir
(
void
);
extern
void
test_core_string__0
(
void
);
extern
void
test_core_string__1
(
void
);
extern
void
test_core_vector__0
(
void
);
extern
void
test_core_vector__1
(
void
);
extern
void
test_core_vector__2
(
void
);
extern
void
test_network_remotes__initialize
(
void
);
extern
void
test_network_remotes__cleanup
(
void
);
extern
void
test_network_remotes__parsing
(
void
);
extern
void
test_network_remotes__refspec_parsing
(
void
);
extern
void
test_network_remotes__fnmatch
(
void
);
extern
void
test_network_remotes__transform
(
void
);
extern
void
test_status_single__hash_single_file
(
void
);
extern
void
test_status_worktree__initialize
(
void
);
extern
void
test_status_worktree__cleanup
(
void
);
extern
void
test_status_worktree__whole_repository
(
void
);
extern
void
test_status_worktree__empty_repository
(
void
);
static
const
struct
clay_func
_all_callbacks
[]
=
{
static
const
struct
clay_func
_all_callbacks
[]
=
{
{
"dont_traverse_dot"
,
&
test_core_dirent__dont_traverse_dot
,
0
},
{
"dont_traverse_dot"
,
&
test_core_dirent__dont_traverse_dot
,
0
},
{
"traverse_subfolder"
,
&
test_core_dirent__traverse_subfolder
,
0
},
{
"traverse_subfolder"
,
&
test_core_dirent__traverse_subfolder
,
0
},
...
@@ -787,7 +746,7 @@ static const struct clay_suite _all_suites[] = {
...
@@ -787,7 +746,7 @@ static const struct clay_suite _all_suites[] = {
static
const
char
_suites_str
[]
=
"core::dirent, core::filebuf, core::path, core::rmdir, core::string, core::vector, network::remotes, status::single, status::worktree"
;
static
const
char
_suites_str
[]
=
"core::dirent, core::filebuf, core::path, core::rmdir, core::string, core::vector, network::remotes, status::single, status::worktree"
;
int
_CC
main
(
int
argc
,
char
*
argv
[])
int
_
MAIN_
CC
main
(
int
argc
,
char
*
argv
[])
{
{
return
clay_test
(
return
clay_test
(
argc
,
argv
,
_suites_str
,
argc
,
argv
,
_suites_str
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment