diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-21 17:50:32 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-22 07:45:17 +0100 |
commit | 7b268c82765c055a9fc4431e9421f4698f85fb0e (patch) | |
tree | a972a5b1b734d023ad781a1b7206caa387e3db35 /meta/lib | |
parent | 7e6514b28b71f86fa911338e31ec4b284eb8fe46 (diff) | |
download | poky-7b268c82765c055a9fc4431e9421f4698f85fb0e.tar.gz |
oeqa/selftest/oescripts: Avoid variable access at module load
Using get_bb_var in the class setup leads to slow startup of oe-selftest.
Move the calls into setupClass instead to remove the overhead at the expense
of some code duplication.
(From OE-Core rev: 64786106746fbcc9d8a35eb6cfa82fd5c6bce7f8)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/oescripts.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/meta/lib/oeqa/selftest/cases/oescripts.py b/meta/lib/oeqa/selftest/cases/oescripts.py index 7d3a00e2ab..f69efccfee 100644 --- a/meta/lib/oeqa/selftest/cases/oescripts.py +++ b/meta/lib/oeqa/selftest/cases/oescripts.py | |||
@@ -36,18 +36,16 @@ class BuildhistoryDiffTests(BuildhistoryBase): | |||
36 | if expected_endlines: | 36 | if expected_endlines: |
37 | self.fail('Missing expected line endings:\n %s' % '\n '.join(expected_endlines)) | 37 | self.fail('Missing expected line endings:\n %s' % '\n '.join(expected_endlines)) |
38 | 38 | ||
39 | class OEScriptTests(OESelftestTestCase): | ||
40 | scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') | ||
41 | |||
42 | @unittest.skipUnless(importlib.util.find_spec("cairo"), "Python cairo module is not present") | 39 | @unittest.skipUnless(importlib.util.find_spec("cairo"), "Python cairo module is not present") |
43 | class OEPybootchartguyTests(OEScriptTests): | 40 | class OEPybootchartguyTests(OESelftestTestCase): |
44 | 41 | ||
45 | @classmethod | 42 | @classmethod |
46 | def setUpClass(cls): | 43 | def setUpClass(cls): |
47 | super(OEScriptTests, cls).setUpClass() | 44 | super().setUpClass() |
48 | bitbake("core-image-minimal -c rootfs -f") | 45 | bitbake("core-image-minimal -c rootfs -f") |
49 | cls.tmpdir = get_bb_var('TMPDIR') | 46 | cls.tmpdir = get_bb_var('TMPDIR') |
50 | cls.buildstats = cls.tmpdir + "/buildstats/" + sorted(os.listdir(cls.tmpdir + "/buildstats"))[-1] | 47 | cls.buildstats = cls.tmpdir + "/buildstats/" + sorted(os.listdir(cls.tmpdir + "/buildstats"))[-1] |
48 | cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') | ||
51 | 49 | ||
52 | def test_pybootchartguy_help(self): | 50 | def test_pybootchartguy_help(self): |
53 | runCmd('%s/pybootchartgui/pybootchartgui.py --help' % self.scripts_dir) | 51 | runCmd('%s/pybootchartgui/pybootchartgui.py --help' % self.scripts_dir) |
@@ -65,7 +63,12 @@ class OEPybootchartguyTests(OEScriptTests): | |||
65 | self.assertTrue(os.path.exists(self.tmpdir + "/charts.pdf")) | 63 | self.assertTrue(os.path.exists(self.tmpdir + "/charts.pdf")) |
66 | 64 | ||
67 | 65 | ||
68 | class OEGitproxyTests(OEScriptTests): | 66 | class OEGitproxyTests(OESelftestTestCase): |
67 | |||
68 | @classmethod | ||
69 | def setUpClass(cls): | ||
70 | super().setUpClass() | ||
71 | cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') | ||
69 | 72 | ||
70 | def test_oegitproxy_help(self): | 73 | def test_oegitproxy_help(self): |
71 | try: | 74 | try: |
@@ -126,7 +129,13 @@ class OeRunNativeTest(OESelftestTestCase): | |||
126 | result = runCmd("oe-run-native qemu-helper-native qemu-oe-bridge-helper --help") | 129 | result = runCmd("oe-run-native qemu-helper-native qemu-oe-bridge-helper --help") |
127 | self.assertIn("Helper function to find and exec qemu-bridge-helper", result.output) | 130 | self.assertIn("Helper function to find and exec qemu-bridge-helper", result.output) |
128 | 131 | ||
129 | class OEListPackageconfigTests(OEScriptTests): | 132 | class OEListPackageconfigTests(OESelftestTestCase): |
133 | |||
134 | @classmethod | ||
135 | def setUpClass(cls): | ||
136 | super().setUpClass() | ||
137 | cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') | ||
138 | |||
130 | #oe-core.scripts.List_all_the_PACKAGECONFIG's_flags | 139 | #oe-core.scripts.List_all_the_PACKAGECONFIG's_flags |
131 | def check_endlines(self, results, expected_endlines): | 140 | def check_endlines(self, results, expected_endlines): |
132 | for line in results.output.splitlines(): | 141 | for line in results.output.splitlines(): |