@@ -28,6 +28,48 @@ import (
28
28
"gopkg.in/src-d/go-git.v4/plumbing"
29
29
)
30
30
31
+ func TestCompileManuallyInstalledPlatformUsingBoardsLocalTxt (t * testing.T ) {
32
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
33
+ defer env .CleanUp ()
34
+
35
+ _ , _ , err := cli .Run ("update" )
36
+ require .NoError (t , err )
37
+
38
+ sketchName := "CompileSketchManuallyInstalledPlatformUsingBoardsLocalTxt"
39
+ sketchPath := cli .SketchbookDir ().Join (sketchName )
40
+ fqbn := "arduino-beta-development:avr:nessuno"
41
+ _ , _ , err = cli .Run ("sketch" , "new" , sketchPath .String ())
42
+ require .NoError (t , err )
43
+
44
+ // Manually installs a core in sketchbooks hardware folder
45
+ gitUrl := "https://github.com/arduino/ArduinoCore-avr.git"
46
+ repoDir := cli .SketchbookDir ().Join ("hardware" , "arduino-beta-development" , "avr" )
47
+ _ , err = git .PlainClone (repoDir .String (), false , & git.CloneOptions {
48
+ URL : gitUrl ,
49
+ ReferenceName : plumbing .NewTagReferenceName ("1.8.3" ),
50
+ })
51
+ require .NoError (t , err )
52
+
53
+ // Installs also the same core via CLI so all the necessary tools are installed
54
+ _ , _ , err = cli .Run ("core" , "install" , "arduino:avr@1.8.3" )
55
+ require .NoError (t , err )
56
+
57
+ // Verifies compilation fails because board doesn't exist
58
+ _ , stderr , err := cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
59
+ require .Error (t , err )
60
+ require .Contains (t , string (stderr ), "Error during build: Error resolving FQBN: board arduino-beta-development:avr:nessuno not found" )
61
+
62
+ // Use custom boards.local.txt with made arduino:avr:nessuno board
63
+ boardsLocalTxt := repoDir .Join ("boards.local.txt" )
64
+ wd , err := paths .Getwd ()
65
+ require .NoError (t , err )
66
+ err = wd .Parent ().Join ("testdata" , "boards.local.txt" ).CopyTo (boardsLocalTxt )
67
+ require .NoError (t , err )
68
+
69
+ _ , _ , err = cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
70
+ require .NoError (t , err )
71
+ }
72
+
31
73
func TestCompileWithLibrary (t * testing.T ) {
32
74
env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
33
75
defer env .CleanUp ()
0 commit comments