-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.py
More file actions
30 lines (25 loc) · 770 Bytes
/
run_tests.py
File metadata and controls
30 lines (25 loc) · 770 Bytes
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
import os
import os.path
import glob
import subprocess
import sys
DIR = "tests/bin/*"
files = glob.glob(DIR)
glob_fail = False
for file in files:
if sys.platform == "win32" and file.split(".")[-1] != "exe":
continue
if not os.path.isdir(file) and "test" in file: # skip directories and unwanted files such as core dumps
output = subprocess.run([file], stdout=subprocess.PIPE, universal_newlines=True)
test_failed = False
if output.returncode:
test_failed = True
if "fail" in output.stdout:
test_failed = True
if test_failed:
print("Test %s failed" % file)
glob_fail = True
else:
print("Test %s passed" % file)
if glob_fail:
sys.exit(1)