@@ -257,6 +257,7 @@ func TestUploadCommands(t *testing.T) {
257257func TestLibSearch (t * testing.T ) {
258258 defer makeTempDataDir (t )()
259259 defer makeTempSketchbookDir (t )()
260+ defer useSharedDownloadDir (t )()
260261
261262 exitCode , output := executeWithArgs (t , "lib" , "search" , "audiozer" , "--format" , "json" )
262263 require .Zero (t , exitCode , "process exit code" )
@@ -287,6 +288,7 @@ func TestLibSearch(t *testing.T) {
287288func TestUserLibs (t * testing.T ) {
288289 defer makeTempDataDir (t )()
289290 defer makeTempSketchbookDir (t )()
291+ defer useSharedDownloadDir (t )()
290292 libDir := currSketchbookDir .Join ("libraries" )
291293 err := libDir .MkdirAll ()
292294 require .NoError (t , err , "creating 'sketchbook/libraries' dir" )
@@ -323,6 +325,7 @@ func TestSketchCommands(t *testing.T) {
323325 defer makeTempSketchbookDir (t )()
324326 //var d []byte
325327 var exitCode int
328+ defer useSharedDownloadDir (t )()
326329
327330 exitCode , _ = executeWithArgs (t , "sketch" , "new" , "Test" )
328331 require .Zero (t , exitCode , "exit code" )
@@ -333,6 +336,7 @@ func TestLibDownloadAndInstall(t *testing.T) {
333336 defer makeTempSketchbookDir (t )()
334337 var d []byte
335338 var exitCode int
339+ defer useSharedDownloadDir (t )()
336340
337341 exitCode , _ = executeWithArgs (t , "core" , "update-index" )
338342 require .Zero (t , exitCode , "exit code" )
@@ -475,6 +479,7 @@ func detectLatestAVRCore(t *testing.T) string {
475479func TestCompileCommands (t * testing.T ) {
476480 defer makeTempDataDir (t )()
477481 defer makeTempSketchbookDir (t )()
482+ defer useSharedDownloadDir (t )()
478483
479484 // Set staging dir to a temporary dir
480485 tmp , err := ioutil .TempDir (os .TempDir (), "test" )
@@ -532,6 +537,7 @@ func TestCompileCommands(t *testing.T) {
532537func TestInvalidCoreURL (t * testing.T ) {
533538 defer makeTempDataDir (t )()
534539 defer makeTempSketchbookDir (t )()
540+ defer useSharedDownloadDir (t )()
535541
536542 tmp , err := paths .MkTempDir ("" , "" )
537543 require .NoError (t , err , "making temporary dir" )
@@ -568,6 +574,7 @@ board_manager:
568574func TestCoreCommands (t * testing.T ) {
569575 defer makeTempDataDir (t )()
570576 defer makeTempSketchbookDir (t )()
577+ defer useSharedDownloadDir (t )()
571578
572579 // Set staging dir to a temporary dir
573580 tmp , err := ioutil .TempDir (os .TempDir (), "test" )
@@ -580,15 +587,15 @@ func TestCoreCommands(t *testing.T) {
580587 // Download a specific core version
581588 exitCode , d := executeWithArgs (t , "core" , "download" , "arduino:avr@1.6.16" )
582589 require .Zero (t , exitCode , "exit code" )
583- require .Contains (t , string ( d ), "arduino:avr-gcc@4.9.2-atmel3.5.3-arduino2 downloaded" )
584- require .Contains (t , string ( d ), "arduino:avrdude@6.3.0-arduino8 downloaded" )
585- require .Contains (t , string ( d ), "arduino:arduinoOTA@1.0.0 downloaded" )
586- require .Contains (t , string ( d ), "arduino:avr@1.6.16 downloaded" )
590+ require .Regexp (t , "arduino:avr-gcc@4.9.2-atmel3.5.3-arduino2 (already )? downloaded" , string ( d ) )
591+ require .Regexp (t , "arduino:avrdude@6.3.0-arduino8 (already )? downloaded" , string ( d ) )
592+ require .Regexp (t , "arduino:arduinoOTA@1.0.0 (already )? downloaded" , string ( d ) )
593+ require .Regexp (t , "arduino:avr@1.6.16 (already )? downloaded" , string ( d ) )
587594
588595 // Download latest
589596 exitCode , d = executeWithArgs (t , "core" , "download" , "arduino:avr" )
590597 require .Zero (t , exitCode , "exit code" )
591- require .Contains (t , string ( d ), AVR + " downloaded" )
598+ require .Regexp (t , AVR + " (already )? downloaded" , string ( d ) )
592599
593600 // Wrong downloads
594601 exitCode , d = executeWithArgs (t , "core" , "download" , "arduino:samd@1.2.3-notexisting" )
0 commit comments