diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-13 08:37:07 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-14 21:42:17 +0100 |
commit | d29f43bd0b4644b850e7e4cfe294ffd899bd6e6d (patch) | |
tree | 587fd036949808c36a645cf5e6efa115c7949443 /meta/lib/oeqa | |
parent | 494983bc9267a23b7d075650352d6d5fac367c3e (diff) | |
download | poky-d29f43bd0b4644b850e7e4cfe294ffd899bd6e6d.tar.gz |
qemurunner: Clean up serial_lock handling
Avoid "RuntimeError: release unlocked lock" since the lock shouldn't
be locked even in the error path. Add a try/finally path to ensure
this.
(From OE-Core rev: b0732ee009ca47580d1d2ad75334f4aa50e6efd5)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index 5c3a8e5999..98a11e1a2c 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -521,7 +521,6 @@ class QemuRunner: | |||
521 | except Exception as e: | 521 | except Exception as e: |
522 | self.logger.warning('Extra log data exception %s' % repr(e)) | 522 | self.logger.warning('Extra log data exception %s' % repr(e)) |
523 | data = None | 523 | data = None |
524 | self.thread.serial_lock.release() | ||
525 | return False | 524 | return False |
526 | 525 | ||
527 | with self.thread.serial_lock: | 526 | with self.thread.serial_lock: |
@@ -824,10 +823,12 @@ class LoggingThread(threading.Thread): | |||
824 | self.logfunc(data, ".stdout") | 823 | self.logfunc(data, ".stdout") |
825 | elif self.serialsock and self.serialsock.fileno() == fd: | 824 | elif self.serialsock and self.serialsock.fileno() == fd: |
826 | if self.serial_lock.acquire(blocking=False): | 825 | if self.serial_lock.acquire(blocking=False): |
827 | data = self.recv(1024, self.serialsock) | 826 | try: |
828 | self.logger.debug("Data received serial thread %s" % data.decode('utf-8', 'replace')) | 827 | data = self.recv(1024, self.serialsock) |
829 | self.logfunc(data, ".2") | 828 | self.logger.debug("Data received serial thread %s" % data.decode('utf-8', 'replace')) |
830 | self.serial_lock.release() | 829 | self.logfunc(data, ".2") |
830 | finally: | ||
831 | self.serial_lock.release() | ||
831 | else: | 832 | else: |
832 | serial_registered = False | 833 | serial_registered = False |
833 | poll.unregister(self.serialsock.fileno()) | 834 | poll.unregister(self.serialsock.fileno()) |