@@ -22,6 +22,8 @@ import (
2222 "github.com/arduino/arduino-cli/internal/integrationtest"
2323 "github.com/arduino/go-paths-helper"
2424 "github.com/stretchr/testify/require"
25+ "gopkg.in/src-d/go-git.v4"
26+ "gopkg.in/src-d/go-git.v4/plumbing"
2527)
2628
2729func TestCompileSketchWithPdeExtension (t * testing.T ) {
@@ -250,3 +252,34 @@ func TestCompileUsingBoardsLocalTxt(t *testing.T) {
250252 _ , _ , err = cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
251253 require .NoError (t , err )
252254}
255+
256+ func TestCompileManuallyInstalledPlatform (t * testing.T ) {
257+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
258+ defer env .CleanUp ()
259+
260+ _ , _ , err := cli .Run ("update" )
261+ require .NoError (t , err )
262+
263+ sketchName := "CompileSketchManuallyInstalledPlatformUsingPlatformLocalTxt"
264+ sketchPath := cli .SketchbookDir ().Join (sketchName )
265+ fqbn := "arduino-beta-development:avr:uno"
266+ _ , _ , err = cli .Run ("sketch" , "new" , sketchPath .String ())
267+ require .NoError (t , err )
268+
269+ // Manually installs a core in sketchbooks hardware folder
270+ gitUrl := "https://github.com/arduino/ArduinoCore-avr.git"
271+ repoDir := cli .SketchbookDir ().Join ("hardware" , "arduino-beta-development" , "avr" )
272+ _ , err = git .PlainClone (repoDir .String (), false , & git.CloneOptions {
273+ URL : gitUrl ,
274+ ReferenceName : plumbing .NewTagReferenceName ("1.8.3" ),
275+ })
276+ require .NoError (t , err )
277+
278+ // Installs also the same core via CLI so all the necessary tools are installed
279+ _ , _ , err = cli .Run ("core" , "install" , "arduino:avr@1.8.3" )
280+ require .NoError (t , err )
281+
282+ // Verifies compilation works without issues
283+ _ , _ , err = cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
284+ require .NoError (t , err )
285+ }
0 commit comments