-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests2.py
78 lines (69 loc) · 3.72 KB
/
tests2.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
77
78
import os
import subprocess
import sys
from datetime import datetime
x_counts = []
y_counts = []
z_counts = []
cutoffs = []
#Creates a series of tests with 1/3/5/7/9 particles in each dimension, and a variety of cutoff lengths
def define_tests():
global x_counts, y_counts, z_counts, cutoffs
for i in range(1,20):
x_counts.append(350)
#Runs the generator, solution computer and tests scripts on each of the inputs defined in define_tests
def run_tests():
global x_counts, y_counts, z_counts, cutoffs
define_tests()
test_num = 0
start=datetime.now()
copy = subprocess.run(["cp", "examples/interaction_count/defaults.rg", "."])
for i in range(len(x_counts)):
test_num = test_num + 1
print("--------------------------")
print("RUNNING TEST NUMBER {}".format(test_num))
print("--------------------------")
box_x = 3.0
box_y = 3.0
box_z = 3.0
try:
bop = subprocess.run(["python3", "tests/interaction_count/generate_random.py", "--output", "tests/interaction_count/test_0.hdf5"
,
"--count","{}".format(x_counts[i]), "--seed", "{}".format(test_num)], check=True,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except:
print("Failed for {}".format(bop.args))
sys.exit(1)
try:
pop = subprocess.run(["python3", "tests/interaction_count/compute_solution.py", "--input", "tests/interaction_count/test_0.hdf5"
, "--output", "tests/interaction_count/solution_0.hdf5",
"--box_x", "{}".format(box_x),
"--box_y", "{}".format(box_y), "--box_z", "{}".format(box_z)], check=True,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except:
print("Failed for {}".format(pop.args))
sys.exit(1)
# try:
pop3 = subprocess.run(["legion/language/regent.py", "tests/interaction_count/interaction_test_sym.rg", "-input", "tests/interaction_count/test_0.hdf5"
, "-solution", "tests/interaction_count/solution_0.hdf5",
"-x_cell", "{}".format(box_x),
"-y_cell", "{}".format(box_y), "-z_cell", "{}".format(box_z)], check=False,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if pop3.returncode != 0:
print("Failed symmetric test {} {} {} {}".format(test_num, x_counts[i], y_counts[j], z_counts[k] ))
print("Sol args {}".format(pop.args))
print("Args {}".format(pop3.args))
sys.exit(1)
pop4 = subprocess.run(["legion/language/regent.py", "tests/interaction_count/interaction_test_asym.rg", "-input", "tests/interaction_count/test_0.hdf5"
, "-solution", "tests/interaction_count/solution_0.hdf5",
"-x_cell", "{}".format(box_x),
"-y_cell", "{}".format(box_y), "-z_cell", "{}".format(box_z)], check=False,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if pop4.returncode != 0:
print("Failed asymmetric test {} {} {} {}".format(test_num, x_counts[i], y_counts[j], z_counts[k]))
print("Sol args {}".format(pop.args))
print("Args {}".format(pop4.args))
sys.exit(1)
print("Tests took {}".format( datetime.now()-start))
if __name__ == '__main__':
run_tests()