1414import org .junit .runners .Parameterized .Parameters ;
1515
1616import io .sloeber .core .api .CodeDescriptor ;
17+ import io .sloeber .core .api .CompileOptions ;
1718import io .sloeber .core .api .LibraryManager ;
1819import io .sloeber .providers .Arduino ;
1920import io .sloeber .providers .MCUBoard ;
2223@ RunWith (Parameterized .class )
2324public class CreateAndCompileArduinoIDEExamplesOnAVRHardwareTest {
2425 private CodeDescriptor myCodeDescriptor ;
25- private Examples myExample ;
26+ private MCUBoard myBoard ;
27+ private String myProjectName ;
2628 private static int myBuildCounter = 0 ;
2729 private static int myTotalFails = 0 ;
2830 private static int maxFails = 50 ;
2931 private static int mySkipAtStart = 0 ;
3032
31- public CreateAndCompileArduinoIDEExamplesOnAVRHardwareTest ( CodeDescriptor codeDescriptor ,
32- Examples example ) {
33+ public CreateAndCompileArduinoIDEExamplesOnAVRHardwareTest ( String projectName , CodeDescriptor codeDescriptor ,
34+ MCUBoard board ) {
3335
3436 myCodeDescriptor = codeDescriptor ;
35- myExample = example ;
37+ myBoard = board ;
38+ myProjectName =projectName ;
3639 }
3740
3841 @ SuppressWarnings ("rawtypes" )
39- @ Parameters (name = "{index}: {0}" )
42+ @ Parameters (name = " {0}" )
4043 public static Collection examples () {
4144 Shared .waitForAllJobsToFinish ();
4245 LinkedList <Object []> examples = new LinkedList <>();
46+ MCUBoard [] allBoards =Arduino .getAllBoards ();
4347
4448 TreeMap <String , IPath > exampleFolders = LibraryManager .getAllArduinoIDEExamples ();
4549 for (Map .Entry <String , IPath > curexample : exampleFolders .entrySet ()) {
@@ -51,9 +55,13 @@ public static Collection examples() {
5155
5256 paths .add (examplePath );
5357 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 };
5662 examples .add (theData );
63+ }
64+ }
5765 }
5866 }
5967
@@ -69,7 +77,8 @@ private static boolean skipExample(Examples example) {
6977 return example .getPath ().toString ().contains ("Teensy" );
7078 }
7179
72- public void testExample (MCUBoard board ) {
80+ @ Test
81+ public void testExample () {
7382 // Stop after X fails because
7483 // the fails stays open in eclipse and it becomes really slow
7584 // There are only a number of issues you can handle
@@ -79,144 +88,11 @@ public void testExample(MCUBoard board) {
7988 Assume .assumeTrue ("To many fails. Stopping test" , myTotalFails < maxFails );
8089 //because we run all examples on all boards we need to filter incompatible combinations
8190 //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 ))) {
8693 myTotalFails ++;
8794 }
8895 }
8996
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- }
22197
22298}
0 commit comments