summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorQuentin Schulz <quentin.schulz@streamunlimited.com>2019-06-11 17:11:20 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-12 10:54:40 +0100
commite3d0dd9163820b2bcc3ec30118338ad20bf170bf (patch)
tree1b88669c838566bcd446c7da2019edd71e40d5ea /meta
parent99c821eaaa78dc670c1f03a96f7bf83a541cde94 (diff)
downloadpoky-e3d0dd9163820b2bcc3ec30118338ad20bf170bf.tar.gz
selftests: add tests for INCOMPATIBLE_LICENSE
One bug went unnoticed without these selftests: an INCOMPATIBLE_LICENSE with a non-SPDX license for a package with that non-SPDX license wasn't enforcing the denial of build for said package. See 4b6ce4604cc15e289a48f8586d58a101b7a70b52 ("meta: license: fix non-SPDX license being removed from INCOMPATIBLE_LICENSE") While adding a test for that particular case, let's add a few more so that we cover a handful more use cases of INCOMPATIBLE_LICENSE. (From OE-Core rev: 6c2ca52218c196e7ccf6b3275bffc3e3a04193c6) Signed-off-by: Quentin Schulz <quentin.schulz@streamunlimited.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/cases/incompatible_lic.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/incompatible_lic.py b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
new file mode 100644
index 0000000000..8fb93af8a8
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/incompatible_lic.py
@@ -0,0 +1,41 @@
1from oeqa.selftest.case import OESelftestTestCase
2from oeqa.utils.commands import bitbake
3
4class IncompatibleLicenseTests(OESelftestTestCase):
5
6 def lic_test(self, pn, pn_lic, lic):
7 error_msg = 'ERROR: Nothing PROVIDES \'%s\'\n%s was skipped: it has an incompatible license: %s' % (pn, pn, pn_lic)
8
9 self.write_config("INCOMPATIBLE_LICENSE += \"%s\"" % (lic))
10
11 result = bitbake('%s --dry-run' % (pn), ignore_status=True)
12 if error_msg not in result.output:
13 raise AssertionError(result.output)
14
15 # Verify that a package with an SPDX license (from SRC_DISTRIBUTE_LICENSES)
16 # cannot be built when INCOMPATIBLE_LICENSE contains this SPDX license
17 def test_incompatible_spdx_license(self):
18 self.lic_test('incompatible-license', 'GPL-3.0', 'GPL-3.0')
19
20 # Verify that a package with an SPDX license (from SRC_DISTRIBUTE_LICENSES)
21 # cannot be built when INCOMPATIBLE_LICENSE contains an alias (in
22 # SPDXLICENSEMAP) of this SPDX license
23 def test_incompatible_alias_spdx_license(self):
24 self.lic_test('incompatible-license', 'GPL-3.0', 'GPLv3')
25
26 # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX
27 # license cannot be built when INCOMPATIBLE_LICENSE contains this SPDX
28 # license
29 def test_incompatible_spdx_license_alias(self):
30 self.lic_test('incompatible-license-alias', 'GPLv3', 'GPL-3.0')
31
32 # Verify that a package with an alias (from SPDXLICENSEMAP) to an SPDX
33 # license cannot be built when INCOMPATIBLE_LICENSE contains this alias
34 def test_incompatible_alias_spdx_license_alias(self):
35 self.lic_test('incompatible-license-alias', 'GPLv3', 'GPLv3')
36
37 # Verify that a package with a non-SPDX license (neither in
38 # SRC_DISTRIBUTE_LICENSES nor in SPDXLICENSEMAP) cannot be built when
39 # INCOMPATIBLE_LICENSE contains this license
40 def test_incompatible_nonspdx_license(self):
41 self.lic_test('incompatible-nonspdx-license', 'FooLicense', 'FooLicense')