15
15
16
16
import io .sloeber .core .api .BoardDescriptor ;
17
17
import io .sloeber .core .api .CodeDescriptor ;
18
+ import io .sloeber .core .api .CompileOptions ;
18
19
import io .sloeber .core .api .LibraryManager ;
19
20
import io .sloeber .core .api .PackageManager ;
20
21
import io .sloeber .providers .MCUBoard ;
24
25
@ RunWith (Parameterized .class )
25
26
public class CreateAndCompileArduinoIDEExamplesOnTeensyTest {
26
27
private CodeDescriptor myCodeDescriptor ;
27
- private Examples myExample ;
28
+
29
+ private String myTestName ;
30
+ private BoardDescriptor myBoardDescriptor ;
28
31
private static int myBuildCounter = 0 ;
29
32
private static int myTotalFails = 0 ;
30
33
private static int maxFails = 50 ;
31
34
private static int mySkipAtStart = 0 ;
32
35
33
- public CreateAndCompileArduinoIDEExamplesOnTeensyTest (CodeDescriptor codeDescriptor , Examples example ) {
36
+ public CreateAndCompileArduinoIDEExamplesOnTeensyTest (String testName , CodeDescriptor codeDescriptor ,BoardDescriptor board ) {
34
37
35
38
myCodeDescriptor = codeDescriptor ;
36
- myExample = example ;
39
+ myTestName =testName ;
40
+ myBoardDescriptor =board ;
37
41
}
38
42
39
43
@ SuppressWarnings ("rawtypes" )
40
- @ Parameters (name = "{index}: { 0}" )
44
+ @ Parameters (name = "{0}" )
41
45
public static Collection examples () {
42
46
installAdditionalBoards ();
43
47
44
48
Shared .waitForAllJobsToFinish ();
45
49
LinkedList <Object []> examples = new LinkedList <>();
46
-
50
+ MCUBoard [] allBoards =Teensy .getAllBoards ();
51
+
47
52
TreeMap <String , IPath > exampleFolders = LibraryManager .getAllArduinoIDEExamples ();
48
53
for (Map .Entry <String , IPath > curexample : exampleFolders .entrySet ()) {
49
54
String fqn = curexample .getKey ().trim ();
@@ -54,8 +59,16 @@ public static Collection examples() {
54
59
paths .add (examplePath );
55
60
CodeDescriptor codeDescriptor = CodeDescriptor .createExample (false , paths );
56
61
57
- Object [] theData = new Object [] { codeDescriptor , example };
58
- examples .add (theData );
62
+ for (MCUBoard curBoard : allBoards ) {
63
+ if (curBoard .isExampleSupported (example )) {
64
+ String projectName = Shared .getProjectName (codeDescriptor , example , curBoard );
65
+ Map <String , String > boardOptions = curBoard .getBoardOptions (example );
66
+ BoardDescriptor boardDescriptor = curBoard .getBoardDescriptor ();
67
+ boardDescriptor .setOptions (boardOptions );
68
+ Object [] theData = new Object [] { projectName , codeDescriptor , boardDescriptor };
69
+ examples .add (theData );
70
+ }
71
+ }
59
72
}
60
73
}
61
74
@@ -77,63 +90,24 @@ public static void installAdditionalBoards() {
77
90
78
91
}
79
92
80
- public void testExample (MCUBoard board ) {
93
+ public void testExample () {
81
94
// Stop after X fails because
82
95
// the fails stays open in eclipse and it becomes really slow
83
96
// There are only a number of issues you can handle
84
97
// best is to focus on the first ones and then rerun starting with the
85
98
// failures
86
99
Assume .assumeTrue ("Skipping first " + mySkipAtStart + " tests" , myBuildCounter ++ >= mySkipAtStart );
87
100
Assume .assumeTrue ("To many fails. Stopping test" , myTotalFails < maxFails );
88
- Map <String ,String > boardOptions =board .getBoardOptions (myExample );
89
- BoardDescriptor boardDescriptor =board .getBoardDescriptor ();
90
- boardDescriptor .setOptions (boardOptions );
91
- if (!Shared .BuildAndVerify ( boardDescriptor , myCodeDescriptor , null )) {
101
+ if (!Shared .BuildAndVerify (myTestName , myBoardDescriptor , myCodeDescriptor , new CompileOptions (null ))) {
92
102
myTotalFails ++;
93
103
}
94
104
}
95
105
96
106
@ Test
97
- public void testArduinoIDEExamplesOnTeensy3_6 () {
98
- if (!MySystem .getTeensyPlatform ().isEmpty ())
99
- testExample (Teensy .Teensy3_6 ());
100
- }
101
-
102
- @ Test
103
- public void testArduinoIDEExamplesOnTeensy3_5 () {
104
- if (!MySystem .getTeensyPlatform ().isEmpty ())
105
- testExample (Teensy .Teensy3_5 ());
106
- }
107
-
108
- @ Test
109
- public void testArduinoIDEExamplesOnTeensy3_1 () {
110
- if (!MySystem .getTeensyPlatform ().isEmpty ())
111
- testExample (Teensy .Teensy3_1 ());
112
- }
113
-
114
- @ Test
115
- public void testArduinoIDEExamplesOnTeensy3_0 () {
107
+ public void testArduinoIDEExamplesOnTeensy () {
116
108
if (!MySystem .getTeensyPlatform ().isEmpty ())
117
- testExample (Teensy . Teensy3_0 () );
109
+ testExample ();
118
110
}
119
111
120
- @ Test
121
- public void testArduinoIDEExamplesOnTeensyLC () {
122
- if (!MySystem .getTeensyPlatform ().isEmpty ())
123
- testExample (Teensy .Teensy_LC ());
124
- }
125
-
126
- @ Test
127
- public void testArduinoIDEExamplesOnTeensyPP2 () {
128
- if (!MySystem .getTeensyPlatform ().isEmpty ())
129
- testExample (Teensy .teensypp2 ());
130
- }
131
-
132
- @ Test
133
- public void testArduinoIDEExamplesOnTeensy2 () {
134
- if (!MySystem .getTeensyPlatform ().isEmpty ())
135
- testExample (Teensy .teensy2 ());
136
-
137
- }
138
112
139
113
}
0 commit comments