summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMikko Rapeli <mikko.rapeli@linaro.org>2023-02-09 10:09:32 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-02-10 09:25:44 +0000
commit49da864246bc1af80027698ece68769faaed1d09 (patch)
tree9d43f5383b0b3fc5f4c96cefe68b48a8a5ba56b1 /meta
parenta0ccfba547bbc5500c7e11dcc401fceca33413a5 (diff)
downloadpoky-49da864246bc1af80027698ece68769faaed1d09.tar.gz
oeqa dump.py: add error counter and stop after 5 failures
If test target qemu machine hangs completely, dump_target() calls over serial console are taking a long time to time out, possibly for every failing ssh command execution and a lot of test cases, and same with dump_monitor(). Instead of trying for ever, count errors and after 5 stop trying to dump_target() and dump_monitor() completely. These help to end testing earlier when a test target is completely deadlocked and all ssh, serial and QMP communication with it are failing. (From OE-Core rev: d9ad0a055abba983c6cee1dca4d2f0a8a3c48782) Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/utils/dump.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/meta/lib/oeqa/utils/dump.py b/meta/lib/oeqa/utils/dump.py
index bcee03b576..d420b497f9 100644
--- a/meta/lib/oeqa/utils/dump.py
+++ b/meta/lib/oeqa/utils/dump.py
@@ -93,37 +93,55 @@ class HostDumper(BaseDumper):
93 self._write_dump(cmd.split()[0], result.output) 93 self._write_dump(cmd.split()[0], result.output)
94 94
95class TargetDumper(BaseDumper): 95class TargetDumper(BaseDumper):
96 """ Class to get dumps from target, it only works with QemuRunner """ 96 """ Class to get dumps from target, it only works with QemuRunner.
97 Will give up permanently after 5 errors from running commands over
98 serial console. This helps to end testing when target is really dead, hanging
99 or unresponsive.
100 """
97 101
98 def __init__(self, cmds, parent_dir, runner): 102 def __init__(self, cmds, parent_dir, runner):
99 super(TargetDumper, self).__init__(cmds, parent_dir) 103 super(TargetDumper, self).__init__(cmds, parent_dir)
100 self.runner = runner 104 self.runner = runner
105 self.errors = 0
101 106
102 def dump_target(self, dump_dir=""): 107 def dump_target(self, dump_dir=""):
108 if self.errors >= 5:
109 print("Too many errors when dumping data from target, assuming it is dead! Will not dump data anymore!")
110 return
103 if dump_dir: 111 if dump_dir:
104 self.dump_dir = dump_dir 112 self.dump_dir = dump_dir
105 for cmd in self.cmds: 113 for cmd in self.cmds:
106 # We can continue with the testing if serial commands fail 114 # We can continue with the testing if serial commands fail
107 try: 115 try:
108 (status, output) = self.runner.run_serial(cmd) 116 (status, output) = self.runner.run_serial(cmd)
117 if status == 0:
118 self.errors = self.errors + 1
109 self._write_dump(cmd.split()[0], output) 119 self._write_dump(cmd.split()[0], output)
110 except: 120 except:
121 self.errors = self.errors + 1
111 print("Tried to dump info from target but " 122 print("Tried to dump info from target but "
112 "serial console failed") 123 "serial console failed")
113 print("Failed CMD: %s" % (cmd)) 124 print("Failed CMD: %s" % (cmd))
114 125
115class MonitorDumper(BaseDumper): 126class MonitorDumper(BaseDumper):
116 """ Class to get dumps via the Qemu Monitor, it only works with QemuRunner """ 127 """ Class to get dumps via the Qemu Monitor, it only works with QemuRunner
128 Will stop completely if there are more than 5 errors when dumping monitor data.
129 This helps to end testing when target is really dead, hanging or unresponsive.
130 """
117 131
118 def __init__(self, cmds, parent_dir, runner): 132 def __init__(self, cmds, parent_dir, runner):
119 super(MonitorDumper, self).__init__(cmds, parent_dir) 133 super(MonitorDumper, self).__init__(cmds, parent_dir)
120 self.runner = runner 134 self.runner = runner
135 self.errors = 0
121 136
122 def dump_monitor(self, dump_dir=""): 137 def dump_monitor(self, dump_dir=""):
123 if self.runner is None: 138 if self.runner is None:
124 return 139 return
125 if dump_dir: 140 if dump_dir:
126 self.dump_dir = dump_dir 141 self.dump_dir = dump_dir
142 if self.errors >= 5:
143 print("Too many errors when dumping data from qemu monitor, assuming it is dead! Will not dump data anymore!")
144 return
127 for cmd in self.cmds: 145 for cmd in self.cmds:
128 cmd_name = cmd.split()[0] 146 cmd_name = cmd.split()[0]
129 try: 147 try:
@@ -137,4 +155,5 @@ class MonitorDumper(BaseDumper):
137 output = self.runner.run_monitor(cmd_name) 155 output = self.runner.run_monitor(cmd_name)
138 self._write_dump(cmd_name, output) 156 self._write_dump(cmd_name, output)
139 except Exception as e: 157 except Exception as e:
158 self.errors = self.errors + 1
140 print("Failed to dump QMP CMD: %s with\nException: %s" % (cmd_name, e)) 159 print("Failed to dump QMP CMD: %s with\nException: %s" % (cmd_name, e))