Skip to content

Commit 8669f1c

Browse files
committed
fix(tests): Fix performance test result generation
1 parent 4e16236 commit 8669f1c

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
lines changed

tests/performance/coremark/test_coremark.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@ def test_coremark(dut, request):
4545
results = {"coremark": {"runs": runs, "cores": cores, "avg_score": avg_score}}
4646

4747
current_folder = os.path.dirname(request.path)
48+
os.makedirs(os.path.join(current_folder, dut.app.target), exist_ok=True)
4849
file_index = 0
4950
report_file = os.path.join(current_folder, dut.app.target, "result_coremark" + str(file_index) + ".json")
5051
while os.path.exists(report_file):
5152
report_file = report_file.replace(str(file_index) + ".json", str(file_index + 1) + ".json")
5253
file_index += 1
5354

54-
with open(report_file, "w") as f:
55+
with open(report_file, "w+") as f:
5556
try:
5657
f.write(json.dumps(results))
5758
except Exception as e:

tests/performance/fibonacci/test_fibonacci.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ def test_fibonacci(dut, request):
6767
results = {"fibonacci": {"runs": runs, "fib_n": fib_n, "avg_time": avg_time}}
6868

6969
current_folder = os.path.dirname(request.path)
70+
os.makedirs(os.path.join(current_folder, dut.app.target), exist_ok=True)
7071
file_index = 0
7172
report_file = os.path.join(current_folder, dut.app.target, "result_fibonacci" + str(file_index) + ".json")
7273
while os.path.exists(report_file):
7374
report_file = report_file.replace(str(file_index) + ".json", str(file_index + 1) + ".json")
7475
file_index += 1
7576

76-
with open(report_file, "w") as f:
77+
with open(report_file, "w+") as f:
7778
try:
7879
f.write(json.dumps(results))
7980
except Exception as e:

tests/performance/linpack_double/test_linpack_double.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ def test_linpack_double(dut, request):
4848
results = {"linpack_double": {"runs": runs, "avg_score": avg_score, "min_score": min_score, "max_score": max_score}}
4949

5050
current_folder = os.path.dirname(request.path)
51+
os.makedirs(os.path.join(current_folder, dut.app.target), exist_ok=True)
5152
file_index = 0
5253
report_file = os.path.join(current_folder, dut.app.target, "result_linpack_double" + str(file_index) + ".json")
5354
while os.path.exists(report_file):
5455
report_file = report_file.replace(str(file_index) + ".json", str(file_index + 1) + ".json")
5556
file_index += 1
5657

57-
with open(report_file, "w") as f:
58+
with open(report_file, "w+") as f:
5859
try:
5960
f.write(json.dumps(results))
6061
except Exception as e:

tests/performance/linpack_float/test_linpack_float.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ def test_linpack_float(dut, request):
4848
results = {"linpack_float": {"runs": runs, "avg_score": avg_score, "min_score": min_score, "max_score": max_score}}
4949

5050
current_folder = os.path.dirname(request.path)
51+
os.makedirs(os.path.join(current_folder, dut.app.target), exist_ok=True)
5152
file_index = 0
5253
report_file = os.path.join(current_folder, dut.app.target, "result_linpack_float" + str(file_index) + ".json")
5354
while os.path.exists(report_file):
5455
report_file = report_file.replace(str(file_index) + ".json", str(file_index + 1) + ".json")
5556
file_index += 1
5657

57-
with open(report_file, "w") as f:
58+
with open(report_file, "w+") as f:
5859
try:
5960
f.write(json.dumps(results))
6061
except Exception as e:

tests/performance/psramspeed/test_psramspeed.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,14 @@ def test_psramspeed(dut, request):
9292
results = {"psramspeed": {"runs": runs, "copies": copies, "max_test_size": max_test_size, "results": avg_results}}
9393

9494
current_folder = os.path.dirname(request.path)
95+
os.makedirs(os.path.join(current_folder, dut.app.target), exist_ok=True)
9596
file_index = 0
9697
report_file = os.path.join(current_folder, dut.app.target, "result_psramspeed" + str(file_index) + ".json")
9798
while os.path.exists(report_file):
9899
report_file = report_file.replace(str(file_index) + ".json", str(file_index + 1) + ".json")
99100
file_index += 1
100101

101-
with open(report_file, "w") as f:
102+
with open(report_file, "w+") as f:
102103
try:
103104
f.write(json.dumps(results))
104105
except Exception as e:

tests/performance/ramspeed/test_ramspeed.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,14 @@ def test_ramspeed(dut, request):
9292
results = {"ramspeed": {"runs": runs, "copies": copies, "max_test_size": max_test_size, "results": avg_results}}
9393

9494
current_folder = os.path.dirname(request.path)
95+
os.makedirs(os.path.join(current_folder, dut.app.target), exist_ok=True)
9596
file_index = 0
9697
report_file = os.path.join(current_folder, dut.app.target, "result_ramspeed" + str(file_index) + ".json")
9798
while os.path.exists(report_file):
9899
report_file = report_file.replace(str(file_index) + ".json", str(file_index + 1) + ".json")
99100
file_index += 1
100101

101-
with open(report_file, "w") as f:
102+
with open(report_file, "w+") as f:
102103
try:
103104
f.write(json.dumps(results))
104105
except Exception as e:

tests/performance/superpi/test_superpi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@ def test_superpi(dut, request):
4040
results = {"superpi": {"runs": runs, "digits": digits, "avg_time": avg_time}}
4141

4242
current_folder = os.path.dirname(request.path)
43+
os.makedirs(os.path.join(current_folder, dut.app.target), exist_ok=True)
4344
file_index = 0
4445
report_file = os.path.join(current_folder, dut.app.target, "result_superpi" + str(file_index) + ".json")
4546
while os.path.exists(report_file):
4647
report_file = report_file.replace(str(file_index) + ".json", str(file_index + 1) + ".json")
4748
file_index += 1
4849

49-
with open(report_file, "w") as f:
50+
with open(report_file, "w+") as f:
5051
try:
5152
f.write(json.dumps(results))
5253
except Exception as e:

0 commit comments

Comments
 (0)