diff options
author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2017-09-22 16:05:41 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-25 14:16:53 +0100 |
commit | f7c3a0267aeae74a216de9f081b2cb189388ad88 (patch) | |
tree | b6f7026f5f7e2a341ae05fc36399d86b823c4bb6 /meta/lib/oeqa/utils | |
parent | 5532c4d72e044e1ffa8ccea93368796d8d24b94f (diff) | |
download | poky-f7c3a0267aeae74a216de9f081b2cb189388ad88.tar.gz |
qemurunner: print tail qemu log in case bootlog is empty
There are cases where the 'while loop' waiting for login prompt fails
and the bootlog variable does not get populated, thus use the the new
qemurunner member (self.msg) which stores all output coming from the qemu
process.
[YOCTO #12113]
(From OE-Core rev: 39ffa0f3779305c5e8ef86fe4572e961c5912021)
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils')
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index 427ae23b1b..6bae3882d6 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -51,6 +51,7 @@ class QemuRunner: | |||
51 | self.logged = False | 51 | self.logged = False |
52 | self.thread = None | 52 | self.thread = None |
53 | self.use_kvm = use_kvm | 53 | self.use_kvm = use_kvm |
54 | self.msg = '' | ||
54 | 55 | ||
55 | self.runqemutime = 120 | 56 | self.runqemutime = 120 |
56 | self.qemu_pidfile = 'pidfile_'+str(os.getpid()) | 57 | self.qemu_pidfile = 'pidfile_'+str(os.getpid()) |
@@ -79,6 +80,7 @@ class QemuRunner: | |||
79 | # because is possible to have control characters | 80 | # because is possible to have control characters |
80 | msg = msg.decode("utf-8", errors='ignore') | 81 | msg = msg.decode("utf-8", errors='ignore') |
81 | msg = re_control_char.sub('', msg) | 82 | msg = re_control_char.sub('', msg) |
83 | self.msg += msg | ||
82 | with codecs.open(self.logfile, "a", encoding="utf-8") as f: | 84 | with codecs.open(self.logfile, "a", encoding="utf-8") as f: |
83 | f.write("%s" % msg) | 85 | f.write("%s" % msg) |
84 | 86 | ||
@@ -307,9 +309,12 @@ class QemuRunner: | |||
307 | sock.close() | 309 | sock.close() |
308 | stopread = True | 310 | stopread = True |
309 | 311 | ||
312 | |||
310 | if not reachedlogin: | 313 | if not reachedlogin: |
311 | self.logger.info("Target didn't reached login boot in %d seconds" % self.boottime) | 314 | self.logger.info("Target didn't reached login boot in %d seconds" % self.boottime) |
312 | lines = "\n".join(bootlog.splitlines()[-25:]) | 315 | tail = lambda l: "\n".join(l.splitlines()[-25:]) |
316 | # in case bootlog is empty, use tail qemu log store at self.msg | ||
317 | lines = tail(bootlog if bootlog else self.msg) | ||
313 | self.logger.info("Last 25 lines of text:\n%s" % lines) | 318 | self.logger.info("Last 25 lines of text:\n%s" % lines) |
314 | self.logger.info("Check full boot log: %s" % self.logfile) | 319 | self.logger.info("Check full boot log: %s" % self.logfile) |
315 | self._dump_host() | 320 | self._dump_host() |