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
156dfda8
Commit
156dfda8
authored
Sep 25, 2009
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ccanlint: don't use total_score to separate kinds of tests; we have subdirs
parent
4e0dfdad
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
29 deletions
+27
-29
.bzrignore
.bzrignore
+2
-1
tools/ccanlint/Makefile
tools/ccanlint/Makefile
+11
-8
tools/ccanlint/ccanlint.c
tools/ccanlint/ccanlint.c
+10
-11
tools/ccanlint/ccanlint.h
tools/ccanlint/ccanlint.h
+3
-2
tools/ccanlint/tests/build_objs.c
tools/ccanlint/tests/build_objs.c
+0
-2
tools/ccanlint/tests/compile_tests.c
tools/ccanlint/tests/compile_tests.c
+0
-2
tools/ccanlint/tests/run_tests.c
tools/ccanlint/tests/run_tests.c
+0
-2
tools/tools.h
tools/tools.h
+1
-1
No files found.
.bzrignore
View file @
156dfda8
...
...
@@ -6,7 +6,8 @@ tools/doc_extract
tools/namespacize
tools/run_tests
tools/ccanlint/ccanlint
tools/ccanlint/generated-init-tests
tools/ccanlint/generated-compulsory-tests
tools/ccanlint/generated-normal-tests
inter-depends
test-depends
lib-depends
...
...
tools/ccanlint/Makefile
View file @
156dfda8
TEST_CFILES
:=
$(
wildcard
tools/ccanlint/compulsory_tests/
*
.c
)
\
$(
wildcard
tools/ccanlint/tests/
*
.c
)
TEST_OBJS
:=
$(TEST_CFILES:.c=.o)
COMPULSORY_TEST_CFILES
:=
$(
wildcard
tools/ccanlint/compulsory_tests/
*
.c
)
NORMAL_TEST_CFILES
:=
$(
wildcard
tools/ccanlint/tests/
*
.c
)
TEST_OBJS
:=
$(
NORMAL_TEST_CFILES:.c=.o)
$(COMPULSORY_
TEST_CFILES:.c=.o)
CORE_OBJS
:=
tools/ccanlint/ccanlint.o
\
tools/ccanlint/file_analysis.o
\
...
...
@@ -13,17 +13,20 @@ CORE_OBJS := tools/ccanlint/ccanlint.o \
OBJS
:=
$(CORE_OBJS)
$(TEST_OBJS)
# FIXME: write a trivial C program to do this
tools/ccanlint/generated-init-tests
:
$(TEST_CFILES)
cat
$(TEST_CFILES)
|
grep
^REGISTER_TEST
>
$@
tools/ccanlint/generated-normal-tests
:
$(NORMAL_TEST_CFILES)
cat
$^
|
grep
^REGISTER_TEST
>
$@
tools/ccanlint/generated-compulsory-tests
:
$(COMPULSORY_TEST_CFILES)
cat
$^
|
grep
^REGISTER_TEST
>
$@
$(TEST_OBJS)
:
tools/ccanlint/generated-
init
-tests
$(TEST_OBJS)
:
tools/ccanlint/generated-
normal-tests tools/ccanlint/generated-compulsory
-tests
# Otherwise, ccanlint.c et al. may fail to build
$(CORE_OBJS)
:
tools/ccanlint/generated-
init
-tests
$(CORE_OBJS)
:
tools/ccanlint/generated-
normal-tests tools/ccanlint/generated-compulsory
-tests
tools/ccanlint/ccanlint
:
$(OBJS)
ccanlint-clean
:
$(RM)
tools/ccanlint/generated-init-tests
$(RM)
tools/ccanlint/generated-compulsory-tests
$(RM)
tools/ccanlint/generated-normal-tests
$(RM)
tools/ccanlint/ccanlint
tools/ccanlint/ccanlint.c
View file @
156dfda8
...
...
@@ -160,16 +160,13 @@ static bool run_test(struct ccanlint *i,
return
false
;
}
static
void
register_test
(
struct
ccanlint
*
test
,
...)
static
void
register_test
(
struct
list_head
*
h
,
struct
ccanlint
*
test
,
...)
{
va_list
ap
;
struct
ccanlint
*
depends
;
struct
dependent
*
dchild
;
if
(
!
test
->
total_score
)
list_add
(
&
compulsory_tests
,
&
test
->
list
);
else
list_add
(
&
normal_tests
,
&
test
->
list
);
list_add
(
h
,
&
test
->
list
);
va_start
(
ap
,
test
);
/* Careful: we might have been initialized by a dependent. */
...
...
@@ -211,8 +208,11 @@ static void init_tests(void)
const
struct
ccanlint
*
i
;
#undef REGISTER_TEST
#define REGISTER_TEST(name, ...) register_test(&name, __VA_ARGS__)
#include "generated-init-tests"
#define REGISTER_TEST(name, ...) register_test(&normal_tests, &name, __VA_ARGS__)
#include "generated-normal-tests"
#undef REGISTER_TEST
#define REGISTER_TEST(name, ...) register_test(&compulsory_tests, &name, __VA_ARGS__)
#include "generated-compulsory-tests"
if
(
!
verbose
)
return
;
...
...
@@ -289,10 +289,9 @@ int main(int argc, char *argv[])
if
(
verbose
)
printf
(
"
\n
Normal tests:
\n
"
);
score
=
total_score
=
0
;
while
((
i
=
get_next_test
(
&
normal_tests
))
!=
NULL
)
{
if
(
i
->
total_score
)
run_test
(
i
,
summary
,
&
score
,
&
total_score
,
m
);
}
while
((
i
=
get_next_test
(
&
normal_tests
))
!=
NULL
)
run_test
(
i
,
summary
,
&
score
,
&
total_score
,
m
);
printf
(
"Total score: %u/%u
\n
"
,
score
,
total_score
);
return
0
;
}
tools/ccanlint/ccanlint.h
View file @
156dfda8
...
...
@@ -5,7 +5,8 @@
#include "../doc_extract.h"
#define REGISTER_TEST(name, ...) extern struct ccanlint name
#include "generated-init-tests"
#include "generated-compulsory-tests"
#include "generated-normal-tests"
#undef REGISTER_TEST
#define REGISTER_TEST(name, ...)
...
...
@@ -41,7 +42,7 @@ struct ccanlint {
/* Unique name of test */
const
char
*
name
;
/* Total score that this test is worth.
0 means compulsory tests.
*/
/* Total score that this test is worth. */
unsigned
int
total_score
;
/* Can we run this test? Return string explaining why, if not. */
...
...
tools/ccanlint/tests/build_objs.c
View file @
156dfda8
...
...
@@ -49,7 +49,6 @@ static void *check_objs_build(struct manifest *m)
struct
ccan_file
*
i
;
/* One point for each obj file. */
build_objs
.
total_score
=
0
;
list_for_each
(
&
m
->
c_files
,
i
,
list
)
build_objs
.
total_score
++
;
...
...
@@ -71,7 +70,6 @@ static const char *describe_objs_build(struct manifest *m, void *check_result)
struct
ccanlint
build_objs
=
{
.
name
=
"Module object files can be built"
,
.
total_score
=
1
,
.
check
=
check_objs_build
,
.
describe
=
describe_objs_build
,
.
can_run
=
can_build
,
...
...
tools/ccanlint/tests/compile_tests.c
View file @
156dfda8
...
...
@@ -83,7 +83,6 @@ static void *do_compile_tests(struct manifest *m)
list_head_init
(
list
);
compile_tests
.
total_score
=
0
;
list_for_each
(
&
m
->
compile_ok_tests
,
i
,
list
)
{
compile_tests
.
total_score
++
;
cmdout
=
compile
(
list
,
m
,
i
,
false
,
false
);
...
...
@@ -178,7 +177,6 @@ static const char *describe_compile_tests(struct manifest *m,
struct
ccanlint
compile_tests
=
{
.
name
=
"Compile tests succeed"
,
.
total_score
=
1
,
.
score
=
score_compile_tests
,
.
check
=
do_compile_tests
,
.
describe
=
describe_compile_tests
,
...
...
tools/ccanlint/tests/run_tests.c
View file @
156dfda8
...
...
@@ -29,7 +29,6 @@ static void *do_run_tests(struct manifest *m)
list_head_init
(
list
);
run_tests
.
total_score
=
0
;
list_for_each
(
&
m
->
run_tests
,
i
,
list
)
{
char
*
testout
;
run_tests
.
total_score
++
;
...
...
@@ -80,7 +79,6 @@ static const char *describe_run_tests(struct manifest *m,
struct
ccanlint
run_tests
=
{
.
name
=
"run and api tests run successfully"
,
.
total_score
=
1
,
.
score
=
score_run_tests
,
.
check
=
do_run_tests
,
.
describe
=
describe_run_tests
,
...
...
tools/tools.h
View file @
156dfda8
...
...
@@ -9,7 +9,7 @@
#define SPACE_CHARS " \f\n\r\t\v"
/* FIXME: Remove some -I */
#define CFLAGS "-O3 -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan/ -I. -I../.."
#define CFLAGS "-O3 -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -Iccan/ -I.
.
-I../.."
/* This actually compiles and runs the info file to get dependencies. */
char
**
get_deps
(
const
void
*
ctx
,
const
char
*
dir
,
const
char
*
name
,
...
...
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