-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
buildtest.py
executable file
·63 lines (53 loc) · 1.41 KB
/
buildtest.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
#!/usr/bin/python3
build_variants = [
'WITH_ADNS',
'WITH_BRIDGE',
'WITH_CJSON',
'WITH_DOCS',
'WITH_EC',
'WITH_EPOLL',
'WITH_MEMORY_TRACKING',
'WITH_PERSISTENCE',
'WITH_SHARED_LIBRARIES',
'WITH_SOCKS',
'WITH_SRV',
'WITH_STATIC_LIBRARIES',
'WITH_STRIP',
'WITH_SYSTEMD',
'WITH_SYS_TREE',
'WITH_THREADING',
'WITH_TLS',
'WITH_TLS_PSK',
'WITH_UNIX_SOCKETS',
'WITH_WEBSOCKETS',
'WITH_WRAP',
'WITH_XTREPORT',
]
special_variants = [
'WITH_BUNDLED_DEPS',
'WITH_COVERAGE',
]
import os
import random
import subprocess
def run_test(msg, opts):
subprocess.run(["make", "clean"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print("%s: %s" % (msg, str(opts)))
args = ["make", "-j%d" % (os.cpu_count())] + opts
proc = subprocess.run(args, stdout=subprocess.DEVNULL)
if proc.returncode != 0:
raise RuntimeError("BUILD FAILED: %s" % (' '.join(args)))
def simple_tests():
for bv in build_variants:
for enabled in ["yes", "no"]:
opts = "%s=%s" % (bv, enabled)
run_test("SIMPLE BUILD", [opts])
def random_tests(count=10):
for i in range(1, count):
opts = []
for bv in build_variants:
opts.append("%s=%s" % (bv, random.choice(["yes", "no"])))
run_test("RANDOM BUILD", opts)
if __name__ == "__main__":
simple_tests()
random_tests(100)