Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
7eb00644
Commit
7eb00644
authored
Feb 14, 2009
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teach ccanlint about API tests.
parent
f732cc9b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
tools/ccanlint/ccanlint.h
tools/ccanlint/ccanlint.h
+1
-0
tools/ccanlint/file_analysis.c
tools/ccanlint/file_analysis.c
+4
-1
tools/ccanlint/has_tests.c
tools/ccanlint/has_tests.c
+8
-3
No files found.
tools/ccanlint/ccanlint.h
View file @
7eb00644
...
...
@@ -12,6 +12,7 @@ struct manifest {
struct
list_head
h_files
;
struct
list_head
run_tests
;
struct
list_head
api_tests
;
struct
list_head
compile_ok_tests
;
struct
list_head
compile_fail_tests
;
struct
list_head
other_test_files
;
...
...
tools/ccanlint/file_analysis.c
View file @
7eb00644
...
...
@@ -85,7 +85,9 @@ static void add_files(struct manifest *m, const char *dir)
dest
=
&
m
->
h_files
;
}
else
if
(
strstarts
(
f
->
name
,
"test/"
))
{
if
(
is_c_src
)
{
if
(
strstarts
(
f
->
name
,
"test/run"
))
if
(
strstarts
(
f
->
name
,
"test/api"
))
dest
=
&
m
->
api_tests
;
else
if
(
strstarts
(
f
->
name
,
"test/run"
))
dest
=
&
m
->
run_tests
;
else
if
(
strstarts
(
f
->
name
,
"test/compile_ok"
))
dest
=
&
m
->
compile_ok_tests
;
...
...
@@ -135,6 +137,7 @@ struct manifest *get_manifest(void)
m
->
info_file
=
NULL
;
list_head_init
(
&
m
->
c_files
);
list_head_init
(
&
m
->
h_files
);
list_head_init
(
&
m
->
api_tests
);
list_head_init
(
&
m
->
run_tests
);
list_head_init
(
&
m
->
compile_ok_tests
);
list_head_init
(
&
m
->
compile_fail_tests
);
...
...
tools/ccanlint/has_tests.c
View file @
7eb00644
...
...
@@ -25,7 +25,9 @@ static void *check_has_tests(struct manifest *m)
if
(
!
S_ISDIR
(
st
.
st_mode
))
return
test_is_not_dir
;
if
(
list_empty
(
&
m
->
run_tests
)
&&
list_empty
(
&
m
->
compile_ok_tests
))
{
if
(
list_empty
(
&
m
->
api_tests
)
&&
list_empty
(
&
m
->
run_tests
)
&&
list_empty
(
&
m
->
compile_ok_tests
))
{
if
(
list_empty
(
&
m
->
compile_fail_tests
))
return
"You have no tests in the test directory"
;
else
...
...
@@ -38,7 +40,7 @@ static const char *describe_has_tests(struct manifest *m, void *check_result)
{
return
talloc_asprintf
(
m
,
"%s
\n\n
"
"CCAN modules have a directory called test/ which contains tests.
\n
"
"There are
three kinds of tests:
run, compile_ok and compile_fail:
\n
"
"There are
four kinds of tests: api,
run, compile_ok and compile_fail:
\n
"
"you can tell which type of test a C file is by its name, eg 'run.c'
\n
"
"and 'run-simple.c' are both run tests.
\n\n
"
"The simplest kind of test is a run test, which must compile with no
\n
"
...
...
@@ -49,7 +51,10 @@ static const char *describe_has_tests(struct manifest *m, void *check_result)
"compile_fail tests are tests which should fail to compile (or emit
\n
"
"warnings) or link when FAIL is defined, but should compile and link
\n
"
"when it's not defined: this helps ensure unrelated errors don't make
\n
"
"compilation fail.
\n\n
"
"compilation fail.
\n
"
"api tests are just like a run test, except it is a guarantee of API
\n
"
"stability: this test should pass on all future versions of the
\n
"
"module.
\n\n
"
"Note that the tests are not linked against the files in the
\n
"
"above: you should directly #include those C files you want. This
\n
"
"allows access to static functions and use special effects inside
\n
"
...
...
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