summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/oelib/license.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/oelib/license.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/oelib/license.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/oelib/license.py b/meta/lib/oeqa/selftest/cases/oelib/license.py
index bfd9ed9c29..d7f91fb2f4 100644
--- a/meta/lib/oeqa/selftest/cases/oelib/license.py
+++ b/meta/lib/oeqa/selftest/cases/oelib/license.py
@@ -66,3 +66,34 @@ class TestComplexCombinations(TestSimpleCombinations):
66 "(GPL-2.0|Proprietary)&BSD-4-clause&MIT": ["GPL-2.0", "BSD-4-clause", "MIT"], 66 "(GPL-2.0|Proprietary)&BSD-4-clause&MIT": ["GPL-2.0", "BSD-4-clause", "MIT"],
67 } 67 }
68 preferred = ["BAR", "OMEGA", "BETA", "GPL-2.0"] 68 preferred = ["BAR", "OMEGA", "BETA", "GPL-2.0"]
69
70class TestIsIncluded(TestCase):
71 tests = {
72 ("FOO | BAR", None, None):
73 [True, ["FOO"]],
74 ("FOO | BAR", None, "FOO"):
75 [True, ["BAR"]],
76 ("FOO | BAR", "BAR", None):
77 [True, ["BAR"]],
78 ("FOO | BAR & FOOBAR", "*BAR", None):
79 [True, ["BAR", "FOOBAR"]],
80 ("FOO | BAR & FOOBAR", None, "FOO*"):
81 [False, ["FOOBAR"]],
82 ("(FOO | BAR) & FOOBAR | BARFOO", None, "FOO"):
83 [True, ["BAR", "FOOBAR"]],
84 ("(FOO | BAR) & FOOBAR | BAZ & MOO & BARFOO", None, "FOO"):
85 [True, ["BAZ", "MOO", "BARFOO"]],
86 ("GPL-3.0 & GPL-2.0 & LGPL-2.1 | Proprietary", None, None):
87 [True, ["GPL-3.0", "GPL-2.0", "LGPL-2.1"]],
88 ("GPL-3.0 & GPL-2.0 & LGPL-2.1 | Proprietary", None, "GPL-3.0"):
89 [True, ["Proprietary"]],
90 ("GPL-3.0 & GPL-2.0 & LGPL-2.1 | Proprietary", None, "GPL-3.0 Proprietary"):
91 [False, ["GPL-3.0"]]
92 }
93
94 def test_tests(self):
95 for args, expected in self.tests.items():
96 is_included, licenses = oe.license.is_included(
97 args[0], (args[1] or '').split(), (args[2] or '').split())
98 self.assertEqual(is_included, expected[0])
99 self.assertListEqual(licenses, expected[1])