Merge : status code fix for recipetimings wip
authorraptorbot <raptorbot@systemstesthead.symbian.intra>
Wed, 09 Dec 2009 20:09:35 +0000
branchwip
changeset 92 6ebd8f14df45
parent 91 de6993a90461 (current diff)
parent 88 b5820d0f3a1c (diff)
child 94 8cdd7cd64f20
child 97 3127d8e83e30
Merge : status code fix for recipetimings
sbsv2/raptor/bin/recipestats.py
--- a/sbsv2/raptor/bin/recipestats.py	Wed Dec 09 13:46:46 2009 +0000
+++ b/sbsv2/raptor/bin/recipestats.py	Wed Dec 09 20:09:35 2009 +0000
@@ -66,14 +66,14 @@
 
 	recipe_re = re.compile(".*<recipe name='([^']+)'.*")
 	time_re = re.compile(".*<time start='([0-9]+\.[0-9]+)' *elapsed='([0-9]+\.[0-9]+)'.*")
-	status_re = re.compile(".*<status exit='([^']*)'.*")
+	status_re = re.compile(".*<status exit='(?P<exit>(ok|failed))'( *code='(?P<code>[0-9]+)')?.*")
 
 	alternating = 0
 	start_time = 0.0
 
 	
 	for l in f.xreadlines():
-		l2 = l.rstrip("\n")
+		l2 = l.rstrip("\n\r")
 		rm = recipe_re.match(l2)
 
 		if rm is not None:
@@ -83,26 +83,32 @@
 
 		tm = time_re.match(l2)
 		if tm is not None:
-			s = float(tm.groups()[0])
-			elapsed = float(tm.groups()[1])
+			try:
+				s = float(tm.groups()[0])
+				elapsed = float(tm.groups()[1])
+
+				if start_time == 0.0:
+					start_time = s
 
-			if start_time == 0.0:
-				start_time = s
+				s -= start_time
 
-			s -= start_time
-
-			#print s,elapsed
-			continue
+				#print s,elapsed
+				continue
+			except ValueError, e:
+				raise Exception("Parse problem: float conversion on these groups: %s\n%s" %(str(tm.groups()), str(e)))
+		else:
+			if l2.find("<time") is not -1:
+				raise Exception("unparsed timing status: %s\n"%l2)
 
 		sm = status_re.match(l2)
 
 		if sm is None:
 			continue
 
-		if sm.groups()[0] == 'ok':
+		if sm.groupdict()['exit'] == 'ok':
 			status = 0
 		else:
-			status = int(sm.groups()[0])
+			status = int(sm.groupdict()['code'])
 
 		st.add(s, elapsed, rname, status)