summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime
diff options
context:
space:
mode:
authorBenjamin Esquivel <benjamin.esquivel@linux.intel.com>2016-02-01 13:53:15 -0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-16 09:04:22 +0000
commit637b44ce7c82c3bf4756f087559330e531cc12d1 (patch)
treeb7a675f718c27e3908207d5ddaa65ae6f4361512 /meta/lib/oeqa/runtime
parentef5b8b4656091e3de07d6944b532e2c037a1cfec (diff)
downloadpoky-637b44ce7c82c3bf4756f087559330e531cc12d1.tar.gz
runtime/systemd: Fix for boot time string parse error
boot time string can change its format of the output of the amount of time it took to boot. It is required to handle graceful fail of the parsing errors that it provokes [YOCTO #8889] (From OE-Core rev: d17f5079594cd74014f29054f9ad4f38c7ef03d8) Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime')
-rw-r--r--meta/lib/oeqa/runtime/systemd.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/meta/lib/oeqa/runtime/systemd.py b/meta/lib/oeqa/runtime/systemd.py
index 03c56ef9f0..2b2f10d71c 100644
--- a/meta/lib/oeqa/runtime/systemd.py
+++ b/meta/lib/oeqa/runtime/systemd.py
@@ -145,8 +145,7 @@ class SystemdJournalTests(SystemdTest):
145 except AssertionError: 145 except AssertionError:
146 self.fail("Error occurred while calling journalctl") 146 self.fail("Error occurred while calling journalctl")
147 if not len(output): 147 if not len(output):
148 self.fail("Error: unable to obtain the startup time from\ 148 self.fail("Error, unable to get startup time from systemd journal")
149 systemd journal")
150 149
151 # check for the regular expression items that match the startup time 150 # check for the regular expression items that match the startup time
152 for line in output.split('\n'): 151 for line in output.split('\n'):
@@ -156,20 +155,23 @@ class SystemdJournalTests(SystemdTest):
156 if check_match: 155 if check_match:
157 print "%s" % check_match 156 print "%s" % check_match
158 else: 157 else:
159 self.fail("Error while obtaining the boot time from journalctl") 158 self.skipTest("Error at obtaining the boot time from journalctl")
160 boot_time_sec = 0 159 boot_time_sec = 0
161 160
162 # get the numeric values from the string and convert them to seconds 161 # get the numeric values from the string and convert them to seconds
163 # same data will be placed in list and string for manipulation 162 # same data will be placed in list and string for manipulation
164 l_boot_time = check_match.split(" ")[-2:] 163 l_boot_time = check_match.split(" ")[-2:]
165 s_boot_time = " ".join(l_boot_time) 164 s_boot_time = " ".join(l_boot_time)
166 # Obtain the minutes it took to boot 165 try:
167 if l_boot_time[0].endswith('min') and l_boot_time[0][0].isdigit(): 166 # Obtain the minutes it took to boot
168 boot_time_min = s_boot_time.split("min")[0] 167 if l_boot_time[0].endswith('min') and l_boot_time[0][0].isdigit():
169 # convert to seconds and accumulate it 168 boot_time_min = s_boot_time.split("min")[0]
170 boot_time_sec += int(boot_time_min) * 60 169 # convert to seconds and accumulate it
171 # Obtain the seconds it took to boot and accumulate 170 boot_time_sec += int(boot_time_min) * 60
172 boot_time_sec += float(l_boot_time[1].split("s")[0]) 171 # Obtain the seconds it took to boot and accumulate
172 boot_time_sec += float(l_boot_time[1].split("s")[0])
173 except ValueError:
174 self.skipTest("Error when parsing time from boot string")
173 #Assert the target boot time against systemd's unit start timeout 175 #Assert the target boot time against systemd's unit start timeout
174 if boot_time_sec > systemd_TimeoutStartSec: 176 if boot_time_sec > systemd_TimeoutStartSec:
175 print "Target boot time %s exceeds systemd's TimeoutStartSec %s"\ 177 print "Target boot time %s exceeds systemd's TimeoutStartSec %s"\