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
61c38f61
Commit
61c38f61
authored
May 09, 2016
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ccanlint: fix missing file.
Signed-off-by:
Rusty Russell
<
rusty@rustcorp.com.au
>
parent
2512fecb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
tools/ccanlint/tests/info_compiles.c
tools/ccanlint/tests/info_compiles.c
+70
-0
No files found.
tools/ccanlint/tests/info_compiles.c
0 → 100644
View file @
61c38f61
#include <tools/ccanlint/ccanlint.h>
#include <tools/tools.h>
#include <ccan/tal/grab_file/grab_file.h>
#include <ccan/read_write_all/read_write_all.h>
#include <ccan/str/str.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
#include <string.h>
#include <ctype.h>
static
void
check_info_compiles
(
struct
manifest
*
m
,
unsigned
int
*
timeleft
,
struct
score
*
score
)
{
char
*
info_c_file
,
*
info
,
*
output
;
int
fd
;
/* We don't really fail if we're in safe mode: our dependencies
* still run. */
if
(
safe_mode
)
{
score
->
pass
=
true
;
score
->
score
=
0
;
return
;
}
/* Copy it to a file with proper .c suffix. */
info
=
grab_file
(
score
,
m
->
info_file
->
fullname
);
if
(
!
info
)
{
score_file_error
(
score
,
m
->
info_file
,
0
,
"could not be read: %s"
,
strerror
(
errno
));
return
;
}
info_c_file
=
temp_file
(
info
,
".c"
,
"_info"
);
fd
=
open
(
info_c_file
,
O_WRONLY
|
O_CREAT
|
O_EXCL
,
0600
);
if
(
fd
<
0
||
!
write_all
(
fd
,
info
,
tal_count
(
info
)
-
1
))
err
(
1
,
"Copying _info file"
);
if
(
close
(
fd
)
!=
0
)
err
(
1
,
"Closing _info file"
);
m
->
info_file
->
compiled
[
COMPILE_NORMAL
]
=
temp_file
(
m
,
""
,
"info"
);
if
(
!
compile_and_link
(
score
,
info_c_file
,
find_ccan_dir
(
m
->
dir
),
""
,
compiler
,
cflags
,
""
,
m
->
info_file
->
compiled
[
COMPILE_NORMAL
],
&
output
))
{
score_file_error
(
score
,
m
->
info_file
,
0
,
"Errors compiling _info:
\n
%s"
,
output
);
return
;
}
score
->
pass
=
true
;
score
->
score
=
1
;
}
struct
ccanlint
info_compiles
=
{
.
key
=
"info_compiles"
,
.
name
=
"_info compiles"
,
.
check
=
check_info_compiles
,
.
needs
=
"info_exists"
,
.
compulsory
=
true
};
REGISTER_TEST
(
info_compiles
);
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