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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
#!/usr/bin/env python
# This code runs compatibly under Python 2 and 3.x for x >= 2.
# Preserve this property!
from __future__ import absolute_import, print_function, division
import os
always_on = [
'minimal',
]
always_off = [
'leapfetch',
]
other = [
'debug',
'chrpath',
'ipv6',
'manbuild',
'nostrip',
'slow',
'profiling',
'libQgpsmm',
]
knobs = [
'aivdm',
'ashtech',
'bluez',
'clientdebug',
'control_socket',
'controlsend',
'coveraging',
'dbus_export',
'earthmate',
'evermore',
'force_global',
'fury',
'fv18',
'garmin',
'garmintxt',
'geostar',
'gpsclock',
'gpsd',
'gpsdclients',
'itrax',
'libgpsmm',
'mtk3301',
'navcom',
'ncurses',
'netfeed',
'nmea0183',
'nmea2000',
'nofloats',
'ntp',
'ntpshm',
'ntrip',
'oceanserver',
'oncore',
'passthrough',
'pps',
'python',
'qt',
'reconfigure',
'rtcm104v2',
'rtcm104v3',
'shared',
'shm_export',
'sirf',
'socket_export',
'squelch',
'superstar2',
'systemd',
'timing',
'tnt',
'tripmate',
'tsip',
'ublox',
'usb',
'xgps',
]
def main(starting_number_of_options=0):
import itertools
import multiprocessing
import shutil
import subprocess
num_cpus = multiprocessing.cpu_count()
job_arg = '-j%d' % num_cpus
failed_configurations = []
dev_null = open('/dev/null', 'w')
def _run(command, phase):
if subprocess.call(command, stdout=dev_null) == 0:
return True
failed_configurations.append(command)
print(command)
with open('failed_%s_configs.txt' % phase, 'a') as failed_configs:
failed_configs.write(' '.join(command) + '\n')
return False
static_params = [key + '=on' for key in always_on]
static_params += [key + '=off' for key in always_off]
for i in range(starting_number_of_options, len(knobs)):
print('Testing at length {}'.format(i))
for row in itertools.combinations(knobs, i):
print(row)
params = static_params + [key + '=on' for key in row]
# print {'on_params': row, 'scons_params': params}
# Clean before clearing cached options, in case options
# affect what's cleaned.
subprocess.call(['scons', '-c'], stdout=dev_null)
# Now remove all the scons temporaries
try:
shutil.rmtree('.sconf_temp')
except OSError:
pass
for f in ['.sconsign.dblite', '.scons-option-cache']:
try:
os.remove(f)
except OSError:
pass
if _run(['scons', job_arg, 'build-all'] + params, 'build'):
_run(['scons', job_arg, 'check'] + params, 'check')
return failed_configurations
if __name__ == '__main__':
failed = main(0)
for row in failed:
print(' '.join(row))
|