forked from roboterclubaachen/xpcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConscript.check
executable file
·186 lines (169 loc) · 11.4 KB
/
SConscript.check
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011, Roboterclub Aachen e.V.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Roboterclub Aachen e.V. nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY ROBOTERCLUB AACHEN E.V. ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ROBOTERCLUB AACHEN E.V. BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
import os
import string
Import('env')
devices = [
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega8', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega16', 'clock': 16000000 },
# { 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega16a', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega162', 'clock': 16000000 },
# { 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega165', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega168', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega32', 'clock': 16000000 },
# { 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega325', 'clock': 16000000 },
# { 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega3250', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega328p', 'clock': 16000000 },
# { 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega3290', 'clock': 16000000 },
# { 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega3290a', 'clock': 16000000 },
# { 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega3290p', 'clock': 16000000 },
# { 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega3290pa', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega64', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega640', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega644', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega645', 'clock': 16000000 },
# { 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega6450', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega6490', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega128', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega1281', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega1280', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega2561', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega2560', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'at90can32', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'at90can64', 'clock': 16000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'at90can128', 'clock': 16000000 },
# { 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega8515', 'clock': 16000000 },
# { 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega8535', 'clock': 16000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny13', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny16', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny1634', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny20', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny25', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny2313', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny261', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny4', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny5', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny9', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny43u', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny4313', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny40', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny44', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny45', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny461', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny48', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny26', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny85', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny861', 'clock': 1000000 },
# { 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny88', 'clock': 1000000 },
# { 'path': 'release/tests/atxmega', 'arch': 'avr', 'device': 'atxmega128a1', 'clock': 1000000 },
# { 'path': 'release/tests/atxmega', 'arch': 'avr', 'device': 'atxmega192a3', 'clock': 1000000 },
# { 'path': 'release/tests/atxmega', 'arch': 'avr', 'device': 'atxmega32a4', 'clock': 1000000 },
# { 'path': 'release/tests/lpc', 'arch': 'cortex-m0', 'device': 'lpc1112_301', 'clock': 12000000 },
# { 'path': 'release/tests/lpc', 'arch': 'cortex-m0', 'device': 'lpc1114_301', 'clock': 12000000 },
# { 'path': 'release/tests/lpc', 'arch': 'cortex-m0', 'device': 'lpc11c22_301', 'clock': 48000000 },
# { 'path': 'release/tests/lpc', 'arch': 'cortex-m0', 'device': 'lpc11c24_301', 'clock': 48000000 },
# { 'path': 'release/tests/lpc', 'arch': 'cortex-m3', 'device': 'lpc1343', 'clock': 12000000 },
# { 'path': 'release/tests/lpc', 'arch': 'cortex-m3', 'device': 'lpc1769', 'clock': 8000000 },
# { 'path': 'release/tests/stm32', 'arch': 'cortex-m3', 'device': 'stm32f103t4', 'clock': 72000000 }, # low density
# { 'path': 'release/tests/stm32', 'arch': 'cortex-m3', 'device': 'stm32f103rb', 'clock': 72000000 }, # medium density
# { 'path': 'release/tests/stm32', 'arch': 'cortex-m3', 'device': 'stm32f103ze', 'clock': 72000000 }, # high density
# { 'path': 'release/tests/stm32', 'arch': 'cortex-m3', 'device': 'stm32f103rg', 'clock': 72000000 }, # xl density
# { 'path': 'release/tests/stm32', 'arch': 'cortex-m3', 'device': 'stm32f107vc', 'clock': 72000000 }, # connectivity
# { 'path': 'release/tests/stm32', 'arch': 'cortex-m3', 'device': 'stm32f205ve', 'clock': 120000000 },
# { 'path': 'release/tests/stm32', 'arch': 'cortex-m3', 'device': 'stm32f207ze', 'clock': 120000000 },
{ 'path': 'release/tests/stm32', 'arch': 'cortex-m4', 'device': 'stm32f303cb', 'clock': 72000000 },
{ 'path': 'release/tests/stm32', 'arch': 'cortex-m4', 'device': 'stm32f303cc', 'clock': 72000000 },
# { 'path': 'release/tests/stm32', 'arch': 'cortex-m4', 'device': 'stm32f405vg', 'clock': 168000000 },
{ 'path': 'release/tests/stm32', 'arch': 'cortex-m4', 'device': 'stm32f407vg', 'clock': 168000000 },
{ 'path': 'release/tests/stm32', 'arch': 'cortex-m7f', 'device': 'stm32f746ng', 'clock': 216000000 },
{ 'path': 'release/tests/stm32', 'arch': 'cortex-m7fd', 'device': 'stm32f769ni', 'clock': 216000000 },
]
check = 'all' if 'check' in BUILD_TARGETS else ARGUMENTS.get('check')
# make it possible to only check the examples from one example directory
if ARGUMENTS.get('examples'):
examples_dir = os.path.join('examples', ARGUMENTS.get('examples'))
if not os.path.isdir(examples_dir):
print("\033[0;33mWarning: invalid argument value: {} does not exist!\033[0m".format(examples_dir))
examples_dir = 'examples'
else:
examples_dir = 'examples'
if check is not None:
result = []
everythingOk = True
if str(Platform()) != "win32":
color_red = "\033[0;31m"
color_green = "\033[0;32m"
color_yellow = "\033[0;33m"
color_default = "\033[0m"
else:
color_red = ""
color_green = ""
color_yellow = ""
color_default = ""
# Check that all examples compile without errors. The correct function of the
# examples is not checked!
if check in ['all', 'examples']:
result.append("Examples")
for path, directories, files in os.walk(examples_dir):
if 'SConstruct' in files:
exitStatus = os.system("scons -Q -C %s build" % path)
if exitStatus == 0:
result.append("check: %s -> Ok" % path)
else:
result.append(color_red + ("check: %s -> FAIL!" % path) + color_default)
if exitStatus != 0:
everythingOk = False
# Check if the XPCC library compiles against different targets without errors.
# The examples from xpcc/release/tests are compiled for all targets from the
# list 'devices' (at top of this file.
if check in ['all', 'devices']:
result.append("\nDevices")
for device in devices:
path = device['path']
projectFile = os.path.join(path, 'project.cfg')
output = string.Template(open('release/tests/project.cfg', 'r').read()).safe_substitute(device)
open(projectFile, 'w').write(output)
exitStatus = os.system("scons -Q -C %s build" % path)
if exitStatus == 0:
result.append("check: %s -> Ok" % device['device'])
else:
result.append(color_red + ("check: %s -> FAIL!" % device['device']) + color_default)
os.remove(projectFile)
if exitStatus != 0:
everythingOk = False
print "\nRESULTS:\n"
print '\n'.join(result)
if everythingOk:
print "\nOK!"
Exit(0)
else:
print "\nFAIL!"
Exit(1)
env.Alias('check', None)