14
14
import org .junit .runners .Parameterized .Parameters ;
15
15
16
16
import io .sloeber .core .api .CodeDescriptor ;
17
+ import io .sloeber .core .api .CompileOptions ;
17
18
import io .sloeber .core .api .LibraryManager ;
18
19
import io .sloeber .providers .Arduino ;
19
20
import io .sloeber .providers .MCUBoard ;
22
23
@ RunWith (Parameterized .class )
23
24
public class CreateAndCompileArduinoIDEExamplesOnAVRHardwareTest {
24
25
private CodeDescriptor myCodeDescriptor ;
25
- private Examples myExample ;
26
+ private MCUBoard myBoard ;
27
+ private String myProjectName ;
26
28
private static int myBuildCounter = 0 ;
27
29
private static int myTotalFails = 0 ;
28
30
private static int maxFails = 50 ;
29
31
private static int mySkipAtStart = 0 ;
30
32
31
- public CreateAndCompileArduinoIDEExamplesOnAVRHardwareTest ( CodeDescriptor codeDescriptor ,
32
- Examples example ) {
33
+ public CreateAndCompileArduinoIDEExamplesOnAVRHardwareTest ( String projectName , CodeDescriptor codeDescriptor ,
34
+ MCUBoard board ) {
33
35
34
36
myCodeDescriptor = codeDescriptor ;
35
- myExample = example ;
37
+ myBoard = board ;
38
+ myProjectName =projectName ;
36
39
}
37
40
38
41
@ SuppressWarnings ("rawtypes" )
39
- @ Parameters (name = "{index}: {0}" )
42
+ @ Parameters (name = " {0}" )
40
43
public static Collection examples () {
41
44
Shared .waitForAllJobsToFinish ();
42
45
LinkedList <Object []> examples = new LinkedList <>();
46
+ MCUBoard [] allBoards =Arduino .getAllBoards ();
43
47
44
48
TreeMap <String , IPath > exampleFolders = LibraryManager .getAllArduinoIDEExamples ();
45
49
for (Map .Entry <String , IPath > curexample : exampleFolders .entrySet ()) {
@@ -51,9 +55,13 @@ public static Collection examples() {
51
55
52
56
paths .add (examplePath );
53
57
CodeDescriptor codeDescriptor = CodeDescriptor .createExample (false , paths );
54
-
55
- Object [] theData = new Object [] { codeDescriptor , example };
58
+ for (MCUBoard curboard : allBoards ) {
59
+ if (curboard .isExampleSupported (example )) {
60
+ String projectName =Shared .getProjectName (codeDescriptor , example , curboard );
61
+ Object [] theData = new Object [] { projectName , codeDescriptor , curboard };
56
62
examples .add (theData );
63
+ }
64
+ }
57
65
}
58
66
}
59
67
@@ -69,7 +77,8 @@ private static boolean skipExample(Examples example) {
69
77
return example .getPath ().toString ().contains ("Teensy" );
70
78
}
71
79
72
- public void testExample (MCUBoard board ) {
80
+ @ Test
81
+ public void testExample () {
73
82
// Stop after X fails because
74
83
// the fails stays open in eclipse and it becomes really slow
75
84
// There are only a number of issues you can handle
@@ -79,144 +88,11 @@ public void testExample(MCUBoard board) {
79
88
Assume .assumeTrue ("To many fails. Stopping test" , myTotalFails < maxFails );
80
89
//because we run all examples on all boards we need to filter incompatible combinations
81
90
//like serial examples on gemma
82
- if (!board .isExampleSupported (myExample )) {
83
- return ;
84
- }
85
- if (!Shared .BuildAndVerify ( board .getBoardDescriptor (), myCodeDescriptor , null )) {
91
+
92
+ if (!Shared .BuildAndVerify ( myProjectName ,myBoard .getBoardDescriptor (), myCodeDescriptor , new CompileOptions (null ))) {
86
93
myTotalFails ++;
87
94
}
88
95
}
89
96
90
- @ Test
91
- public void testArduinoIDEExamplesOnUno () {
92
- testExample (Arduino .uno ());
93
- }
94
-
95
- @ Test
96
- public void testArduinoIDEExamplesOnLeonardo () {
97
- testExample (Arduino .leonardo ());
98
- }
99
-
100
- @ Test
101
- public void testArduinoIDEExamplesOnEsplora () {
102
- testExample (Arduino .esplora ());
103
- }
104
-
105
- @ Test
106
- public void testArduinoIDEExamplesOnYun () {
107
- testExample (Arduino .yun ());
108
- }
109
-
110
- @ Test
111
- public void testArduinoIDEExamplesOnDiecimila () {
112
- testExample (Arduino .getAvrBoard ("diecimila" ));
113
- }
114
-
115
- @ Test
116
- public void testArduinoIDEExamplesOnMega () {
117
- testExample (Arduino .getMega2560Board ());
118
- }
119
-
120
- @ Test
121
- public void testArduinoIDEExamplesOneMegaADK () {
122
- testExample (Arduino .MegaADK ());
123
-
124
- }
125
-
126
- @ Test
127
- public void testArduinoIDEExamplesOnLeonardoEth () {
128
-
129
- testExample (Arduino .getAvrBoard ("leonardoeth" ));
130
-
131
- }
132
-
133
- @ Test
134
- public void testArduinoIDEExamplesOneMicro () {
135
-
136
- testExample (Arduino .getAvrBoard ("micro" ));
137
-
138
- }
139
-
140
- @ Test
141
- public void testArduinoIDEExamplesOneMini () {
142
- testExample (Arduino .getAvrBoard ("mini" ));
143
-
144
- }
145
-
146
- @ Test
147
- public void testArduinoIDEExamplesOnEthernet () {
148
- testExample (Arduino .getAvrBoard ("ethernet" ));
149
- }
150
-
151
- @ Test
152
- public void testArduinoIDEExamplesOnFio () {
153
- testExample (Arduino .getAvrBoard ("fio" ));
154
- }
155
-
156
- @ Test
157
- public void testArduinoIDEExamplesOnBt () {
158
- testExample (Arduino .getAvrBoard ("bt" ));
159
- }
160
-
161
- @ Test
162
- public void testArduinoIDEExamplesOnLilyPadUSB () {
163
- testExample (Arduino .getAvrBoard ("LilyPadUSB" ));
164
- }
165
-
166
- @ Test
167
- public void testArduinoIDEExamplesOnlilypad () {
168
- testExample (Arduino .getAvrBoard ("lilypad" ));
169
- }
170
-
171
- @ Test
172
- public void testArduinoIDEExamplesOnPro () {
173
- testExample (Arduino .getAvrBoard ("pro" ));
174
- }
175
-
176
- @ Test
177
- public void testArduinoIDEExamplesOnatmegang () {
178
- testExample (Arduino .getAvrBoard ("atmegang" ));
179
- }
180
-
181
- @ Test
182
- public void testArduinoIDEExamplesOnrobotControl () {
183
- testExample (Arduino .getAvrBoard ("robotControl" ));
184
- }
185
-
186
- @ Test
187
- public void testArduinoIDEExamplesOnrobotMotor () {
188
- testExample (Arduino .getAvrBoard ("robotMotor" ));
189
- }
190
-
191
- @ Test
192
- public void testArduinoIDEExamplesOngemma () {
193
- testExample (Arduino .getAvrBoard ("gemma" ));
194
- }
195
-
196
- @ Test
197
- public void testArduinoIDEExamplesOncircuitplay32u4cat () {
198
- testExample (Arduino .adafruitnCirquitPlayground ());
199
- }
200
-
201
- @ Test
202
- public void testArduinoIDEExamplesOnyunmini () {
203
- testExample (Arduino .getAvrBoard ("yunmini" ));
204
-
205
- }
206
-
207
- @ Test
208
- public void testArduinoIDEExamplesOnchiwawa () {
209
- testExample (Arduino .getAvrBoard ("chiwawa" ));
210
- }
211
-
212
- @ Test
213
- public void testArduinoIDEExamplesOnone () {
214
- testExample (Arduino .getAvrBoard ("one" ));
215
- }
216
-
217
- @ Test
218
- public void testArduinoIDEExamplesOnunowifi () {
219
- testExample (Arduino .getAvrBoard ("unowifi" ));
220
- }
221
97
222
98
}
0 commit comments