oeqa/selftest: recipetool/devtool: Avoid load_plugin test race

This bug has plagued the autobuilder for a couple of years and we've
struggled to reproduce/debug it.

The problem is the "lib" directory in meta-poky used during the load_plugin
tests for recipetool and devtool can race and one can delete the files
from the other leading to test failures.

Deleting the lib directory only if empty will avoid this.

[YOCTO #13070]

(From OE-Core rev: d603e2fd589e1edbc67c8c2fefb6337e728b9d01)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2020-07-02 19:46:07 +01:00
parent c9c9913cf6
commit e855b384f3
2 changed files with 10 additions and 2 deletions

View File

@@ -1500,7 +1500,11 @@ class DevtoolUpgradeTests(DevtoolBase):
dstdir = os.path.join(dstdir, p)
if not os.path.exists(dstdir):
os.makedirs(dstdir)
self.track_for_cleanup(dstdir)
if p == "lib":
# Can race with other tests
self.add_command_to_tearDown('rmdir --ignore-fail-on-non-empty %s' % dstdir)
else:
self.track_for_cleanup(dstdir)
dstfile = os.path.join(dstdir, os.path.basename(srcfile))
if srcfile != dstfile:
shutil.copy(srcfile, dstfile)

View File

@@ -534,7 +534,11 @@ class RecipetoolTests(RecipetoolBase):
dstdir = os.path.join(dstdir, p)
if not os.path.exists(dstdir):
os.makedirs(dstdir)
self.track_for_cleanup(dstdir)
if p == "lib":
# Can race with other tests
self.add_command_to_tearDown('rmdir --ignore-fail-on-non-empty %s' % dstdir)
else:
self.track_for_cleanup(dstdir)
dstfile = os.path.join(dstdir, os.path.basename(srcfile))
if srcfile != dstfile:
shutil.copy(srcfile, dstfile)