Repository navigation
Expand file tree
/
Copy pathtest
More file actions
executable file
·114 lines (96 loc) · 2.68 KB
/
Copy pathtest
File metadata and controls
executable file
·114 lines (96 loc) · 2.68 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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/env python3
"""
Run all scripts.
They should exit 0.
"""
import subprocess
import sys
import os
import os.path
rootdir = os.path.split(os.path.realpath(__file__))[0]
blacklist = set([
# Broken, haven't fixed or investigated further because lazy.
'main',
# Ubuntu 18.10, f7a18231432ccd41595e62a6be9c8b4b336a1dbb + 1:
#
# ImportError: No module named pure
# Failed to load "pure"
'py_from_c',
# RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
'pandas_cheat',
# Large download.
'nltk_cheat',
# pip build takes too long
'numpy_cheat',
'scipy_cheat',
# Networking.
'smtplib_cheat',
'urllib2_cheat',
# Infinite loop!
'test',
# Perceptible time.
'concurrent_submit',
'concurrent_map',
'concurrent_map_exception',
'thread_add',
'thread_cpu_bound',
'thread_limit',
# Meant to fail.
'unittest_cheat',
'wsgi',
])
ext = '.py'
# TODO: remove this and run all .py files
scripts = []
directories = []
for f in sorted(os.listdir(u'.')):
if os.path.isfile(f):
if os.access(f, os.X_OK):
noext, ext = os.path.splitext(f)
if ext == '.py' and not noext in blacklist:
scripts.append(f)
elif os.path.isdir(f):
if not f in blacklist:
directories.append(os.path.abspath(f))
# Files.
for script in scripts:
print(script)
sys.stdout.flush()
process = subprocess.Popen(
['./' + script],
shell = False,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
universal_newlines = True
)
if process.wait() != 0:
print('ASSERT FAILED: ' + script)
sys.exit(1)
# Directories.
for directory in directories:
directory_base = os.path.basename(directory)
test_script = os.path.join(directory, 'test')
if os.path.exists(test_script):
print(directory_base + os.sep)
os.chdir(directory)
if os.path.exists(os.path.join(directory, 'Makefile')):
process = subprocess.Popen(
['make'],
shell = False,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
)
assert process.wait() == 0
process = subprocess.Popen(
[test_script],
shell = False,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
)
if process.wait() != 0:
print('ASSERT FAILED: ' + directory_base)
sys.exit(1)
print('ALL ASSERTS PASSED')