]> code.ossystems Code Review - openembedded-core.git/commitdiff
eSDK.py: avoid error in tearDownClass due to race condistion
authorChen Qi <Qi.Chen@windriver.com>
Thu, 24 Jan 2019 09:33:01 +0000 (17:33 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 28 Jan 2019 16:56:34 +0000 (16:56 +0000)
When removing the temporary directory, it's possible that bitbake.lock
file is removed by bitbake during the cleanup. And this leads to the
following error.

  FileNotFoundError: [Errno 2] No such file or directory: 'bitbake.lock'

So add a check to remove this file before cleaning up the temporary
directory.

(From OE-Core rev: 984f56b37bd0014e5bf9509fc8ed181973e61773)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
meta/lib/oeqa/selftest/cases/eSDK.py

index d7aef939913532bf3ea5c034ca9736432f0d69c8..8e3a43d1c0d10c6350aeb1b3117556de6076796d 100644 (file)
@@ -2,6 +2,7 @@ import tempfile
 import shutil
 import os
 import glob
+import time
 from oeqa.core.decorator.oeid import OETestID
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
@@ -95,6 +96,11 @@ SSTATE_MIRRORS =  "file://.* file://%s/PATH"
 
     @classmethod
     def tearDownClass(cls):
+        for i in range(0, 10):
+            if os.path.exists(os.path.join(cls.tmpdir_eSDKQA, 'bitbake.lock')):
+                time.sleep(1)
+            else:
+                break
         cls.tmpdirobj.cleanup()
         super().tearDownClass()