X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Flicense_exists.c;h=a841d665b2e8f683ca61f831e8b9f794b347ec52;hb=b0fa019adb998c20a8740f5696b61ae87d2a77a6;hp=1ae27dd35266e6a7ca1fd9f55626dae69587a37e;hpb=db43894721895d0ec0a8e599440a9897136bfcb6;p=ccan diff --git a/tools/ccanlint/tests/license_exists.c b/tools/ccanlint/tests/license_exists.c index 1ae27dd3..a841d665 100644 --- a/tools/ccanlint/tests/license_exists.c +++ b/tools/ccanlint/tests/license_exists.c @@ -11,8 +11,6 @@ #include #include -REGISTER_TEST(license_exists); - static struct doc_section *find_license(const struct manifest *m) { struct doc_section *d; @@ -51,10 +49,11 @@ static const char *expected_link(const struct manifest *m, || streq(d->lines[0], "LGPLv2 (or later)") || streq(d->lines[0], "LGPL (2 or any later version)")) return "../../licenses/LGPL-2.1"; - if (streq(d->lines[0], "BSD") - || streq(d->lines[0], "BSD-MIT") + if (streq(d->lines[0], "BSD-MIT") || streq(d->lines[0], "MIT")) return "../../licenses/BSD-MIT"; + if (streq(d->lines[0], "BSD (3 clause)")) + return "../../licenses/BSD-3CLAUSE"; return NULL; } @@ -78,6 +77,8 @@ static void handle_license_link(struct manifest *m, struct score *score) } } +extern struct ccanlint license_exists; + static void check_has_license(struct manifest *m, bool keep, unsigned int *timeleft, struct score *score) @@ -93,6 +94,9 @@ static void check_has_license(struct manifest *m, score->error = talloc_strdup(score, "No License: tag in _info"); return; } + /* If they have a license tag at all, we pass. */ + score->pass = true; + expected = expected_link(m, d); len = readlink(license, buf, sizeof(buf)); @@ -156,3 +160,4 @@ struct ccanlint license_exists = { .check = check_has_license, .needs = "info_exists" }; +REGISTER_TEST(license_exists);