summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/testimage.bbclass6
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py10
2 files changed, 11 insertions, 5 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 35c6811c89..f66f514904 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -7,6 +7,8 @@ DEFAULT_TEST_SUITES_pn-core-image-sato-sdk = "ping ssh connman rpm smart gcc xor
7 7
8TEST_SUITES ?= "${DEFAULT_TEST_SUITES}" 8TEST_SUITES ?= "${DEFAULT_TEST_SUITES}"
9 9
10TEST_QEMUBOOT_TIMEOUT ?= "500"
11
10python do_testimage() { 12python do_testimage() {
11 testimage_main(d) 13 testimage_main(d)
12} 14}
@@ -65,6 +67,10 @@ def testimage_main(d):
65 qemu.tmpdir = d.getVar("TMPDIR", True) 67 qemu.tmpdir = d.getVar("TMPDIR", True)
66 qemu.display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True) 68 qemu.display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True)
67 qemu.logfile = os.path.join(testdir, "qemu_boot_log.%s" % d.getVar('DATETIME', True)) 69 qemu.logfile = os.path.join(testdir, "qemu_boot_log.%s" % d.getVar('DATETIME', True))
70 try:
71 qemu.boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT", True))
72 except ValueError:
73 qemu.boottime = 500
68 74
69 bb.note("DISPLAY value: %s" % qemu.display) 75 bb.note("DISPLAY value: %s" % qemu.display)
70 bb.note("rootfs file: %s" % rootfs) 76 bb.note("rootfs file: %s" % rootfs)
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 3132b6871b..ec9298863a 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -10,7 +10,7 @@ from oeqa.utils.oeqemuconsole import oeQemuConsole
10 10
11class QemuRunner: 11class QemuRunner:
12 12
13 def __init__(self, machine, rootfs, display = None, tmpdir = None, logfile = None): 13 def __init__(self, machine, rootfs, display = None, tmpdir = None, logfile = None, boottime = 400):
14 # Popen object 14 # Popen object
15 self.runqemu = None 15 self.runqemu = None
16 16
@@ -25,6 +25,7 @@ class QemuRunner:
25 self.display = display 25 self.display = display
26 self.tmpdir = tmpdir 26 self.tmpdir = tmpdir
27 self.logfile = logfile 27 self.logfile = logfile
28 self.boottime = boottime
28 29
29 def launch(self, qemuparams = None): 30 def launch(self, qemuparams = None):
30 31
@@ -49,7 +50,6 @@ class QemuRunner:
49 self.runqemu = subprocess.Popen(launch_cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,preexec_fn=os.setpgrp) 50 self.runqemu = subprocess.Popen(launch_cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,preexec_fn=os.setpgrp)
50 51
51 bb.note("runqemu started, pid is %s" % self.runqemu.pid) 52 bb.note("runqemu started, pid is %s" % self.runqemu.pid)
52 # wait at most 30 seconds until qemu pid appears
53 bb.note("waiting at most 60 seconds for qemu pid") 53 bb.note("waiting at most 60 seconds for qemu pid")
54 endtime = time.time() + 60 54 endtime = time.time() + 60
55 while not self.is_alive() and time.time() < endtime: 55 while not self.is_alive() and time.time() < endtime:
@@ -59,8 +59,8 @@ class QemuRunner:
59 bb.note("qemu started - qemu procces pid is %s" % self.qemupid) 59 bb.note("qemu started - qemu procces pid is %s" % self.qemupid)
60 60
61 console = oeQemuConsole(self.streampath, self.logfile) 61 console = oeQemuConsole(self.streampath, self.logfile)
62 bb.note("Waiting at most 200 seconds for login banner") 62 bb.note("Waiting at most %d seconds for login banner" % self.boottime )
63 (match, text) = console.read_all_timeout("login:", 200) 63 (match, text) = console.read_all_timeout("login:", self.boottime)
64 64
65 if match: 65 if match:
66 bb.note("Reached login banner") 66 bb.note("Reached login banner")
@@ -80,7 +80,7 @@ class QemuRunner:
80 return False 80 return False
81 else: 81 else:
82 console.close() 82 console.close()
83 bb.note("Target didn't reached login boot in 120 seconds") 83 bb.note("Target didn't reached login boot in %d seconds" % self.boottime)
84 lines = "\n".join(text.splitlines()[-5:]) 84 lines = "\n".join(text.splitlines()[-5:])
85 bb.note("Last 5 lines of text:\n%s" % lines) 85 bb.note("Last 5 lines of text:\n%s" % lines)
86 bb.note("Check full boot log: %s" % self.logfile) 86 bb.note("Check full boot log: %s" % self.logfile)