@@ -62,6 +62,12 @@ func TestBuilderEmptySketch(t *testing.T) {
62
62
63
63
ctx .DebugLevel = 10
64
64
65
+ // Cleanup cached core
66
+ coreFolder := filepath .Join ("downloaded_hardware" , "arduino" , "avr" )
67
+ coreFile := builder_utils .GetCachedCoreArchiveFileName (ctx .FQBN , coreFolder )
68
+ os .Remove (coreFile )
69
+
70
+ // Run builder
65
71
command := builder.Builder {}
66
72
err := command .Run (ctx )
67
73
NoError (t , err )
@@ -95,6 +101,12 @@ func TestBuilderBridge(t *testing.T) {
95
101
buildPath := SetupBuildPath (t , ctx )
96
102
defer os .RemoveAll (buildPath )
97
103
104
+ // Cleanup cached core
105
+ coreFolder := filepath .Join ("downloaded_hardware" , "arduino" , "avr" )
106
+ coreFile := builder_utils .GetCachedCoreArchiveFileName (ctx .FQBN , coreFolder )
107
+ os .Remove (coreFile )
108
+
109
+ // Run builder
98
110
command := builder.Builder {}
99
111
err := command .Run (ctx )
100
112
NoError (t , err )
@@ -129,14 +141,16 @@ func TestBuilderSketchWithConfig(t *testing.T) {
129
141
buildPath := SetupBuildPath (t , ctx )
130
142
defer os .RemoveAll (buildPath )
131
143
144
+ // Cleanup cached core
145
+ coreFolder := filepath .Join ("downloaded_hardware" , "arduino" , "avr" )
146
+ coreFile := builder_utils .GetCachedCoreArchiveFileName (ctx .FQBN , coreFolder )
147
+ os .Remove (coreFile )
148
+
149
+ // Run builder
132
150
command := builder.Builder {}
133
151
err := command .Run (ctx )
134
152
NoError (t , err )
135
153
136
- // Cleanup cached core
137
- coreFile := builder_utils .GetCoreArchivePath (ctx .FQBN )
138
- os .Remove (coreFile )
139
-
140
154
_ , err = os .Stat (filepath .Join (buildPath , constants .FOLDER_CORE , "HardwareSerial.cpp.o" ))
141
155
NoError (t , err )
142
156
_ , err = os .Stat (filepath .Join (buildPath , constants .FOLDER_PREPROC , constants .FILE_CTAGS_TARGET_FOR_GCC_MINUS_E ))
@@ -167,18 +181,21 @@ func TestBuilderBridgeTwice(t *testing.T) {
167
181
buildPath := SetupBuildPath (t , ctx )
168
182
defer os .RemoveAll (buildPath )
169
183
184
+ // Cleanup cached core
185
+ coreFolder := filepath .Join ("downloaded_hardware" , "arduino" , "avr" )
186
+ coreFile := builder_utils .GetCachedCoreArchiveFileName (ctx .FQBN , coreFolder )
187
+ os .Remove (coreFile )
188
+
189
+ // Run builder
170
190
command := builder.Builder {}
171
191
err := command .Run (ctx )
172
192
NoError (t , err )
173
193
194
+ // Run builder again
174
195
command = builder.Builder {}
175
196
err = command .Run (ctx )
176
197
NoError (t , err )
177
198
178
- // Cleanup cached core
179
- coreFile := builder_utils .GetCoreArchivePath (ctx .FQBN )
180
- os .Remove (coreFile )
181
-
182
199
_ , err = os .Stat (filepath .Join (buildPath , constants .FOLDER_CORE , "HardwareSerial.cpp.o" ))
183
200
NoError (t , err )
184
201
_ , err = os .Stat (filepath .Join (buildPath , constants .FOLDER_PREPROC , constants .FILE_CTAGS_TARGET_FOR_GCC_MINUS_E ))
@@ -211,6 +228,12 @@ func TestBuilderBridgeSAM(t *testing.T) {
211
228
212
229
ctx .WarningsLevel = "all"
213
230
231
+ // Cleanup cached core
232
+ coreFolder := filepath .Join ("downloaded_hardware" , "arduino" , "sam" )
233
+ coreFile := builder_utils .GetCachedCoreArchiveFileName (ctx .FQBN , coreFolder )
234
+ os .Remove (coreFile )
235
+
236
+ // Run builder
214
237
command := builder.Builder {}
215
238
err := command .Run (ctx )
216
239
NoError (t , err )
@@ -254,6 +277,12 @@ func TestBuilderBridgeRedBearLab(t *testing.T) {
254
277
buildPath := SetupBuildPath (t , ctx )
255
278
defer os .RemoveAll (buildPath )
256
279
280
+ // Cleanup cached core
281
+ coreFolder := filepath .Join ("downloaded_hardware" , "arduino" , "avr" )
282
+ coreFile := builder_utils .GetCachedCoreArchiveFileName (ctx .FQBN , coreFolder )
283
+ os .Remove (coreFile )
284
+
285
+ // Run builder
257
286
command := builder.Builder {}
258
287
err := command .Run (ctx )
259
288
NoError (t , err )
@@ -404,10 +433,19 @@ func TestBuilderWithBuildPathInSketchDir(t *testing.T) {
404
433
NoError (t , err )
405
434
defer os .RemoveAll (ctx .BuildPath )
406
435
436
+ // Cleanup cached core
437
+ coreFolder := filepath .Join ("downloaded_hardware" , "arduino" , "avr" )
438
+ coreFile := builder_utils .GetCachedCoreArchiveFileName (ctx .FQBN , coreFolder )
439
+ os .Remove (coreFile )
440
+
441
+ // Run build
407
442
command := builder.Builder {}
408
443
err = command .Run (ctx )
409
444
NoError (t , err )
410
445
446
+ // Cleanup cached core
447
+ os .Remove (coreFile )
448
+
411
449
// Run build twice, to verify the build still works when the
412
450
// build directory is present at the start
413
451
err = command .Run (ctx )
@@ -430,7 +468,8 @@ func TestBuilderCacheCoreAFile(t *testing.T) {
430
468
defer os .RemoveAll (ctx .BuildPath )
431
469
432
470
// Cleanup cached core
433
- coreFile := builder_utils .GetCoreArchivePath (ctx .FQBN )
471
+ coreFolder := filepath .Join ("downloaded_hardware" , "arduino" , "avr" )
472
+ coreFile := builder_utils .GetCachedCoreArchiveFileName (ctx .FQBN , coreFolder )
434
473
os .Remove (coreFile )
435
474
436
475
// Run build
@@ -451,7 +490,7 @@ func TestBuilderCacheCoreAFile(t *testing.T) {
451
490
// Touch a file of the core and check if the builder invalidate the cache
452
491
time .Sleep (time .Second )
453
492
now := time .Now ().Local ()
454
- err = os .Chtimes (filepath .Join ("downloaded_hardware" , "arduino" , "avr" , "cores" , "arduino" , "Arduino.h" ), now , now )
493
+ err = os .Chtimes (filepath .Join (coreFolder , "cores" , "arduino" , "Arduino.h" ), now , now )
455
494
require .NoError (t , err )
456
495
457
496
// Run build again, to verify that the builder rebuilds core.a
0 commit comments