summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>2017-09-22 16:05:41 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-04 11:11:58 +0000
commit9e036b011e46a548084e824e62adec8e12a29c82 (patch)
tree4a4bcf96ac88787d6c4368954bb23c09aaba954d
parentdd79b50980af63a009f3170e84a66ecc58d3222a (diff)
downloadpoky-9e036b011e46a548084e824e62adec8e12a29c82.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) (From OE-Core rev: 40f9f0358184660f23ac7b5fc3e477e2c54e21bc) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index be50d5e771..b9fa95eff2 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
@@ -306,9 +308,12 @@ class QemuRunner:
306 sock.close() 308 sock.close()
307 stopread = True 309 stopread = True
308 310
311
309 if not reachedlogin: 312 if not reachedlogin:
310 self.logger.info("Target didn't reached login boot in %d seconds" % self.boottime) 313 self.logger.info("Target didn't reached login boot in %d seconds" % self.boottime)
311 lines = "\n".join(bootlog.splitlines()[-25:]) 314 tail = lambda l: "\n".join(l.splitlines()[-25:])
315 # in case bootlog is empty, use tail qemu log store at self.msg
316 lines = tail(bootlog if bootlog else self.msg)
312 self.logger.info("Last 25 lines of text:\n%s" % lines) 317 self.logger.info("Last 25 lines of text:\n%s" % lines)
313 self.logger.info("Check full boot log: %s" % self.logfile) 318 self.logger.info("Check full boot log: %s" % self.logfile)
314 self._dump_host() 319 self._dump_host()