Le sam. 7 oct. 2023 à 19:47, Chris Laplante via lists.openembedded.org <[email protected]> a écrit : > > The tests will fail anyway (since you will have two 'workspacelayer' > layers), so might as well make it fail faster and be clear. >
Hi Chris, FYI I also sent a patch to fix this issue the day just before you :) You can find it here: https://lists.openembedded.org/g/openembedded-core/message/188767 I do a check directly on the setUpModule. I also noticed that devtool.DevtoolAddTests.test_devtool_add just hangs if there is a local workspace but I didn't investigate it ;) Cheers Julien > Signed-off-by: Chris Laplante <[email protected]> > --- > meta/lib/oeqa/selftest/cases/devtool.py | 36 ++++++++++++++++++++++--- > 1 file changed, 33 insertions(+), 3 deletions(-) > > diff --git a/meta/lib/oeqa/selftest/cases/devtool.py > b/meta/lib/oeqa/selftest/cases/devtool.py > index b577f6d62a..2c38eeca17 100644 > --- a/meta/lib/oeqa/selftest/cases/devtool.py > +++ b/meta/lib/oeqa/selftest/cases/devtool.py > @@ -3,7 +3,7 @@ > # > # SPDX-License-Identifier: MIT > # > - > +import dataclasses > import os > import re > import shutil > @@ -11,6 +11,7 @@ import tempfile > import glob > import fnmatch > import unittest > +from typing import List > > from oeqa.selftest.case import OESelftestTestCase > from oeqa.utils.commands import runCmd, bitbake, get_bb_var, > create_temp_layer > @@ -90,6 +91,12 @@ def tearDownModule(): > bb.utils.edit_bblayers_conf(bblayers_conf, None, None, > bblayers_edit_cb) > shutil.rmtree(templayerdir) > > [email protected] > +class BBLayerConfEntry: > + layer: str > + path: str > + priority: int > + > class DevtoolTestCase(OESelftestTestCase): > > def setUp(self): > @@ -100,6 +107,29 @@ class DevtoolTestCase(OESelftestTestCase): > 'This test cannot be run with a workspace directory ' > 'under the build directory') > > + # Ensure there is no actual workspace dir enabled > + self.assertFalse(self.is_external_workspace_layer_enabled(), > + "This test cannot be run with a workspace layer in > bblayers.conf") > + > + def is_selftest_workspace_layer_enabled(self): > + """Returns true if the selftest workspace layer is enabled in > bblayers.conf""" > + return any([layer for layer in self._read_bblayers() if > + layer.layer == "workspacelayer" and layer.path == > self.workspacedir]) > + > + def is_external_workspace_layer_enabled(self): > + """Returns true if a workspace layer (that wasn't installed by > selftest) is enabled in bblayers.conf""" > + return any([layer for layer in self._read_bblayers() if > + layer.layer == "workspacelayer" and layer.path != > self.workspacedir]) > + > + def _read_bblayers(self) -> List[BBLayerConfEntry]: > + """Call bitbake-layers show-layers and return list of layers""" > + ret = [] > + for line in runCmd('bitbake-layers show-layers').output.splitlines(): > + line = line.strip() > + if match := re.match(r'^(\S+) +([^\n]*?) +(\d+)$', line): > + ret.append(BBLayerConfEntry(match[1], match[2], match[3])) > + return ret > + > def _check_src_repo(self, repo_dir): > """Check srctree git repository""" > self.assertTrue(os.path.isdir(os.path.join(repo_dir, '.git')), > @@ -327,8 +357,8 @@ class DevtoolTests(DevtoolBase): > > def test_create_workspace(self): > # Check preconditions > - result = runCmd('bitbake-layers show-layers') > - self.assertTrue('\nworkspace' not in result.output, 'This test > cannot be run with a workspace layer in bblayers.conf') > + self.assertFalse(self.is_selftest_workspace_layer_enabled(), > + "This test cannot be run with the selftest > workspace layer in bblayers.conf") > # remove conf/devtool.conf to avoid it corrupting tests > devtoolconf = os.path.join(self.builddir, 'conf', 'devtool.conf') > self.track_for_cleanup(devtoolconf) > -- > 2.34.1 > > > >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#188829): https://lists.openembedded.org/g/openembedded-core/message/188829 Mute This Topic: https://lists.openembedded.org/mt/101820643/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
