summaryrefslogtreecommitdiff
path: root/devtools/identify_failing_build_options.py
blob: ae36cdbb38080342458a1e308b21e6ebd6595e5b (plain)
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
#!/usr/bin/env python

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',
    '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',
]


def main(starting_number_of_options=0):
    import itertools
    failed_configurations = []

    for i in range(starting_number_of_options, len(knobs)):
        jj = itertools.combinations(knobs, i)
        print 'Testing at length {}'.format(i)

        for row in list(jj):
            print row
            params = []

            for key in always_on:
                params.append(key + "=on")

            for key in always_off:
                params.append(key + "=off")

            for key in knobs:
                if key in row:
                    params.append(key + "=on")

            # print {'on_params': row, 'scons_params': params}

            dev_null = open('/dev/null', 'w')
            import subprocess
            command = ['scons', '-j9']
            command.extend(params)
            if os.path.exists('.scons-option-cache'):
                os.remove('.scons-option-cache')
            retval = subprocess.call(['scons', '-c'], stdout=dev_null)

            retval = subprocess.call(command, stdout=dev_null)
            if retval != 0:
                failed_configurations.append(command)
                print command
                with open('failed_build_configs.txt', 'a') as failed_configs:
                    failed_configs.write(' '.join(command) + '\n')

            if retval == 0:
                command = ['scons', 'check']
                command.extend(params)
                retval = subprocess.call(command, stdout=dev_null)
                if retval != 0:
                    print command
                with open('check_build_configs.txt', 'a') as failed_configs:
                    failed_configs.write(str(retval) + ' ' + ' '.join(command) + '\n')

    return failed_configurations

if __name__ == '__main__':
    failed = main(0)
    for row in failed:
        print ' '.join(row)