list_for_each(list, i, list) { char *err, *output; const char *options; score->total++; options = concat(score, per_file_options(&tests_pass_valgrind, i)); if (streq(options, "FAIL")) { i->leak_info = NULL; continue; } output = grab_file(i, i->valgrind_log); /* No valgrind errors? */ if (!output || output[0] == '\0') { err = NULL; i->leak_info = NULL; } else { i->leak_info = analyze_output(output, &err); } if (err) { score_file_error(score, i, 0, "%s", err); score->pass = false; } else score->score++; }
static void check_info_summary_single_line(struct manifest *m, unsigned int *timeleft, struct score *score) { struct list_head *infodocs = get_ccan_file_docs(m->info_file); struct doc_section *d; score->pass = true; score->score = 1; list_for_each(infodocs, d, list) { const char *after; if (!streq(d->type, "summary")) continue; /* line following summary line should be empty */ after = m->info_file->lines[d->srcline+1]; if (after && strspn(after, " *") != strlen(after)) { score->pass = false; score->score = 0; score_file_error(score, m->info_file, d->srcline+1, "%s\n%s", m->info_file->lines[d->srcline], m->info_file->lines[d->srcline+1]); } } }
list_for_each(list, f, list) { char **lines = get_ccan_file_lines(f); for (i = 0; f->lines[i]; i++) { char *err = get_trailing_whitespace(score, lines[i]); if (err) score_file_error(score, f, i+1, "%s", err); } }
static void do_build(struct manifest *m, bool keep, unsigned int *timeleft, struct score *score) { char *errstr; if (list_empty(&m->c_files)) { /* No files? No score, but we "pass". */ score->total = 0; score->pass = true; return; } m->compiled = build_module(m, keep, &errstr); if (!m->compiled) { score_file_error(score, NULL, 0, errstr); return; } score->pass = true; score->score = score->total; }
static void check_has_license(struct manifest *m, unsigned int *timeleft, struct score *score) { char buf[PATH_MAX]; ssize_t len; char *license = path_join(m, m->dir, "LICENSE"); const char *expected; struct doc_section *d; const char *prefix = link_prefix(m); d = find_license_tag(m); if (!d) { score->error = tal_strdup(score, "No License: tag in _info"); return; } m->license = which_license(d); if (m->license == LICENSE_UNKNOWN) { score_file_error(score, m->info_file, d->srcline, "WARNING: unknown License: in _info: %s", d->lines[0]); /* FIXME: For historical reasons, don't fail here. */ score->pass = true; return; } /* If they have a license tag at all, we pass. */ score->pass = true; expected = expected_link(m, prefix, m->license); len = readlink(license, buf, sizeof(buf)); if (len < 0) { /* Could be a real file... OK if not a standard license. */ if (errno == EINVAL) { if (!expected) { score->score = score->total; return; } score->error = tal_fmt(score, "License in _info is '%s'," " expect LICENSE symlink '%s'", d->lines[0], expected); return; } if (errno == ENOENT) { /* Public domain doesn't really need a file. */ if (m->license == LICENSE_PUBLIC_DOMAIN) { score->score = score->total; return; } score->error = tal_strdup(score, "LICENSE does not exist"); if (expected) license_exists.handle = handle_license_link; return; } err(1, "readlink on %s", license); } if (len >= sizeof(buf)) errx(1, "Reading symlink %s gave huge result", license); buf[len] = '\0'; if (!strstarts(buf, prefix)) { score->error = tal_fmt(score, "Expected symlink into %s not %s", prefix, buf); return; } if (!expected) { score->error = tal_fmt(score, "License in _info is unknown '%s'," " but LICENSE symlink is '%s'", d->lines[0], buf); return; } if (!streq(buf, expected)) { score->error = tal_fmt(score, "Expected symlink to %s not %s", expected, buf); return; } score->pass = true; score->score = score->total; }