summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2015-09-02 13:44:42 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-03 12:43:31 +0100
commit097f36f636a624a9cf3f04780000671d7bc3df50 (patch)
treed4430fffec0d02d39a2cb295b3fef92fd6b679f2
parenta3fec07654e6992eab96861892d4261b1e2e0ebf (diff)
downloadpoky-097f36f636a624a9cf3f04780000671d7bc3df50.tar.gz
qemurunner: Handle lack of data on run serial gracefully
This changes the behavior when data was not received over the serial console when a command is run. With this the socket is no longer closed but it throws and exception that can handled in upper layers. With this the test can continue without throwing errors for not having the socket anymore. [YOCTO #8118] (From OE-Core rev: 4770a766389b94ddd5639d7a92e196abac38da22) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/utils/dump.py12
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py21
2 files changed, 22 insertions, 11 deletions
diff --git a/meta/lib/oeqa/utils/dump.py b/meta/lib/oeqa/utils/dump.py
index 6067438e35..4ae871c657 100644
--- a/meta/lib/oeqa/utils/dump.py
+++ b/meta/lib/oeqa/utils/dump.py
@@ -12,6 +12,7 @@ def get_host_dumper(d):
12 12
13 13
14class BaseDumper(object): 14class BaseDumper(object):
15 """ Base class to dump commands from host/target """
15 16
16 def __init__(self, cmds, parent_dir): 17 def __init__(self, cmds, parent_dir):
17 self.cmds = [] 18 self.cmds = []
@@ -53,6 +54,7 @@ class BaseDumper(object):
53 54
54 55
55class HostDumper(BaseDumper): 56class HostDumper(BaseDumper):
57 """ Class to get dumps from the host running the tests """
56 58
57 def __init__(self, cmds, parent_dir): 59 def __init__(self, cmds, parent_dir):
58 super(HostDumper, self).__init__(cmds, parent_dir) 60 super(HostDumper, self).__init__(cmds, parent_dir)
@@ -66,6 +68,7 @@ class HostDumper(BaseDumper):
66 68
67 69
68class TargetDumper(BaseDumper): 70class TargetDumper(BaseDumper):
71 """ Class to get dumps from target, it only works with QemuRunner """
69 72
70 def __init__(self, cmds, parent_dir, qemurunner): 73 def __init__(self, cmds, parent_dir, qemurunner):
71 super(TargetDumper, self).__init__(cmds, parent_dir) 74 super(TargetDumper, self).__init__(cmds, parent_dir)
@@ -75,5 +78,10 @@ class TargetDumper(BaseDumper):
75 if dump_dir: 78 if dump_dir:
76 self.dump_dir = dump_dir 79 self.dump_dir = dump_dir
77 for cmd in self.cmds: 80 for cmd in self.cmds:
78 (status, output) = self.runner.run_serial(cmd) 81 # We can continue with the testing if serial commands fail
79 self._write_dump(cmd.split()[0], output) 82 try:
83 (status, output) = self.runner.run_serial(cmd)
84 self._write_dump(cmd.split()[0], output)
85 except:
86 print("Tried to dump info from target but "
87 "serial console failed")
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 4ce5d9c685..3ad747a503 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -197,13 +197,17 @@ class QemuRunner:
197 self.stop() 197 self.stop()
198 return False 198 return False
199 199
200 (status, output) = self.run_serial("root\n", raw=True) 200 # If we are not able to login the tests can continue
201 if re.search("root@[a-zA-Z0-9\-]+:~#", output): 201 try:
202 self.logged = True 202 (status, output) = self.run_serial("root\n", raw=True)
203 logger.info("Logged as root in serial console") 203 if re.search("root@[a-zA-Z0-9\-]+:~#", output):
204 else: 204 self.logged = True
205 logger.info("Couldn't login into serial console" 205 logger.info("Logged as root in serial console")
206 " as root using blank password") 206 else:
207 logger.info("Couldn't login into serial console"
208 " as root using blank password")
209 except:
210 logger.info("Serial console failed while trying to login")
207 211
208 else: 212 else:
209 logger.info("Qemu pid didn't appeared in %s seconds" % self.runqemutime) 213 logger.info("Qemu pid didn't appeared in %s seconds" % self.runqemutime)
@@ -321,8 +325,7 @@ class QemuRunner:
321 stopread = True 325 stopread = True
322 break 326 break
323 else: 327 else:
324 sock.close() 328 raise Exception("No data on serial console socket")
325 stopread = True
326 if data: 329 if data:
327 if raw: 330 if raw:
328 status = 1 331 status = 1