[Fuego] [PATCH 3/4] Dhrystone: fix for the new parser

Daniel Sangorrin daniel.sangorrin at toshiba.co.jp
Fri Aug 4 02:17:25 UTC 2017


Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
 engine/tests/Benchmark.Dhrystone/criteria.json  | 16 ++++++++++++++++
 engine/tests/Benchmark.Dhrystone/parser.py      | 20 ++++++--------------
 engine/tests/Benchmark.Dhrystone/reference.json | 18 ++++++++++++++++++
 engine/tests/Benchmark.Dhrystone/reference.log  |  2 --
 4 files changed, 40 insertions(+), 16 deletions(-)
 create mode 100644 engine/tests/Benchmark.Dhrystone/criteria.json
 create mode 100644 engine/tests/Benchmark.Dhrystone/reference.json
 delete mode 100644 engine/tests/Benchmark.Dhrystone/reference.log

diff --git a/engine/tests/Benchmark.Dhrystone/criteria.json b/engine/tests/Benchmark.Dhrystone/criteria.json
new file mode 100644
index 0000000..fe55b3b
--- /dev/null
+++ b/engine/tests/Benchmark.Dhrystone/criteria.json
@@ -0,0 +1,16 @@
+{
+    "schema_version":"1.0",
+    "criteria":[
+        {
+            "tguid":"default.Dhrystone.Score",
+            "reference":{
+                "value":0,
+                "comparison":"gt"
+            }
+        },
+        {
+            "tguid":"default.Dhrystone",
+            "min_pass":1
+        }
+    ]
+}
diff --git a/engine/tests/Benchmark.Dhrystone/parser.py b/engine/tests/Benchmark.Dhrystone/parser.py
index f410b2c..6664506 100755
--- a/engine/tests/Benchmark.Dhrystone/parser.py
+++ b/engine/tests/Benchmark.Dhrystone/parser.py
@@ -5,20 +5,12 @@ import os, re, sys
 sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
 import common as plib
 
+regex_string = "^(Dhrystones.per.Second:)(\ *)([\d]{1,8}.?[\d]{1,3})(.*)$"
 
-ref_section_pat = "\[[\w]+.[gle]{2}\]"
-cur_search_str = "^(Dhrystones.per.Second:)(\ *)([\d]{1,8}.?[\d]{1,3})(.*)$"
+measurements = {}
+matches = plib.parse_log(regex_string)
 
-cur_dict = {}
-cur_file = open(plib.TEST_LOG,'r')
-print "Reading current values from " + plib.TEST_LOG
-cur_raw_values = cur_file.readlines()
-cur_file.close()
-
-for cur_item in cur_raw_values:
-    cur_match = re.match(cur_search_str, cur_item)
-    if cur_match:
-        cur_dict["Dhrystone"] = cur_match.group(3)
-
-sys.exit(plib.process_data(ref_section_pat, cur_dict, 's', 'FPS'))
+if matches:
+    measurements['default.Dhrystone'] = [{"name": "Score", "measure" : float(matches[0][2])}]
 
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Benchmark.Dhrystone/reference.json b/engine/tests/Benchmark.Dhrystone/reference.json
new file mode 100644
index 0000000..532ac16
--- /dev/null
+++ b/engine/tests/Benchmark.Dhrystone/reference.json
@@ -0,0 +1,18 @@
+{
+    "test_sets":[
+        {
+            "name":"default",
+            "test_cases":[
+                {
+                    "name":"Dhrystone",
+                    "measurements":[
+                        {
+                            "name":"Score",
+                            "unit":"Dhrystones/s"
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
diff --git a/engine/tests/Benchmark.Dhrystone/reference.log b/engine/tests/Benchmark.Dhrystone/reference.log
deleted file mode 100644
index 7cdba53..0000000
--- a/engine/tests/Benchmark.Dhrystone/reference.log
+++ /dev/null
@@ -1,2 +0,0 @@
-[Dhrystone|ge]
-1
-- 
2.7.4




More information about the Fuego mailing list