Skip to content

Commit 4683706

Browse files
author
rsora
committed
Align failing lecacy tests with new hashing behaviour
1 parent deee049 commit 4683706

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

Diff for: legacy/builder/phases/core_builder.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func compileCore(ctx *types.Context, buildPath *paths.Path, buildCachePath *path
9191

9292
var targetArchivedCore *paths.Path
9393
if buildCachePath != nil {
94-
archivedCoreName := getCachedCoreArchiveFileName(buildProperties.Get(constants.BUILD_PROPERTIES_FQBN),
94+
archivedCoreName := GetCachedCoreArchiveFileName(buildProperties.Get(constants.BUILD_PROPERTIES_FQBN),
9595
buildProperties.Get("compiler.optimization_flags"), realCoreFolder)
9696
targetArchivedCore = buildCachePath.Join(archivedCoreName)
9797
canUseArchivedCore := !builder_utils.CoreOrReferencedCoreHasChanged(realCoreFolder, targetCoreFolder, targetArchivedCore)
@@ -134,7 +134,7 @@ func compileCore(ctx *types.Context, buildPath *paths.Path, buildCachePath *path
134134

135135
// GetCachedCoreArchiveFileName returns the filename to be used to store
136136
// the global cached core.a.
137-
func getCachedCoreArchiveFileName(fqbn string, optimizationFlags string, coreFolder *paths.Path) string {
137+
func GetCachedCoreArchiveFileName(fqbn string, optimizationFlags string, coreFolder *paths.Path) string {
138138
fqbnToUnderscore := strings.Replace(fqbn, ":", "_", -1)
139139
fqbnToUnderscore = strings.Replace(fqbnToUnderscore, "=", "_", -1)
140140
if absCoreFolder, err := coreFolder.Abs(); err == nil {

Diff for: legacy/builder/test/builder_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import (
2424
"github.com/arduino/go-paths-helper"
2525

2626
"github.com/arduino/arduino-cli/legacy/builder"
27-
"github.com/arduino/arduino-cli/legacy/builder/builder_utils"
2827
"github.com/arduino/arduino-cli/legacy/builder/constants"
28+
"github.com/arduino/arduino-cli/legacy/builder/phases"
2929
"github.com/arduino/arduino-cli/legacy/builder/types"
3030
"github.com/stretchr/testify/require"
3131
)
@@ -379,7 +379,7 @@ func TestBuilderCacheCoreAFile(t *testing.T) {
379379

380380
// Pick timestamp of cached core
381381
coreFolder := paths.New("downloaded_hardware", "arduino", "avr")
382-
coreFileName := builder_utils.GetCachedCoreArchiveFileName(ctx.FQBN.String(), coreFolder)
382+
coreFileName := phases.GetCachedCoreArchiveFileName(ctx.FQBN.String(), ctx.OptimizationFlags, coreFolder)
383383
cachedCoreFile := ctx.CoreBuildCachePath.Join(coreFileName)
384384
coreStatBefore, err := cachedCoreFile.Stat()
385385
require.NoError(t, err)

Diff for: legacy/builder/test/create_build_options_map_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func TestCreateBuildOptionsMap(t *testing.T) {
3535
Verbose: true,
3636
BuildPath: paths.New("buildPath"),
3737
DebugLevel: 5,
38+
OptimizationFlags: "-Os",
3839
}
3940

4041
create := builder.CreateBuildOptionsMap{}
@@ -45,6 +46,7 @@ func TestCreateBuildOptionsMap(t *testing.T) {
4546
"additionalFiles": "",
4647
"builtInLibrariesFolders": "",
4748
"builtInToolsFolders": "tools",
49+
"compiler.optimization_flags": "-Os",
4850
"customBuildProperties": "",
4951
"fqbn": "my:nice:fqbn",
5052
"hardwareFolders": "hardware,hardware2",

Diff for: legacy/builder/test/store_build_options_map_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func TestStoreBuildOptionsMap(t *testing.T) {
3737
CustomBuildProperties: []string{"custom=prop"},
3838
Verbose: true,
3939
DebugLevel: 5,
40+
OptimizationFlags: "-Os",
4041
}
4142

4243
buildPath := SetupBuildPath(t, ctx)
@@ -63,6 +64,7 @@ func TestStoreBuildOptionsMap(t *testing.T) {
6364
"additionalFiles": "",
6465
"builtInLibrariesFolders": "built-in libraries",
6566
"builtInToolsFolders": "tools",
67+
"compiler.optimization_flags": "-Os",
6668
"customBuildProperties": "custom=prop",
6769
"fqbn": "my:nice:fqbn",
6870
"hardwareFolders": "hardware",

0 commit comments

Comments
 (0)