]> git.ozlabs.org Git - ccan/blob - tools/ccanlint/tests/info_ported.c
f58f2f3498e3665125568f81a33b319017d2f1f7
[ccan] / tools / ccanlint / tests / info_ported.c
1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/str/str.h>
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <fcntl.h>
7 #include <unistd.h>
8 #include <limits.h>
9 #include <errno.h>
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <err.h>
13 #include <string.h>
14 #include <ctype.h>
15
16 static const char *can_build(struct manifest *m)
17 {
18         /* FIXME: In safe mode, we'd need complex guesstiparsing. */
19         if (safe_mode)
20                 return NULL;
21
22         if (get_ported(m, m->dir, true, get_or_compile_info))
23                 return NULL;
24         return "'_info ported' says not supported";
25 }
26
27 static void check_info_ported(struct manifest *m,
28                               unsigned int *timeleft, struct score *score)
29 {
30         score->pass = true;
31         score->score = 1;
32 }
33
34 struct ccanlint info_ported = {
35         .key = "info_ported",
36         .can_run = can_build,
37         .name = "_info indicates support for this platform",
38         .check = check_info_ported,
39         .needs = "info_exists"
40 };
41
42 REGISTER_TEST(info_ported);