summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-12-02 14:07:20 +1030
committerRusty Russell <rusty@rustcorp.com.au>2011-12-02 14:07:20 +1030
commit64bd9ff9bc3e65bb0e77b982135d6612cda180cd (patch)
treed5071ccb3a187ee360dda4ed0a19779155b3e78f
parented4ee95401575dd314f7ca5b3719e0e22ef0c6e5 (diff)
ccanlint: remove wart from info options.
Make info_exists() call add_info_options() directly, rather than detecting that we've found _info inside the loop of tests. It means targeting is now a global, which is a bit sucky.
-rw-r--r--tools/ccanlint/ccanlint.c12
-rw-r--r--tools/ccanlint/ccanlint.h3
-rw-r--r--tools/ccanlint/tests/info_exists.c1
3 files changed, 7 insertions, 9 deletions
diff --git a/tools/ccanlint/ccanlint.c b/tools/ccanlint/ccanlint.c
index d80c11d1..fd7e0c71 100644
--- a/tools/ccanlint/ccanlint.c
+++ b/tools/ccanlint/ccanlint.c
@@ -41,6 +41,7 @@ TLIST_TYPE(ccanlint, struct ccanlint);
int verbose = 0;
static struct tlist_ccanlint tests = TLIST_INIT(tests);
bool safe_mode = false;
+static bool targeting = false;
static struct btree *cmdline_exclude;
static struct btree *info_exclude;
static unsigned int timeout;
@@ -421,7 +422,7 @@ static void add_options(struct ccanlint *test, char **options,
memcpy(&test->options[num], options, (num_options + 1)*sizeof(char *));
}
-static void add_info_options(struct ccan_file *info, bool mark_fails)
+void add_info_options(struct ccan_file *info)
{
struct doc_section *d;
unsigned int i;
@@ -456,7 +457,7 @@ static void add_info_options(struct ccan_file *info, bool mark_fails)
/* Known failure? */
if (strcasecmp(words[1], "FAIL") == 0) {
- if (mark_fails)
+ if (!targeting)
btree_insert(info_exclude, words[0]);
} else {
if (!test->takes_options)
@@ -698,7 +699,6 @@ int main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
unsigned int score, total_score;
- bool added_info_options = false;
dir = argv[i];
@@ -748,12 +748,6 @@ int main(int argc, char *argv[])
goto next;
}
}
-
- /* --target overrides known FAIL from _info */
- if (!added_info_options && m->info_file) {
- add_info_options(m->info_file, !target);
- added_info_options = true;
- }
}
printf("%sTotal score: %u/%u\n", prefix, score, total_score);
diff --git a/tools/ccanlint/ccanlint.h b/tools/ccanlint/ccanlint.h
index 16600cff..6fdc0216 100644
--- a/tools/ccanlint/ccanlint.h
+++ b/tools/ccanlint/ccanlint.h
@@ -264,6 +264,9 @@ struct dependent {
/* Is this test excluded (cmdline or _info). */
bool is_excluded(const char *name);
+/* Called to add options from _info, once it's located. */
+void add_info_options(struct ccan_file *info);
+
/* Are we happy to compile stuff, or just non-intrusive tests? */
extern bool safe_mode;
diff --git a/tools/ccanlint/tests/info_exists.c b/tools/ccanlint/tests/info_exists.c
index 80edb5aa..5e04bd8d 100644
--- a/tools/ccanlint/tests/info_exists.c
+++ b/tools/ccanlint/tests/info_exists.c
@@ -20,6 +20,7 @@ static void check_has_info(struct manifest *m,
if (m->info_file) {
score->pass = true;
score->score = score->total;
+ add_info_options(m->info_file);
} else {
score->error = talloc_strdup(score,
"You have no _info file.\n\n"