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
6c1d3e27
Commit
6c1d3e27
authored
Mar 01, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ccanlint: run tests with reduced-feature config.h
parent
b401a01a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
9 deletions
+53
-9
tools/ccanlint/tests/reduce_features.c
tools/ccanlint/tests/reduce_features.c
+2
-0
tools/ccanlint/tests/tests_compile.c
tools/ccanlint/tests/tests_compile.c
+41
-9
tools/ccanlint/tests/tests_pass.c
tools/ccanlint/tests/tests_pass.c
+10
-0
No files found.
tools/ccanlint/tests/reduce_features.c
View file @
6c1d3e27
...
...
@@ -174,6 +174,8 @@ struct ccanlint reduce_features = {
.
name
=
"Produce config.h with reduced features"
,
.
can_run
=
can_run
,
.
check
=
do_reduce_features
,
/* We only want to compile up versions with reduced featuress once
* objects for normal tests are built. */
.
needs
=
"tests_compile"
};
REGISTER_TEST
(
reduce_features
);
tools/ccanlint/tests/tests_compile.c
View file @
6c1d3e27
...
...
@@ -14,6 +14,7 @@
#include <err.h>
#include <string.h>
#include <ctype.h>
#include "reduce_features.h"
static
const
char
*
can_build
(
struct
manifest
*
m
)
{
...
...
@@ -62,12 +63,13 @@ static char *lib_list(const struct manifest *m)
static
bool
compile
(
const
void
*
ctx
,
struct
manifest
*
m
,
struct
ccan_file
*
file
,
const
char
*
flags
,
bool
fail
,
bool
link_with_module
,
bool
keep
,
char
**
output
)
{
char
*
f
=
talloc_asprintf
(
ctx
,
"%s%s"
,
fail
?
"-DFAIL "
:
""
,
cflags
);
char
*
f
=
talloc_asprintf
(
ctx
,
"%s%s
%s
"
,
f
lags
,
f
ail
?
"-DFAIL "
:
""
,
cflags
);
file
->
compiled
=
maybe_temp_file
(
ctx
,
""
,
keep
,
file
->
fullname
);
if
(
!
compile_and_link
(
ctx
,
file
->
fullname
,
ccan_dir
,
...
...
@@ -79,9 +81,8 @@ static bool compile(const void *ctx,
return
true
;
}
static
void
do_compile_tests
(
struct
manifest
*
m
,
bool
keep
,
unsigned
int
*
timeleft
,
struct
score
*
score
)
static
void
compile_tests
(
struct
manifest
*
m
,
bool
keep
,
struct
score
*
score
,
const
char
*
incl
)
{
char
*
cmdout
;
struct
ccan_file
*
i
;
...
...
@@ -90,8 +91,8 @@ static void do_compile_tests(struct manifest *m,
foreach_ptr
(
list
,
&
m
->
compile_ok_tests
,
&
m
->
run_tests
,
&
m
->
api_tests
)
{
list_for_each
(
list
,
i
,
list
)
{
if
(
!
compile
(
score
,
m
,
i
,
false
,
list
==
&
m
->
api_tests
,
keep
,
&
cmdout
))
{
if
(
!
compile
(
score
,
m
,
i
,
incl
,
false
,
list
==
&
m
->
api_tests
,
keep
,
&
cmdout
))
{
score_file_error
(
score
,
i
,
0
,
"Compile failed:
\n
%s"
,
cmdout
);
...
...
@@ -111,7 +112,7 @@ static void do_compile_tests(struct manifest *m,
/* For historical reasons, "fail" often means "gives warnings" */
list_for_each
(
&
m
->
compile_fail_tests
,
i
,
list
)
{
if
(
!
compile
(
score
,
m
,
i
,
false
,
false
,
false
,
&
cmdout
))
{
if
(
!
compile
(
score
,
m
,
i
,
incl
,
false
,
false
,
false
,
&
cmdout
))
{
score_file_error
(
score
,
i
,
0
,
"Compile without -DFAIL failed:
\n
%s"
,
cmdout
);
...
...
@@ -124,7 +125,7 @@ static void do_compile_tests(struct manifest *m,
cmdout
);
return
;
}
if
(
compile
(
score
,
m
,
i
,
true
,
false
,
false
,
&
cmdout
)
if
(
compile
(
score
,
m
,
i
,
incl
,
true
,
false
,
false
,
&
cmdout
)
&&
streq
(
cmdout
,
""
))
{
score_file_error
(
score
,
i
,
0
,
"Compiled successfully with -DFAIL?"
);
...
...
@@ -137,6 +138,13 @@ static void do_compile_tests(struct manifest *m,
score
->
score
=
1
+
!
warnings
;
}
static
void
do_compile_tests
(
struct
manifest
*
m
,
bool
keep
,
unsigned
int
*
timeleft
,
struct
score
*
score
)
{
return
compile_tests
(
m
,
keep
,
score
,
""
);
}
struct
ccanlint
tests_compile
=
{
.
key
=
"tests_compile"
,
.
name
=
"Module tests compile"
,
...
...
@@ -146,3 +154,27 @@ struct ccanlint tests_compile = {
};
REGISTER_TEST
(
tests_compile
);
static
const
char
*
features_reduced
(
struct
manifest
*
m
)
{
if
(
features_were_reduced
)
return
NULL
;
return
"No features to turn off"
;
}
static
void
do_compile_tests_without_features
(
struct
manifest
*
m
,
bool
keep
,
unsigned
int
*
timeleft
,
struct
score
*
score
)
{
return
compile_tests
(
m
,
keep
,
score
,
"-I. "
);
}
struct
ccanlint
tests_compile_without_features
=
{
.
key
=
"tests_compile_without_features"
,
.
name
=
"Module tests compile (without features)"
,
.
check
=
do_compile_tests_without_features
,
.
can_run
=
features_reduced
,
.
needs
=
"reduce_features"
};
REGISTER_TEST
(
tests_compile_without_features
);
tools/ccanlint/tests/tests_pass.c
View file @
6c1d3e27
...
...
@@ -75,3 +75,13 @@ struct ccanlint tests_pass = {
};
REGISTER_TEST
(
tests_pass
);
struct
ccanlint
tests_pass_without_features
=
{
.
key
=
"tests_pass_without_features"
,
.
name
=
"Module's run and api tests pass (without features)"
,
.
check
=
do_run_tests
,
.
handle
=
run_under_debugger
,
.
needs
=
"tests_pass reduce_features"
};
REGISTER_TEST
(
tests_pass_without_features
);
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