diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/oescripts.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/oescripts.py | 69 |
1 files changed, 26 insertions, 43 deletions
diff --git a/meta/lib/oeqa/selftest/cases/oescripts.py b/meta/lib/oeqa/selftest/cases/oescripts.py index 8a10ff357b..3f9899b289 100644 --- a/meta/lib/oeqa/selftest/cases/oescripts.py +++ b/meta/lib/oeqa/selftest/cases/oescripts.py | |||
@@ -1,4 +1,6 @@ | |||
1 | # | 1 | # |
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
2 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
3 | # | 5 | # |
4 | 6 | ||
@@ -7,47 +9,19 @@ import shutil | |||
7 | import importlib | 9 | import importlib |
8 | import unittest | 10 | import unittest |
9 | from oeqa.selftest.case import OESelftestTestCase | 11 | from oeqa.selftest.case import OESelftestTestCase |
10 | from oeqa.selftest.cases.buildhistory import BuildhistoryBase | 12 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var |
11 | from oeqa.utils.commands import Command, runCmd, bitbake, get_bb_var, get_test_layer | ||
12 | from oeqa.utils import CommandError | 13 | from oeqa.utils import CommandError |
13 | 14 | ||
14 | class BuildhistoryDiffTests(BuildhistoryBase): | ||
15 | |||
16 | def test_buildhistory_diff(self): | ||
17 | target = 'xcursor-transparent-theme' | ||
18 | self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) | ||
19 | self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True) | ||
20 | result = runCmd("oe-pkgdata-util read-value PKGV %s" % target) | ||
21 | pkgv = result.output.rstrip() | ||
22 | result = runCmd("buildhistory-diff -p %s" % get_bb_var('BUILDHISTORY_DIR')) | ||
23 | expected_endlines = [ | ||
24 | "xcursor-transparent-theme-dev: RDEPENDS: removed \"xcursor-transparent-theme (['= %s-r1'])\", added \"xcursor-transparent-theme (['= %s-r0'])\"" % (pkgv, pkgv), | ||
25 | "xcursor-transparent-theme-staticdev: RDEPENDS: removed \"xcursor-transparent-theme-dev (['= %s-r1'])\", added \"xcursor-transparent-theme-dev (['= %s-r0'])\"" % (pkgv, pkgv) | ||
26 | ] | ||
27 | for line in result.output.splitlines(): | ||
28 | for el in expected_endlines: | ||
29 | if line.endswith(el): | ||
30 | expected_endlines.remove(el) | ||
31 | break | ||
32 | else: | ||
33 | self.fail('Unexpected line:\n%s\nExpected line endings:\n %s' % (line, '\n '.join(expected_endlines))) | ||
34 | if expected_endlines: | ||
35 | self.fail('Missing expected line endings:\n %s' % '\n '.join(expected_endlines)) | ||
36 | |||
37 | @unittest.skipUnless(importlib.util.find_spec("cairo"), "Python cairo module is not present") | 15 | @unittest.skipUnless(importlib.util.find_spec("cairo"), "Python cairo module is not present") |
38 | class OEScriptTests(OESelftestTestCase): | 16 | class OEPybootchartguyTests(OESelftestTestCase): |
39 | 17 | ||
40 | @classmethod | 18 | @classmethod |
41 | def setUpClass(cls): | 19 | def setUpClass(cls): |
42 | super(OEScriptTests, cls).setUpClass() | 20 | super().setUpClass() |
43 | import cairo | ||
44 | bitbake("core-image-minimal -c rootfs -f") | 21 | bitbake("core-image-minimal -c rootfs -f") |
45 | cls.tmpdir = get_bb_var('TMPDIR') | 22 | cls.tmpdir = get_bb_var('TMPDIR') |
46 | cls.buildstats = cls.tmpdir + "/buildstats/" + sorted(os.listdir(cls.tmpdir + "/buildstats"))[-1] | 23 | cls.buildstats = cls.tmpdir + "/buildstats/" + sorted(os.listdir(cls.tmpdir + "/buildstats"))[-1] |
47 | 24 | cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') | |
48 | scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') | ||
49 | |||
50 | class OEPybootchartguyTests(OEScriptTests): | ||
51 | 25 | ||
52 | def test_pybootchartguy_help(self): | 26 | def test_pybootchartguy_help(self): |
53 | runCmd('%s/pybootchartgui/pybootchartgui.py --help' % self.scripts_dir) | 27 | runCmd('%s/pybootchartgui/pybootchartgui.py --help' % self.scripts_dir) |
@@ -67,7 +41,10 @@ class OEPybootchartguyTests(OEScriptTests): | |||
67 | 41 | ||
68 | class OEGitproxyTests(OESelftestTestCase): | 42 | class OEGitproxyTests(OESelftestTestCase): |
69 | 43 | ||
70 | scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') | 44 | @classmethod |
45 | def setUpClass(cls): | ||
46 | super().setUpClass() | ||
47 | cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') | ||
71 | 48 | ||
72 | def test_oegitproxy_help(self): | 49 | def test_oegitproxy_help(self): |
73 | try: | 50 | try: |
@@ -125,15 +102,22 @@ class OEGitproxyTests(OESelftestTestCase): | |||
125 | class OeRunNativeTest(OESelftestTestCase): | 102 | class OeRunNativeTest(OESelftestTestCase): |
126 | def test_oe_run_native(self): | 103 | def test_oe_run_native(self): |
127 | bitbake("qemu-helper-native -c addto_recipe_sysroot") | 104 | bitbake("qemu-helper-native -c addto_recipe_sysroot") |
128 | result = runCmd("oe-run-native qemu-helper-native tunctl -h") | 105 | result = runCmd("oe-run-native qemu-helper-native qemu-oe-bridge-helper --help") |
129 | self.assertIn("Delete: tunctl -d device-name [-f tun-clone-device]", result.output) | 106 | self.assertIn("Helper function to find and exec qemu-bridge-helper", result.output) |
107 | |||
108 | class OEListPackageconfigTests(OESelftestTestCase): | ||
109 | |||
110 | @classmethod | ||
111 | def setUpClass(cls): | ||
112 | super().setUpClass() | ||
113 | cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') | ||
130 | 114 | ||
131 | class OEListPackageconfigTests(OEScriptTests): | ||
132 | #oe-core.scripts.List_all_the_PACKAGECONFIG's_flags | 115 | #oe-core.scripts.List_all_the_PACKAGECONFIG's_flags |
133 | def check_endlines(self, results, expected_endlines): | 116 | def check_endlines(self, results, expected_endlines): |
134 | for line in results.output.splitlines(): | 117 | for line in results.output.splitlines(): |
135 | for el in expected_endlines: | 118 | for el in expected_endlines: |
136 | if line.split() == el.split(): | 119 | if line and line.split()[0] == el.split()[0] and \ |
120 | ' '.join(sorted(el.split())) in ' '.join(sorted(line.split())): | ||
137 | expected_endlines.remove(el) | 121 | expected_endlines.remove(el) |
138 | break | 122 | break |
139 | 123 | ||
@@ -149,8 +133,8 @@ class OEListPackageconfigTests(OEScriptTests): | |||
149 | results = runCmd('%s/contrib/list-packageconfig-flags.py' % self.scripts_dir) | 133 | results = runCmd('%s/contrib/list-packageconfig-flags.py' % self.scripts_dir) |
150 | expected_endlines = [] | 134 | expected_endlines = [] |
151 | expected_endlines.append("RECIPE NAME PACKAGECONFIG FLAGS") | 135 | expected_endlines.append("RECIPE NAME PACKAGECONFIG FLAGS") |
152 | expected_endlines.append("pinentry gtk2 libcap ncurses qt secret") | 136 | expected_endlines.append("pinentry gtk2 ncurses qt secret") |
153 | expected_endlines.append("tar acl") | 137 | expected_endlines.append("tar acl selinux") |
154 | 138 | ||
155 | self.check_endlines(results, expected_endlines) | 139 | self.check_endlines(results, expected_endlines) |
156 | 140 | ||
@@ -167,11 +151,10 @@ class OEListPackageconfigTests(OEScriptTests): | |||
167 | def test_packageconfig_flags_option_all(self): | 151 | def test_packageconfig_flags_option_all(self): |
168 | results = runCmd('%s/contrib/list-packageconfig-flags.py -a' % self.scripts_dir) | 152 | results = runCmd('%s/contrib/list-packageconfig-flags.py -a' % self.scripts_dir) |
169 | expected_endlines = [] | 153 | expected_endlines = [] |
170 | expected_endlines.append("pinentry-1.1.1") | 154 | expected_endlines.append("pinentry-1.3.1") |
171 | expected_endlines.append("PACKAGECONFIG ncurses libcap") | 155 | expected_endlines.append("PACKAGECONFIG ncurses") |
172 | expected_endlines.append("PACKAGECONFIG[qt] --enable-pinentry-qt, --disable-pinentry-qt, qtbase-native qtbase") | 156 | expected_endlines.append("PACKAGECONFIG[qt] --enable-pinentry-qt, --disable-pinentry-qt, qtbase-native qtbase") |
173 | expected_endlines.append("PACKAGECONFIG[gtk2] --enable-pinentry-gtk2, --disable-pinentry-gtk2, gtk+ glib-2.0") | 157 | expected_endlines.append("PACKAGECONFIG[gtk2] --enable-pinentry-gtk2, --disable-pinentry-gtk2, gtk+ glib-2.0") |
174 | expected_endlines.append("PACKAGECONFIG[libcap] --with-libcap, --without-libcap, libcap") | ||
175 | expected_endlines.append("PACKAGECONFIG[ncurses] --enable-ncurses --with-ncurses-include-dir=${STAGING_INCDIR}, --disable-ncurses, ncurses") | 158 | expected_endlines.append("PACKAGECONFIG[ncurses] --enable-ncurses --with-ncurses-include-dir=${STAGING_INCDIR}, --disable-ncurses, ncurses") |
176 | expected_endlines.append("PACKAGECONFIG[secret] --enable-libsecret, --disable-libsecret, libsecret") | 159 | expected_endlines.append("PACKAGECONFIG[secret] --enable-libsecret, --disable-libsecret, libsecret") |
177 | 160 | ||
@@ -181,7 +164,7 @@ class OEListPackageconfigTests(OEScriptTests): | |||
181 | results = runCmd('%s/contrib/list-packageconfig-flags.py -p' % self.scripts_dir) | 164 | results = runCmd('%s/contrib/list-packageconfig-flags.py -p' % self.scripts_dir) |
182 | expected_endlines = [] | 165 | expected_endlines = [] |
183 | expected_endlines.append("RECIPE NAME PACKAGECONFIG FLAGS") | 166 | expected_endlines.append("RECIPE NAME PACKAGECONFIG FLAGS") |
184 | expected_endlines.append("pinentry gtk2 libcap ncurses qt secret") | 167 | expected_endlines.append("pinentry gtk2 ncurses qt secret") |
185 | 168 | ||
186 | self.check_endlines(results, expected_endlines) | 169 | self.check_endlines(results, expected_endlines) |
187 | 170 | ||