diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-04-25 22:20:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-05-07 13:03:30 +0100 |
commit | 9b335fa867805f612154ae92c5a1e727d3fb29ca (patch) | |
tree | b935e29fcdb0443ca8c12be72aafc3e11d656870 /meta | |
parent | 5811ed9140fab64da59d0d2ad6e6b0fec8341a20 (diff) | |
download | poky-9b335fa867805f612154ae92c5a1e727d3fb29ca.tar.gz |
targetcontrol: Fix leaking log handler
We had a mystery failure on the autobuilder where runqemu appeared to
be failing as a logfile directory no longer existed. The key to
reproducing was running a runqemu where the image was deleted (as
devtool does), then running another runqemu test. E.g.:
'oe-selftest -r devtool.DevtoolExtractTests.test_devtool_deploy_target wic.Wic2.test_qemu_efi'
This then tries to write to the logfile from the first test, the
image directory was deleted and we get strange failures.
The fix is to remove the logging handler when qemu is stopped.
(From OE-Core rev: 924b020eacf111b4fd4d731b363084e254a3422d)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/targetcontrol.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py index 0b2915d5cc..2aa548e1ad 100644 --- a/meta/lib/oeqa/targetcontrol.py +++ b/meta/lib/oeqa/targetcontrol.py | |||
@@ -117,9 +117,9 @@ class QemuTarget(BaseTarget): | |||
117 | import oe.path | 117 | import oe.path |
118 | bb.utils.mkdirhier(self.testdir) | 118 | bb.utils.mkdirhier(self.testdir) |
119 | self.qemurunnerlog = os.path.join(self.testdir, 'qemurunner_log.%s' % self.datetime) | 119 | self.qemurunnerlog = os.path.join(self.testdir, 'qemurunner_log.%s' % self.datetime) |
120 | loggerhandler = logging.FileHandler(self.qemurunnerlog) | 120 | self.loggerhandler = logging.FileHandler(self.qemurunnerlog) |
121 | loggerhandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) | 121 | self.loggerhandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) |
122 | self.logger.addHandler(loggerhandler) | 122 | self.logger.addHandler(self.loggerhandler) |
123 | oe.path.symlink(os.path.basename(self.qemurunnerlog), os.path.join(self.testdir, 'qemurunner_log'), force=True) | 123 | oe.path.symlink(os.path.basename(self.qemurunnerlog), os.path.join(self.testdir, 'qemurunner_log'), force=True) |
124 | 124 | ||
125 | if d.getVar("DISTRO") == "poky-tiny": | 125 | if d.getVar("DISTRO") == "poky-tiny": |
@@ -183,6 +183,7 @@ class QemuTarget(BaseTarget): | |||
183 | 183 | ||
184 | def stop(self): | 184 | def stop(self): |
185 | self.runner.stop() | 185 | self.runner.stop() |
186 | self.logger.removeHandler(self.loggerhandler) | ||
186 | self.connection = None | 187 | self.connection = None |
187 | self.ip = None | 188 | self.ip = None |
188 | self.server_ip = None | 189 | self.server_ip = None |