-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun_tests.py
47 lines (40 loc) · 1.23 KB
/
run_tests.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
import os
import os.path
import glob
import subprocess
import sys
import tests.python_tests
import tests.test_post
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,"--log_level=unit_scope"], stdout=subprocess.PIPE, universal_newlines=True)
test_failed = False
print(output.stdout)
if output.returncode:
test_failed = True
if "fail" in output.stdout:
test_failed = True
if "test_output" in file:
test_failed = False
if test_failed:
print("Test %s failed" % file)
glob_fail = True
else:
print("Test %s passed" % file)
tests.test_post.post()
for name, attr in tests.python_tests.__dict__.items():
if 'test' in name:
try:
attr()
print("Test %s passed" %name)
except Exception:
print("Test %s failed" %name)
print(attr())
glob_fail = True
if glob_fail:
sys.exit(1)