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
9c1974f6
Commit
9c1974f6
authored
Apr 07, 2009
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability for _info to specify libraries (particularly, -lm).
parent
914fa0bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
14 deletions
+27
-14
Makefile
Makefile
+5
-2
tools/run_tests.c
tools/run_tests.c
+22
-12
No files found.
Makefile
View file @
9c1974f6
...
...
@@ -27,9 +27,12 @@ $(ALL_DEPENDS): %/.depends: %/_info.c tools/ccan_depends
@
tools/ccan_depends
$*
>
$@
||
(
rm
-f
$@
;
exit
1
)
# Actual dependencies are created in inter-depends
check-%
:
tools/run_tests
check-%
:
tools/run_tests
ccan/%/_info
@
echo
Testing
$*
...
@
if
tools/run_tests
$(V)
`
[
!
-f
ccan/
$*
.o
]
||
echo
--apiobj
=
ccan/
$*
.o
`
ccan/
$*
$(
filter-out
ccan/
$*
.o,
$(
filter
%.o,
$^
))
|
grep
^
'not ok'
;
then
exit
1
;
else
exit
0
;
fi
@
if
tools/run_tests
$(V)
$$
(
for
f
in
`
ccan/
$*
/_info libs
`
;
do
echo
--lib
=
$$
f
;
done
)
`
[
!
-f
ccan/
$*
.o
]
||
echo
--apiobj
=
ccan/
$*
.o
`
ccan/
$*
$(
filter-out
ccan/
$*
.o,
$(
filter
%.o,
$^
))
|
grep
^
'not ok'
;
then
exit
1
;
else
exit
0
;
fi
ccan/%/_info
:
ccan/%/_info.c
$(CC)
$(CFLAGS)
-o
$@
$<
libccan.a(%.o)
:
ccan/%.o
$(AR)
r
$@
$<
...
...
tools/run_tests.c
View file @
9c1974f6
...
...
@@ -19,7 +19,7 @@ static int verbose;
struct
test_type
{
const
char
*
name
;
void
(
*
buildfn
)(
const
char
*
dir
,
struct
test_type
*
t
,
const
char
*
name
,
const
char
*
apiobj
);
const
char
*
apiobj
,
const
char
*
libs
);
void
(
*
runfn
)(
const
char
*
name
);
};
...
...
@@ -103,14 +103,14 @@ static void add_obj(const char *testdir, const char *name, bool generate)
}
static
int
build
(
const
char
*
dir
,
const
char
*
name
,
const
char
*
apiobj
,
int
fail
)
const
char
*
libs
,
int
fail
)
{
const
char
*
cmd
;
int
ret
;
cmd
=
talloc_asprintf
(
name
,
"gcc "
CFLAGS
" %s -o %s %s %s %s %s"
,
cmd
=
talloc_asprintf
(
name
,
"gcc "
CFLAGS
" %s -o %s %s %s %s
%s
%s"
,
fail
?
"-DFAIL"
:
""
,
output_name
(
name
),
name
,
apiobj
,
obj_list
(),
output_name
(
name
),
name
,
apiobj
,
obj_list
(),
libs
,
verbose
?
""
:
"> /dev/null 2>&1"
);
if
(
verbose
)
...
...
@@ -124,25 +124,26 @@ static int build(const char *dir, const char *name, const char *apiobj,
}
static
void
compile_ok
(
const
char
*
dir
,
struct
test_type
*
t
,
const
char
*
name
,
const
char
*
apiobj
)
const
char
*
apiobj
,
const
char
*
libs
)
{
ok
(
build
(
dir
,
name
,
""
,
0
)
==
0
,
"%s %s"
,
t
->
name
,
name
);
ok
(
build
(
dir
,
name
,
""
,
libs
,
0
)
==
0
,
"%s %s"
,
t
->
name
,
name
);
}
/* api tests get the API obj linked in as well. */
static
void
compile_api_ok
(
const
char
*
dir
,
struct
test_type
*
t
,
const
char
*
name
,
const
char
*
apiobj
)
const
char
*
name
,
const
char
*
apiobj
,
const
char
*
libs
)
{
ok
(
build
(
dir
,
name
,
apiobj
,
0
)
==
0
,
"%s %s"
,
t
->
name
,
name
);
ok
(
build
(
dir
,
name
,
apiobj
,
libs
,
0
)
==
0
,
"%s %s"
,
t
->
name
,
name
);
}
static
void
compile_fail
(
const
char
*
dir
,
struct
test_type
*
t
,
const
char
*
name
,
const
char
*
apiobj
)
const
char
*
apiobj
,
const
char
*
libs
)
{
if
(
build
(
dir
,
name
,
""
,
0
)
!=
0
)
if
(
build
(
dir
,
name
,
""
,
libs
,
0
)
!=
0
)
fail
(
"non-FAIL build %s"
,
name
);
else
ok
(
build
(
dir
,
name
,
""
,
1
)
>
0
,
"%s %s"
,
t
->
name
,
name
);
ok
(
build
(
dir
,
name
,
""
,
libs
,
1
)
>
0
,
"%s %s"
,
t
->
name
,
name
);
}
static
void
no_run
(
const
char
*
name
)
...
...
@@ -173,6 +174,7 @@ int main(int argc, char *argv[])
struct
dirent
*
d
;
char
*
testdir
,
*
cwd
;
const
char
*
apiobj
=
""
;
char
*
libs
=
talloc_strdup
(
NULL
,
""
);
struct
test
*
test
;
unsigned
int
num_tests
=
0
,
num_objs
=
0
,
i
;
...
...
@@ -182,6 +184,13 @@ int main(int argc, char *argv[])
argv
++
;
}
while
(
argc
>
1
&&
strstarts
(
argv
[
1
],
"--lib="
))
{
libs
=
talloc_asprintf_append
(
libs
,
" -l%s"
,
argv
[
1
]
+
strlen
(
"--lib="
));
argc
--
;
argv
++
;
}
if
(
argc
>
1
&&
strstarts
(
argv
[
1
],
"--apiobj="
))
{
apiobj
=
argv
[
1
]
+
strlen
(
"--apiobj="
);
argc
--
;
...
...
@@ -224,7 +233,8 @@ int main(int argc, char *argv[])
/* Do all the test compilations. */
for
(
test
=
tests
;
test
;
test
=
test
->
next
)
test
->
type
->
buildfn
(
argv
[
1
],
test
->
type
,
test
->
name
,
apiobj
);
test
->
type
->
buildfn
(
argv
[
1
],
test
->
type
,
test
->
name
,
apiobj
,
libs
);
cleanup_objs
();
...
...
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