[oe-commits] [openembedded-core] 01/44: oe-selftest: devtool: avoid parallel races by using temporary copy of meta

git at git.openembedded.org git at git.openembedded.org
Sun Jul 29 22:59:55 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit d8dc6da10662d707fcda1320a16ed2d18d895adc
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Thu Jul 26 16:27:44 2018 +0200

    oe-selftest: devtool: avoid parallel races by using temporary copy of meta
    
    Some of the devtool tests make changes to files under meta/ -
    legitimately since we want these tests to be working with real recipes
    and associated files. Unfortunately with the new oe-selftest
    parallelisation this can break other tests if files go missing at the
    wrong time (among other scenarios). To avoid this issue, simply take a
    copy of the meta/ directory and use that for these tests.
    
    Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
---
 meta/lib/oeqa/selftest/cases/devtool.py | 39 +++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 43a66c8..7de3d49 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -11,6 +11,45 @@ from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer
 from oeqa.utils.commands import get_bb_vars, runqemu, get_test_layer
 from oeqa.core.decorator.oeid import OETestID
 
+oldmetapath = None
+
+def setUpModule():
+    import bb.utils
+
+    global templayerdir
+    templayerdir = tempfile.mkdtemp(prefix='devtoolqa')
+    newmetapath = os.path.join(templayerdir, 'meta')
+    bblayers_conf = os.path.join(os.environ['BUILDDIR'], 'conf', 'bblayers.conf')
+    edited_layers = []
+
+    def bblayers_edit_cb(layerpath, canonical_layerpath):
+        global oldmetapath
+        if not edited_layers and canonical_layerpath.endswith(('/meta', '/meta/')):
+            edited_layers.append(layerpath)
+            oldmetapath = layerpath
+            shutil.copytree(canonical_layerpath, newmetapath)
+            shutil.copytree(canonical_layerpath + "/../scripts", newmetapath + "/../scripts")
+            runCmd('git init', cwd=newmetapath)
+            runCmd('git add -A .', cwd=newmetapath)
+            runCmd('git commit -m "Initial commit"', cwd=newmetapath)
+            return newmetapath
+        else:
+            return layerpath
+    bb.utils.edit_bblayers_conf(bblayers_conf, None, None, bblayers_edit_cb)
+
+def tearDownModule():
+    if oldmetapath:
+        edited_layers = []
+        def bblayers_edit_cb(layerpath, canonical_layerpath):
+            if not edited_layers and canonical_layerpath.endswith('/meta'):
+                edited_layers.append(layerpath)
+                return oldmetapath
+            else:
+                return layerpath
+        bblayers_conf = os.path.join(os.environ['BUILDDIR'], 'conf', 'bblayers.conf')
+        bb.utils.edit_bblayers_conf(bblayers_conf, None, None, bblayers_edit_cb)
+    shutil.rmtree(templayerdir)
+
 class DevtoolBase(OESelftestTestCase):
 
     @classmethod

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list