@@ -655,7 +655,17 @@ func TestUploadSketch(t *testing.T) {
655
655
sketchPath := cli .SketchbookDir ().Join (sketchName )
656
656
_ , _ , err := cli .Run ("sketch" , "new" , sketchPath .String ())
657
657
require .NoError (t , err )
658
- buildDir := generateBuildDir (sketchPath , t )
658
+
659
+ out , _ , err := cli .Run ("config" , "get" , "build_cache.path" )
660
+ require .NoError (t , err )
661
+ cacheDir := paths .New (strings .TrimSpace (string (out )))
662
+
663
+ md5 := md5 .Sum (([]byte (sketchPath .String ())))
664
+ sketchPathMd5 := strings .ToUpper (hex .EncodeToString (md5 [:]))
665
+ buildDir := cacheDir .Join ("sketches" , sketchPathMd5 )
666
+ require .NoError (t , buildDir .MkdirAll ())
667
+ require .NoError (t , buildDir .ToAbs ())
668
+
659
669
t .Cleanup (func () { buildDir .RemoveAll () })
660
670
661
671
for i , _test := range testParameters {
@@ -718,15 +728,6 @@ func TestUploadSketch(t *testing.T) {
718
728
}
719
729
}
720
730
721
- func generateBuildDir (sketchPath * paths.Path , t * testing.T ) * paths.Path {
722
- md5 := md5 .Sum (([]byte (sketchPath .String ())))
723
- sketchPathMd5 := strings .ToUpper (hex .EncodeToString (md5 [:]))
724
- buildDir := paths .TempDir ().Join ("arduino" , "sketches" , sketchPathMd5 )
725
- require .NoError (t , buildDir .MkdirAll ())
726
- require .NoError (t , buildDir .ToAbs ())
727
- return buildDir
728
- }
729
-
730
731
func TestUploadWithInputDirFlag (t * testing.T ) {
731
732
env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
732
733
defer env .CleanUp ()
0 commit comments