diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-07-11 09:24:44 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-07-11 23:00:52 +0100 |
commit | 9b4c0035d456b6b3662579fd89f26957677aee02 (patch) | |
tree | 03b81a362e596210aa61a576f3244a38fd617e1b /meta/lib/oeqa/utils/qemurunner.py | |
parent | 7f9f9a0c37970c555e17e24ea1e6f25fbea6ae35 (diff) | |
download | poky-9b4c0035d456b6b3662579fd89f26957677aee02.tar.gz |
oeqa/qemurunner: Handle files no longer existing gracefully
Files in /proc/xxx/map_files/ may no longer exist, just ignore this rather than
raising an exception.
(From OE-Core rev: fb1027896a263cd91e2378a4e97dbdf0807b306b)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils/qemurunner.py')
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index 10c54d6afa..5c9d2b24a3 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -359,13 +359,16 @@ class QemuRunner: | |||
359 | mapdir = "/proc/" + str(self.qemupid) + "/map_files/" | 359 | mapdir = "/proc/" + str(self.qemupid) + "/map_files/" |
360 | try: | 360 | try: |
361 | for f in os.listdir(mapdir): | 361 | for f in os.listdir(mapdir): |
362 | linktarget = os.readlink(os.path.join(mapdir, f)) | 362 | try: |
363 | if not linktarget.startswith("/") or linktarget.startswith("/dev") or "deleted" in linktarget: | 363 | linktarget = os.readlink(os.path.join(mapdir, f)) |
364 | if not linktarget.startswith("/") or linktarget.startswith("/dev") or "deleted" in linktarget: | ||
365 | continue | ||
366 | with open(linktarget, "rb") as readf: | ||
367 | data = True | ||
368 | while data: | ||
369 | data = readf.read(4096) | ||
370 | except FileNotFoundError: | ||
364 | continue | 371 | continue |
365 | with open(linktarget, "rb") as readf: | ||
366 | data = True | ||
367 | while data: | ||
368 | data = readf.read(4096) | ||
369 | # Centos7 doesn't allow us to read /map_files/ | 372 | # Centos7 doesn't allow us to read /map_files/ |
370 | except PermissionError: | 373 | except PermissionError: |
371 | pass | 374 | pass |