From 03c3123bb8fa0da4757c4d820ee1ade7f77e8f2e Mon Sep 17 00:00:00 2001 From: Brandon Heller Date: Wed, 14 Nov 2012 10:46:50 -0800 Subject: [PATCH] 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. --- mininet/net.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mininet/net.py b/mininet/net.py index 066751c..33791c1 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -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' %