aboutsummaryrefslogtreecommitdiff
path: root/ldcg-onednn-benchmarks/convert-onednn-test-to-result.py
diff options
context:
space:
mode:
Diffstat (limited to 'ldcg-onednn-benchmarks/convert-onednn-test-to-result.py')
-rw-r--r--ldcg-onednn-benchmarks/convert-onednn-test-to-result.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/ldcg-onednn-benchmarks/convert-onednn-test-to-result.py b/ldcg-onednn-benchmarks/convert-onednn-test-to-result.py
new file mode 100644
index 0000000000..e7d4ec88cf
--- /dev/null
+++ b/ldcg-onednn-benchmarks/convert-onednn-test-to-result.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+import sys
+
+testname = sys.argv[1] #takes testname as input
+workspace = sys.argv[2] #takes WORKSPACE root dir as input
+
+
+#opens the textfile corresponding to the testname from the tmp directory and saves it to pippo
+with open(workspace + "/oneDNN-results/" + testname + "-output.txt", 'r') as handle:
+ pippo = handle.readlines()
+
+#reads through each line of the testname and checks for PASS/FAIL results proving that the test has been completed correctly. If they exist then it adds them to a res_{testname}.txt file in SQUAD format.
+with open(workspace + "/oneDNN-results/res_" + testname + "-output.txt", 'w+') as whandle:
+ TestSuccess = False
+ TestFailed = False
+ for i in range(0,len(pippo)-2):
+ line = pippo[i]
+ line = line[2:]
+ if 'FAILED' in pippo[i]:
+ TestSuccess = True
+ TestFailed = True
+ break
+ elif 'PASSED' in pippo[i]:
+ if TestSuccess == False:
+ TestSuccess = True
+
+ #if no PASS/FAIL results only writes "{testname} : fail" to the result.
+ if TestSuccess == False or TestFailed == True:
+ whandle.write("\"" + testname + "\"" + ": " + "\"" + "fail" + "\"")
+ elif TestSuccess == True:
+ whandle.write("\"" + testname + "\"" + ": " + "\"" + "pass" + "\"")