-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_serial_itests.py
76 lines (51 loc) · 2.16 KB
/
run_serial_itests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import subprocess, sys, csv
from termcolor import colored
if len(sys.argv) < 2:
print("Please give test count as an argument")
exit()
test_count = sys.argv[1]
if not test_count.isdigit():
print("Please provide an integer as an argument")
exit()
# Define the command to be executed
cmd = ["python3", "run_itests.py"]
test_count = int(test_count)
# Define the columns to print
all_columns = [[""], [""], [""], [""]]
test_set = 4
fail_count = 0
success_count = 0
import os
for iter_count in range(0, test_count):
# Use subprocess to start the process in the background
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Wait for the process to complete
process.wait()
os.system('cls' if os.name == 'nt' else 'clear')
# Check the return code of the process
if process.returncode == 0:
print("Serial tests {} x {} = {} out of {} completed successfully.\n".format(iter_count+1, test_set, (iter_count+1)*test_set, test_count*test_set))
else:
print("Process failed with return code:", process.returncode)
# Read the contents of the text file and print each column
with open("test_results.txt") as f:
reader = csv.reader(f, delimiter='\t')
columns = zip(*reader)
for column in columns:
i = 0
while (i < len(column)):
if column[i] == "✓":
all_columns[i].append(colored(column[i], "green"))
success_count += 1
elif column[i] == "✗":
all_columns[i].append(colored(column[i], "red"))
fail_count += 1
else:
all_columns[i].append(column[i])
print(" ".join(all_columns[i]))
i += 1
print()
print("{}/{} of integration tests is successful.\n".format(success_count, success_count+fail_count))
if iter_count == test_count - 1:
with open("test_results_serial.txt", "w") as file:
file.write("{}/{} of integration tests is successful.\n".format(success_count, success_count+fail_count))