From 410b1509691bab4127c2a2c142f92607405ed24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Tue, 5 Dec 2017 09:16:58 +0100 Subject: [PATCH] Improve "dd" regexp to cope with newer versions in cgroup test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The newer `dd` reports human readable records separate for in and out records: 1142986240 bytes (1.1 GB) copied, 0.479684 s, 2.4 GB/s old: 1142986240 bytes (1.1 GB, 1.1 GiB) copied, 0.479684 s, 2.4 GB/s Let's improve the regexp to work well with both. Signed-off-by: Lukáš Doktor --- qemu/tests/cgroup.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qemu/tests/cgroup.py b/qemu/tests/cgroup.py index 311a9df1..5bb53b1e 100644 --- a/qemu/tests/cgroup.py +++ b/qemu/tests/cgroup.py @@ -287,7 +287,7 @@ def run(test, params, env): out[i] = out[i][1:-1] for _ in re.findall(re_dd, out[i])[1:-1]: data += int(_[0]) - duration += float(_[1]) + duration += float(_[2]) out[i] = int(data / duration) # normalize each output according to cgroup_weights @@ -359,8 +359,8 @@ def run(test, params, env): # ; true is necessarily when there is no dd present at the time kill_cmd = "rm -f /tmp/cgroup_lock; killall -9 dd; true" stat_cmd = "killall -SIGUSR1 dd; true" - re_dd = (r'(\d+) bytes \(\d+\.*\d* \w*\) copied, (\d+\.*\d*) s, ' - '\d+\.*\d* \w./s') + re_dd = (r'(\d+) bytes \(\d+\.*\d* \w*(, \d+\.*\d* \w*)?\) copied, ' + '(\d+\.*\d*) s, \d+\.*\d* \w./s') err = "" try: logging.info("Read test") @@ -501,7 +501,7 @@ def run(test, params, env): data = 0 for _ in re.findall(re_dd, out[i][j]): data += int(_[0]) - duration += float(_[1]) + duration += float(_[2]) output.append(['PASS', j, 'vm%d' % i, speeds[i][j], int(data / duration)]) # Don't measure unlimited speeds @@ -604,8 +604,8 @@ def run(test, params, env): # ; true is necessarily when there is no dd present at the time kill_cmd = "rm -f /tmp/cgroup_lock; killall -9 dd; true" stat_cmd = "killall -SIGUSR1 dd; true" - re_dd = (r'(\d+) bytes \(\d+\.*\d* \w*\) copied, (\d+\.*\d*) s, ' - '\d+\.*\d* \w./s') + re_dd = (r'(\d+) bytes \(\d+\.*\d* \w*(, \d+\.*\d* \w*)?\) copied, ' + '(\d+\.*\d*) s, \d+\.*\d* \w./s') err = "" try: logging.info("Read test") -- GitLab