forked from roboterclubaachen/xpcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConscript.check
136 lines (122 loc) · 6.9 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
#!/usr/bin/env python
# -*- 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': 'atmega16', 'clock': 1000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega16a', 'clock': 1000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega644', 'clock': 1000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega8', 'clock': 1000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega168', 'clock': 1000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega328p', 'clock': 1000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega128', 'clock': 1000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega2561', 'clock': 1000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'atmega2560', 'clock': 1000000 },
{ 'path': 'release/tests/atmega', 'arch': 'avr', 'device': 'at90can128', 'clock': 16000000 },
{ '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': 'attiny26', 'clock': 1000000 },
{ 'path': 'release/tests/attiny', 'arch': 'avr', 'device': 'attiny2313', '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 },
]
check = 'all' if 'check' in BUILD_TARGETS else ARGUMENTS.get('check')
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'):
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)