-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_launcher.py.in
More file actions
38 lines (36 loc) · 1.74 KB
/
test_launcher.py.in
File metadata and controls
38 lines (36 loc) · 1.74 KB
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
import argparse
import subprocess
import sys
parser = argparse.ArgumentParser( description='Death test launcher' )
parser.add_argument("-e", "--engine", type=str)
parser.add_argument("-L", "--parallel_launcher", type=str)
parser.add_argument("-p", "--min_process_count", type=int)
parser.add_argument("-P", "--max_process_count", type=int)
parser.add_argument("-t", "--lpf_probe_timer", type=float)
parser.add_argument("-R", "--expected_return_code", type=int)
parser.add_argument( 'cmd', nargs=argparse.REMAINDER )
args = parser.parse_args()
# This is only for passing Gtest info to CMake
# The parallel launcher is still needed as Open MPI
# binaries terminate without the launcher on our cluster,
# even for single process runs
if args.cmd[-1] == '--gtest_list_tests':
run_cmd = [args.parallel_launcher, '-engine', args.engine, '-n', '1'] + args.cmd
cmd = subprocess.run( run_cmd)
sys.exit(cmd.returncode)
# Actual use of our launcher
else:
for i in range(args.min_process_count, args.max_process_count+1):
if args.lpf_probe_timer > 0.0:
run_cmd = [args.parallel_launcher, '-engine', args.engine, '-probe', str(args.lpf_probe_timer), '-n', str(i)] + args.cmd
else:
run_cmd = [args.parallel_launcher, '-engine', args.engine, '-n', str(i)] + args.cmd
print("Run command: ")
print(run_cmd)
cmd = subprocess.run( run_cmd)
print("Test returned code = " + str(cmd.returncode))
retcode = cmd.returncode
if (retcode != args.expected_return_code):
print("Test " + args.cmd[0] + args.cmd[1] + "\nreturned\t" + str(retcode) + "\nexpected return code was: " + str(args.expected_return_code))
sys.exit(1)
print("Test " + args.cmd[0] + args.cmd[1] + " passed")