X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Flicense_exists.c;h=83bc769a084e3d8f28842fb8c2fd40fd7b04cab0;hb=104125b2dd0a044fb3d68f9bc3b1b18c9f32ae2b;hp=965a159ff8fff53f15bea96d4675c052eedbd9f0;hpb=051db34fb275491d4d5dfa5bf7970e8e525766d8;p=ccan diff --git a/tools/ccanlint/tests/license_exists.c b/tools/ccanlint/tests/license_exists.c index 965a159f..83bc769a 100644 --- a/tools/ccanlint/tests/license_exists.c +++ b/tools/ccanlint/tests/license_exists.c @@ -11,7 +11,7 @@ #include #include -struct ccanlint has_license; +REGISTER_TEST(license_exists); static struct doc_section *find_license(const struct manifest *m) { @@ -51,10 +51,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; } @@ -90,7 +91,7 @@ static void check_has_license(struct manifest *m, d = find_license(m); if (!d) { - score->error = "No License: tag in _info"; + score->error = talloc_strdup(score, "No License: tag in _info"); return; } expected = expected_link(m, d); @@ -111,9 +112,10 @@ static void check_has_license(struct manifest *m, return; } if (errno == ENOENT) { - score->error = "LICENSE does not exist"; + score->error = talloc_strdup(score, + "LICENSE does not exist"); if (expected) - has_license.handle = handle_license_link; + license_exists.handle = handle_license_link; return; } err(1, "readlink on %s", license); @@ -155,5 +157,3 @@ struct ccanlint license_exists = { .check = check_has_license, .needs = "info_exists" }; - -REGISTER_TEST(license_exists);