test_hifi: Fix occasional test breakage

Source of error: regex to parse ps output had a single space, rather
than handling any amount of whitespace before the CPU percentage.  When
that percentage would drop below 10.0, an space would be printed,
confusing the regex.

Fixed by handling arbitrary whitespace before the percentage.
This commit is contained in:
Brandon Heller
2012-11-14 10:47:00 -08:00
parent 82c8bdaf0d
commit 03c3123bb8
+1 -1
View File
@@ -626,7 +626,7 @@ class Mininet( object ):
# Split by line. Ignore first line, which looks like this:
# PID %CPU COMMAND\n
for line in test_output.split('\n')[1:]:
r = r'\d+ (\d+\.\d+)'
r = r'\d+\s*(\d+\.\d+)'
m = re.search( r, line )
if m is None:
error( '*** Error: could not extract CPU fraction: %s\n' %