Skip to content

Commit f64c68b

Browse files
committed
The board loader now detects default arguments in FQBN "config"
This commit fixes the tests
1 parent ddca16b commit f64c68b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

test/add_build_board_property_if_missing_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
"testing"
3535

3636
"github.com/arduino/arduino-builder"
37-
"github.com/arduino/arduino-builder/constants"
3837
"github.com/arduino/arduino-builder/types"
3938
"github.com/arduino/arduino-cli/arduino/cores"
4039
"github.com/arduino/go-paths-helper"
@@ -53,6 +52,7 @@ func TestAddBuildBoardPropertyIfMissing(t *testing.T) {
5352
ctx := &types.Context{
5453
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware", "user_hardware"),
5554
FQBN: parseFQBN(t, "my_avr_platform:avr:mymega"),
55+
Verbose: true,
5656
}
5757

5858
commands := []types.Command{
@@ -74,16 +74,17 @@ func TestAddBuildBoardPropertyIfMissing(t *testing.T) {
7474
require.Equal(t, "avr", targetPlatform.Platform.Architecture)
7575
targetBoard := ctx.TargetBoard
7676
require.Equal(t, "mymega", targetBoard.BoardID)
77-
require.Equal(t, "", targetBoard.Properties.Get(constants.BUILD_PROPERTIES_BUILD_MCU))
78-
require.Equal(t, "AVR_MYMEGA", targetBoard.Properties.Get(constants.BUILD_PROPERTIES_BUILD_BOARD))
77+
require.Equal(t, "atmega2560", targetBoard.Properties.Get("build.mcu"))
78+
require.Equal(t, "AVR_MYMEGA2560", targetBoard.Properties.Get("build.board"))
7979
}
8080

8181
func TestAddBuildBoardPropertyIfMissingNotMissing(t *testing.T) {
8282
DownloadCoresAndToolsAndLibraries(t)
8383

8484
ctx := &types.Context{
8585
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware", "user_hardware"),
86-
FQBN: parseFQBN(t, "my_avr_platform:avr:mymega:cpu=atmega2560"),
86+
FQBN: parseFQBN(t, "my_avr_platform:avr:mymega:cpu=atmega1280"),
87+
Verbose: true,
8788
}
8889

8990
commands := []types.Command{
@@ -103,6 +104,6 @@ func TestAddBuildBoardPropertyIfMissingNotMissing(t *testing.T) {
103104
require.Equal(t, "avr", targetPlatform.Platform.Architecture)
104105
targetBoard := ctx.TargetBoard
105106
require.Equal(t, "mymega", targetBoard.BoardID)
106-
require.Equal(t, "atmega2560", targetBoard.Properties.Get(constants.BUILD_PROPERTIES_BUILD_MCU))
107-
require.Equal(t, "AVR_MEGA2560", targetBoard.Properties.Get(constants.BUILD_PROPERTIES_BUILD_BOARD))
107+
require.Equal(t, "atmega1280", targetBoard.Properties.Get("build.mcu"))
108+
require.Equal(t, "AVR_MYMEGA", targetBoard.Properties.Get("build.board"))
108109
}

test/user_hardware/my_avr_platform/avr/boards.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ mymega.menu.cpu.atmega2560.bootloader.extended_fuses=0xFD
6868
mymega.menu.cpu.atmega2560.bootloader.file={bootloader._folder}/stk500boot_v2_mega2560.hex
6969

7070
mymega.menu.cpu.atmega2560.build.mcu=atmega2560
71-
mymega.menu.cpu.atmega2560.build.board=AVR_MEGA2560
71+
mymega.menu.cpu.atmega2560.build.board=AVR_MYMEGA2560
7272

7373
mymega.menu.cpu.atmega1280=ATmega1280
7474

@@ -82,4 +82,4 @@ mymega.menu.cpu.atmega1280.bootloader.extended_fuses=0xF5
8282
mymega.menu.cpu.atmega1280.bootloader.file={bootloader._folder}/ATmegaBOOT_168_atmega1280.hex
8383

8484
mymega.menu.cpu.atmega1280.build.mcu=atmega1280
85-
mymega.menu.cpu.atmega1280.build.board=AVR_MEGA
85+
mymega.menu.cpu.atmega1280.build.board=AVR_MYMEGA

0 commit comments

Comments
 (0)