summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-21 17:50:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-22 07:43:51 +0100
commit64786106746fbcc9d8a35eb6cfa82fd5c6bce7f8 (patch)
tree92b7d1e24c7157690e46c6905d1c7f5c0397e961
parent3689cadeb07d76e66f97d890e844f899f69666fe (diff)
downloadopenembedded-core-64786106746fbcc9d8a35eb6cfa82fd5c6bce7f8.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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/oescripts.py23
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):
if expected_endlines:
self.fail('Missing expected line endings:\n %s' % '\n '.join(expected_endlines))
-class OEScriptTests(OESelftestTestCase):
- scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts')
-
@unittest.skipUnless(importlib.util.find_spec("cairo"), "Python cairo module is not present")
-class OEPybootchartguyTests(OEScriptTests):
+class OEPybootchartguyTests(OESelftestTestCase):
@classmethod
def setUpClass(cls):
- super(OEScriptTests, cls).setUpClass()
+ super().setUpClass()
bitbake("core-image-minimal -c rootfs -f")
cls.tmpdir = get_bb_var('TMPDIR')
cls.buildstats = cls.tmpdir + "/buildstats/" + sorted(os.listdir(cls.tmpdir + "/buildstats"))[-1]
+ cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts')
def test_pybootchartguy_help(self):
runCmd('%s/pybootchartgui/pybootchartgui.py --help' % self.scripts_dir)
@@ -65,7 +63,12 @@ class OEPybootchartguyTests(OEScriptTests):
self.assertTrue(os.path.exists(self.tmpdir + "/charts.pdf"))
-class OEGitproxyTests(OEScriptTests):
+class OEGitproxyTests(OESelftestTestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts')
def test_oegitproxy_help(self):
try:
@@ -126,7 +129,13 @@ class OeRunNativeTest(OESelftestTestCase):
result = runCmd("oe-run-native qemu-helper-native qemu-oe-bridge-helper --help")
self.assertIn("Helper function to find and exec qemu-bridge-helper", result.output)
-class OEListPackageconfigTests(OEScriptTests):
+class OEListPackageconfigTests(OESelftestTestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts')
+
#oe-core.scripts.List_all_the_PACKAGECONFIG's_flags
def check_endlines(self, results, expected_endlines):
for line in results.output.splitlines():