@@ -183,3 +183,35 @@ func TestCompileWithOnlyCompilationDatabaseFlag(t *testing.T) {
183
183
// Verifies no binaries are exported
184
184
require .NoDirExists (t , buildPath .String ())
185
185
}
186
+
187
+ func TestCompileUsingPlatformLocalTxt (t * testing.T ) {
188
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
189
+ defer env .CleanUp ()
190
+
191
+ _ , _ , err := cli .Run ("update" )
192
+ require .NoError (t , err )
193
+
194
+ _ ,
_ ,
err = cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
195
+ require .NoError (t , err )
196
+
197
+ sketchName := "CompileSketchUsingPlatformLocalTxt"
198
+ sketchPath := cli .SketchbookDir ().Join (sketchName )
199
+ fqbn := "arduino:avr:uno"
200
+
201
+ _ , _ , err = cli .Run ("sketch" , "new" , sketchPath .String ())
202
+ require .NoError (t , err )
203
+
204
+ // Verifies compilation works without issues
205
+ _ , _ , err = cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
206
+ require .NoError (t , err )
207
+
208
+ // Overrides default platform compiler with an unexisting one
209
+ platformLocalTxt := cli .DataDir ().Join ("packages" , "arduino" , "hardware" , "avr" , "1.8.3" , "platform.local.txt" )
210
+ err = platformLocalTxt .WriteFile ([]byte ("compiler.c.cmd=my-compiler-that-does-not-exist" ))
211
+ require .NoError (t , err )
212
+
213
+ // Verifies compilation now fails because compiler is not found
214
+ _ , stderr , err := cli .Run ("compile" , "--clean" , "-b" , fqbn , sketchPath .String ())
215
+ require .Error (t , err )
216
+ require .Contains (t , string (stderr ), "my-compiler-that-does-not-exist" )
217
+ }
0 commit comments