diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-11-27 12:03:50 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-11-27 22:13:11 +0000 |
commit | 3b06853f590d6f32129ceea5a5dd220f0b949c2b (patch) | |
tree | 8c4dae300d9cd0a363ff2889225c97cc57a9f4a8 | |
parent | ff60dc33becb383244338fdcff4bb90867c4e06e (diff) | |
download | poky-3b06853f590d6f32129ceea5a5dd220f0b949c2b.tar.gz |
oeqa/selftest/case: Use bb.utils.remove() instead of shutil.remove()
This avoids problems where shutil.remove will error with:
File "/usr/lib/python3.5/shutil.py", line 436, in _rmtree_safe_fd
os.unlink(name, dir_fd=topfd)
FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra'
when there are races over file deletion (gpg agent may be slow to exit).
We already worked around speed and race issues in bb.utils.
(From OE-Core rev: 00a8fd5b93a5c19ce0b7498e2bc653ce8ad58aaf)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/selftest/case.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/case.py b/meta/lib/oeqa/selftest/case.py index 7a90a6b975..9c08d595ef 100644 --- a/meta/lib/oeqa/selftest/case.py +++ b/meta/lib/oeqa/selftest/case.py | |||
@@ -12,6 +12,8 @@ import oeqa.utils.ftools as ftools | |||
12 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var | 12 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var |
13 | from oeqa.core.case import OETestCase | 13 | from oeqa.core.case import OETestCase |
14 | 14 | ||
15 | import bb.utils | ||
16 | |||
15 | class OESelftestTestCase(OETestCase): | 17 | class OESelftestTestCase(OETestCase): |
16 | def __init__(self, methodName="runTest"): | 18 | def __init__(self, methodName="runTest"): |
17 | self._extra_tear_down_commands = [] | 19 | self._extra_tear_down_commands = [] |
@@ -167,7 +169,7 @@ to ensure accurate results.") | |||
167 | if self._track_for_cleanup: | 169 | if self._track_for_cleanup: |
168 | for path in self._track_for_cleanup: | 170 | for path in self._track_for_cleanup: |
169 | if os.path.isdir(path): | 171 | if os.path.isdir(path): |
170 | shutil.rmtree(path) | 172 | bb.utils.remove(path, recurse=True) |
171 | if os.path.isfile(path): | 173 | if os.path.isfile(path): |
172 | os.remove(path) | 174 | os.remove(path) |
173 | self._track_for_cleanup = [] | 175 | self._track_for_cleanup = [] |