]> git.ozlabs.org Git - ccan/blob - tools/ccanlint/tests/depends_build_without_features.c
base64: fix for unsigned chars (e.g. ARM).
[ccan] / tools / ccanlint / tests / depends_build_without_features.c
1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/str/str.h>
4 #include <ccan/foreach/foreach.h>
5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <fcntl.h>
8 #include <unistd.h>
9 #include <limits.h>
10 #include <errno.h>
11 #include <stdlib.h>
12 #include <stdio.h>
13 #include <err.h>
14 #include <string.h>
15 #include <ctype.h>
16 #include "reduce_features.h"
17 #include "build.h"
18
19 static const char *can_build(struct manifest *m UNNEEDED)
20 {
21         if (safe_mode)
22                 return "Safe mode enabled";
23         return NULL;
24 }
25
26 static void check_depends_built_without_features(struct manifest *m,
27                                                  unsigned int *timeleft UNNEEDED,
28                                                  struct score *score)
29 {
30         struct list_head *list;
31         struct manifest *i;
32         char *flags;
33
34         flags = tal_fmt(score, "%s %s", cflags, REDUCE_FEATURES_FLAGS);
35
36         foreach_ptr(list, &m->deps, &m->test_deps) {
37                 list_for_each(list, i, list) {
38                         char *errstr = build_submodule(i, flags,
39                                                        COMPILE_NOFEAT);
40
41                         if (errstr) {
42                                 score->error = tal_fmt(score,
43                                                        "Dependency %s"
44                                                        " did not build:\n%s",
45                                                        i->modname,
46                                                        errstr);
47                                 return;
48                         }
49                 }
50         }
51
52         score->pass = true;
53         score->score = score->total;
54 }
55
56 struct ccanlint depends_build_without_features = {
57         .key = "depends_build_without_features",
58         .name = "Module's CCAN dependencies can be found or built (reduced features)",
59         .check = check_depends_built_without_features,
60         .can_run = can_build,
61         .needs = "depends_build reduce_features"
62 };
63
64 REGISTER_TEST(depends_build_without_features);