@@ -44,10 +44,10 @@ import (
44
44
"github.com/stretchr/testify/require"
45
45
)
46
46
47
- func prepareBuilderTestContext (sketchPath * paths.Path , fqbn string ) * types.Context {
47
+ func prepareBuilderTestContext (t * testing. T , sketchPath * paths.Path , fqbn string ) * types.Context {
48
48
return & types.Context {
49
49
SketchLocation : sketchPath ,
50
- FQBN : fqbn ,
50
+ FQBN : parseFQBN ( t , fqbn ) ,
51
51
HardwareFolders : paths .NewPathList (filepath .Join (".." , "hardware" ), "hardware" , "downloaded_hardware" ),
52
52
BuiltInToolsFolders : paths .NewPathList ("downloaded_tools" ),
53
53
BuiltInLibrariesFolders : paths .NewPathList ("downloaded_libraries" ),
@@ -60,7 +60,7 @@ func prepareBuilderTestContext(sketchPath *paths.Path, fqbn string) *types.Conte
60
60
func TestBuilderEmptySketch (t * testing.T ) {
61
61
DownloadCoresAndToolsAndLibraries (t )
62
62
63
- ctx := prepareBuilderTestContext (paths .New ("sketch1" , "sketch.ino" ), "arduino:avr:uno" )
63
+ ctx := prepareBuilderTestContext (t , paths .New ("sketch1" , "sketch.ino" ), "arduino:avr:uno" )
64
64
ctx .DebugLevel = 10
65
65
66
66
buildPath := SetupBuildPath (t , ctx )
@@ -91,7 +91,7 @@ func TestBuilderEmptySketch(t *testing.T) {
91
91
func TestBuilderBridge (t * testing.T ) {
92
92
DownloadCoresAndToolsAndLibraries (t )
93
93
94
- ctx := prepareBuilderTestContext (paths .New ("downloaded_libraries" , "Bridge" , "examples" , "Bridge" , "Bridge.ino" ), "arduino:avr:leonardo" )
94
+ ctx := prepareBuilderTestContext (t , paths .New ("downloaded_libraries" , "Bridge" , "examples" , "Bridge" , "Bridge.ino" ), "arduino:avr:leonardo" )
95
95
96
96
buildPath := SetupBuildPath (t , ctx )
97
97
defer buildPath .RemoveAll ()
@@ -124,7 +124,7 @@ func TestBuilderBridge(t *testing.T) {
124
124
func TestBuilderSketchWithConfig (t * testing.T ) {
125
125
DownloadCoresAndToolsAndLibraries (t )
126
126
127
- ctx := prepareBuilderTestContext (paths .New ("sketch_with_config" , "sketch_with_config.ino" ), "arduino:avr:leonardo" )
127
+ ctx := prepareBuilderTestContext (t , paths .New ("sketch_with_config" , "sketch_with_config.ino" ), "arduino:avr:leonardo" )
128
128
129
129
buildPath := SetupBuildPath (t , ctx )
130
130
defer buildPath .RemoveAll ()
@@ -157,7 +157,7 @@ func TestBuilderSketchWithConfig(t *testing.T) {
157
157
func TestBuilderBridgeTwice (t * testing.T ) {
158
158
DownloadCoresAndToolsAndLibraries (t )
159
159
160
- ctx := prepareBuilderTestContext (paths .New ("downloaded_libraries" , "Bridge" , "examples" , "Bridge" , "Bridge.ino" ), "arduino:avr:leonardo" )
160
+ ctx := prepareBuilderTestContext (t , paths .New ("downloaded_libraries" , "Bridge" , "examples" , "Bridge" , "Bridge.ino" ), "arduino:avr:leonardo" )
161
161
162
162
buildPath := SetupBuildPath (t , ctx )
163
163
defer buildPath .RemoveAll ()
@@ -195,7 +195,7 @@ func TestBuilderBridgeTwice(t *testing.T) {
195
195
func TestBuilderBridgeSAM (t * testing.T ) {
196
196
DownloadCoresAndToolsAndLibraries (t )
197
197
198
- ctx := prepareBuilderTestContext (paths .New ("downloaded_libraries" , "Bridge" , "examples" , "Bridge" , "Bridge.ino" ), "arduino:sam:arduino_due_x_dbg" )
198
+ ctx := prepareBuilderTestContext (t , paths .New ("downloaded_libraries" , "Bridge" , "examples" , "Bridge" , "Bridge.ino" ), "arduino:sam:arduino_due_x_dbg" )
199
199
ctx .WarningsLevel = "all"
200
200
201
201
buildPath := SetupBuildPath (t , ctx )
@@ -240,7 +240,7 @@ func TestBuilderBridgeSAM(t *testing.T) {
240
240
func TestBuilderBridgeRedBearLab (t * testing.T ) {
241
241
DownloadCoresAndToolsAndLibraries (t )
242
242
243
- ctx := prepareBuilderTestContext (paths .New ("downloaded_libraries" , "Bridge" , "examples" , "Bridge" , "Bridge.ino" ), "RedBearLab:avr:blend" )
243
+ ctx := prepareBuilderTestContext (t , paths .New ("downloaded_libraries" , "Bridge" , "examples" , "Bridge" , "Bridge.ino" ), "RedBearLab:avr:blend" )
244
244
ctx .HardwareFolders = append (ctx .HardwareFolders , paths .New ("downloaded_board_manager_stuff" ))
245
245
ctx .ToolsFolders = append (ctx .ToolsFolders , paths .New ("downloaded_board_manager_stuff" ))
246
246
@@ -275,7 +275,7 @@ func TestBuilderBridgeRedBearLab(t *testing.T) {
275
275
func TestBuilderSketchNoFunctions (t * testing.T ) {
276
276
DownloadCoresAndToolsAndLibraries (t )
277
277
278
- ctx := prepareBuilderTestContext (paths .New ("sketch_no_functions" , "main.ino" ), "RedBearLab:avr:blend" )
278
+ ctx := prepareBuilderTestContext (t , paths .New ("sketch_no_functions" , "main.ino" ), "RedBearLab:avr:blend" )
279
279
ctx .HardwareFolders = append (ctx .HardwareFolders , paths .New ("downloaded_board_manager_stuff" ))
280
280
ctx .ToolsFolders = append (ctx .ToolsFolders , paths .New ("downloaded_board_manager_stuff" ))
281
281
@@ -291,7 +291,7 @@ func TestBuilderSketchNoFunctions(t *testing.T) {
291
291
func TestBuilderSketchWithBackup (t * testing.T ) {
292
292
DownloadCoresAndToolsAndLibraries (t )
293
293
294
- ctx := prepareBuilderTestContext (paths .New ("sketch_with_backup_files" , "sketch.ino" ), "arduino:avr:uno" )
294
+ ctx := prepareBuilderTestContext (t , paths .New ("sketch_with_backup_files" , "sketch.ino" ), "arduino:avr:uno" )
295
295
ctx .HardwareFolders = append (ctx .HardwareFolders , paths .New ("downloaded_board_manager_stuff" ))
296
296
ctx .ToolsFolders = append (ctx .ToolsFolders , paths .New ("downloaded_board_manager_stuff" ))
297
297
@@ -307,7 +307,7 @@ func TestBuilderSketchWithBackup(t *testing.T) {
307
307
func TestBuilderSketchWithOldLib (t * testing.T ) {
308
308
DownloadCoresAndToolsAndLibraries (t )
309
309
310
- ctx := prepareBuilderTestContext (paths .New ("sketch_with_old_lib" , "sketch.ino" ), "arduino:avr:uno" )
310
+ ctx := prepareBuilderTestContext (t , paths .New ("sketch_with_old_lib" , "sketch.ino" ), "arduino:avr:uno" )
311
311
312
312
buildPath := SetupBuildPath (t , ctx )
313
313
defer buildPath .RemoveAll ()
@@ -321,7 +321,7 @@ func TestBuilderSketchWithOldLib(t *testing.T) {
321
321
func TestBuilderSketchWithSubfolders (t * testing.T ) {
322
322
DownloadCoresAndToolsAndLibraries (t )
323
323
324
- ctx := prepareBuilderTestContext (paths .New ("sketch_with_subfolders" , "sketch_with_subfolders.ino" ), "arduino:avr:uno" )
324
+ ctx := prepareBuilderTestContext (t , paths .New ("sketch_with_subfolders" , "sketch_with_subfolders.ino" ), "arduino:avr:uno" )
325
325
326
326
buildPath := SetupBuildPath (t , ctx )
327
327
defer buildPath .RemoveAll ()
@@ -335,7 +335,7 @@ func TestBuilderSketchWithSubfolders(t *testing.T) {
335
335
func TestBuilderSketchBuildPathContainsUnusedPreviouslyCompiledLibrary (t * testing.T ) {
336
336
DownloadCoresAndToolsAndLibraries (t )
337
337
338
- ctx := prepareBuilderTestContext (paths .New ("downloaded_libraries" , "Bridge" , "examples" , "Bridge" , "Bridge.ino" ), "arduino:avr:leonardo" )
338
+ ctx := prepareBuilderTestContext (t , paths .New ("downloaded_libraries" , "Bridge" , "examples" , "Bridge" , "Bridge.ino" ), "arduino:avr:leonardo" )
339
339
340
340
buildPath := SetupBuildPath (t , ctx )
341
341
defer buildPath .RemoveAll ()
@@ -358,7 +358,7 @@ func TestBuilderSketchBuildPathContainsUnusedPreviouslyCompiledLibrary(t *testin
358
358
func TestBuilderWithBuildPathInSketchDir (t * testing.T ) {
359
359
DownloadCoresAndToolsAndLibraries (t )
360
360
361
- ctx := prepareBuilderTestContext (paths .New ("sketch1" , "sketch.ino" ), "arduino:avr:uno" )
361
+ ctx := prepareBuilderTestContext (t , paths .New ("sketch1" , "sketch.ino" ), "arduino:avr:uno" )
362
362
363
363
var err error
364
364
ctx .BuildPath , err = paths .New ("sketch1" , "build" ).Abs ()
@@ -379,7 +379,7 @@ func TestBuilderWithBuildPathInSketchDir(t *testing.T) {
379
379
func TestBuilderCacheCoreAFile (t * testing.T ) {
380
380
DownloadCoresAndToolsAndLibraries (t )
381
381
382
- ctx := prepareBuilderTestContext (paths .New ("sketch1" , "sketch.ino" ), "arduino:avr:uno" )
382
+ ctx := prepareBuilderTestContext (t , paths .New ("sketch1" , "sketch.ino" ), "arduino:avr:uno" )
383
383
384
384
SetupBuildPath (t , ctx )
385
385
defer ctx .BuildPath .RemoveAll ()
@@ -393,7 +393,7 @@ func TestBuilderCacheCoreAFile(t *testing.T) {
393
393
394
394
// Pick timestamp of cached core
395
395
coreFolder := paths .New ("downloaded_hardware" , "arduino" , "avr" )
396
- coreFileName := builder_utils .GetCachedCoreArchiveFileName (ctx .FQBN , coreFolder )
396
+ coreFileName := builder_utils .GetCachedCoreArchiveFileName (ctx .FQBN . String () , coreFolder )
397
397
cachedCoreFile := ctx .CoreBuildCachePath .Join (coreFileName )
398
398
coreStatBefore , err := cachedCoreFile .Stat ()
399
399
require .NoError (t , err )
0 commit comments