[Fuego] [PATCH 1/1] fio/parser.py: Add support to parse later versions of fio 2.16

[email protected] Tue, 12 Apr 2022 21:50:14 +0530
Newsgroups dev.linux.lists.fuego
Message-ID <[email protected]>
From: sireesha <[email protected]>

The existing parser.py file works for fio version 2.0.8 which is the
test version defined and used in fuego tests.

As fio output has changed from 2.16 version, to use fio with fuego
the parser is modified to parse the output of fio version 2.0.8 and
later versions of 2.16.

Signed-off-by: sireesha <[email protected]>
Signed-off-by: venkata pyla <[email protected]>
---
 tests/Benchmark.fio/parser.py | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
 mode change 100755 => 100644 tests/Benchmark.fio/parser.py

diff --git a/tests/Benchmark.fio/parser.py b/tests/Benchmark.fio/parser.py
old mode 100755
new mode 100644
index 52a44e5..ab3ea34
--- a/tests/Benchmark.fio/parser.py
+++ b/tests/Benchmark.fio/parser.py
@@ -4,13 +4,22 @@
 import os, sys
 import common as plib
 
-regex_string = '(  READ:|  WRITE:)(.*)(aggrb=)([\d.]+)([KM]B\/s)'
+test_version = ''
+with open(plib.TEST_LOG,'r') as cur_file:
+    raw_values = cur_file.readlines()
+    test_version = raw_values[4].rstrip("\n")
+
+if test_version > '2.16':
+    regex_string = '( READ:| WRITE:).*bw=.*\(([\d.]+)([kKM]B\/s)\)'
+else:
+    regex_string = '(  READ:|  WRITE:).*aggrb=([\d.]+)([KM]B\/s)'
+
 measurements = {}
 
 # handle results in MB or KB
 def set_measure(tguid, match):
-    speed = match[3]
-    units = match[4]
+    speed = match[1]
+    units = match[2]
     multiplier = 1
     if units.startswith('M'):
         # WARNING - this depends on the value of kb_base specified to
-- 
2.20.1