Skip to content

[skip changelog] Fix platform loading legacy tests #1180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/platform-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,9 @@ Arduino IDE.

## platform.local.txt

Introduced in Arduino IDE 1.5.7. This file can be used to override properties defined in platform.txt or define new
properties without modifying platform.txt (e.g. when platform.txt is tracked by a version control system). It should be
placed in the same folder as the platform.txt it supplements.
Introduced in Arduino IDE 1.5.7. This file can be used to override properties defined in `platform.txt` or define new
properties without modifying `platform.txt` (e.g. when `platform.txt` is tracked by a version control system). It must
be placed in the same folder as the `platform.txt` it supplements.

## boards.txt

Expand Down Expand Up @@ -978,8 +978,8 @@ actual Arduino CLI code, the "board platform" is called `targetPlatform`, the "c

## boards.local.txt

Introduced in Arduino IDE 1.6.6. This file can be used to override properties defined in boards.txt or define new
properties without modifying boards.txt.
Introduced in Arduino IDE 1.6.6. This file can be used to override properties defined in `boards.txt` or define new
properties without modifying `boards.txt`. It must be placed in the same folder as the `boards.txt` it supplements.

## Platform bundled libraries

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestAddBuildBoardPropertyIfMissing(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware", "user_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "user_hardware"),
FQBN: parseFQBN(t, "my_avr_platform:avr:mymega"),
Verbose: true,
}
Expand Down Expand Up @@ -68,7 +68,7 @@ func TestAddBuildBoardPropertyIfMissingNotMissing(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware", "user_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "user_hardware"),
FQBN: parseFQBN(t, "my_avr_platform:avr:mymega:cpu=atmega1280"),
Verbose: true,
}
Expand Down
2 changes: 1 addition & 1 deletion legacy/builder/test/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func prepareBuilderTestContext(t *testing.T, sketchPath *paths.Path, fqbn string
return &types.Context{
SketchLocation: sketchPath,
FQBN: parseFQBN(t, fqbn),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down
10 changes: 5 additions & 5 deletions legacy/builder/test/ctags_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestCTagsRunner(t *testing.T) {
sketchLocation := Abs(t, paths.New("downloaded_libraries", "Bridge", "examples", "Bridge", "Bridge.ino"))

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -82,7 +82,7 @@ func TestCTagsRunnerSketchWithClass(t *testing.T) {
sketchLocation := Abs(t, paths.New("sketch_with_class", "sketch_with_class.ino"))

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -130,7 +130,7 @@ func TestCTagsRunnerSketchWithTypename(t *testing.T) {
sketchLocation := Abs(t, paths.New("sketch_with_typename", "sketch_with_typename.ino"))

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -177,7 +177,7 @@ func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
sketchLocation := Abs(t, paths.New("sketch_with_namespace", "sketch_with_namespace.ino"))

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestCTagsRunnerSketchWithTemplates(t *testing.T) {
sketchLocation := Abs(t, paths.New("sketch_with_templates_and_shift", "sketch_with_templates_and_shift.cpp"))

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down
18 changes: 0 additions & 18 deletions legacy/builder/test/hardware/arduino/avr/boards.txt

This file was deleted.

1 change: 0 additions & 1 deletion legacy/builder/test/hardware/platform.txt

This file was deleted.

19 changes: 11 additions & 8 deletions legacy/builder/test/hardware_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ import (

func TestLoadHardware(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)
downloadedHardwareAvr := paths.New("downloaded_hardware", "arduino", "avr")
paths.New("custom_local_txts", "boards.local.txt").CopyTo(downloadedHardwareAvr.Join("boards.local.txt"))
paths.New("custom_local_txts", "platform.local.txt").CopyTo(downloadedHardwareAvr.Join("platform.local.txt"))
ctx := &types.Context{
HardwareDirs: paths.NewPathList("downloaded_hardware", filepath.Join("..", "hardware"), "hardware"),
HardwareDirs: paths.NewPathList("downloaded_hardware", filepath.Join("..", "hardware")),
}

commands := []types.Command{
Expand All @@ -42,7 +45,7 @@ func TestLoadHardware(t *testing.T) {
}

packages := ctx.Hardware
require.Equal(t, 2, len(packages))
require.Equal(t, 1, len(packages))
require.NotNil(t, packages["arduino"])
require.Equal(t, 2, len(packages["arduino"].Platforms))

Expand Down Expand Up @@ -73,7 +76,7 @@ func TestLoadHardware(t *testing.T) {

func TestLoadHardwareMixingUserHardwareFolder(t *testing.T) {
ctx := &types.Context{
HardwareDirs: paths.NewPathList("downloaded_hardware", filepath.Join("..", "hardware"), "hardware", "user_hardware"),
HardwareDirs: paths.NewPathList("downloaded_hardware", filepath.Join("..", "hardware"), "user_hardware"),
}

commands := []types.Command{
Expand All @@ -92,9 +95,9 @@ func TestLoadHardwareMixingUserHardwareFolder(t *testing.T) {

if runtime.GOOS == "windows" {
//a package is a symlink, and windows does not support them
require.Equal(t, 3, len(packages))
require.Equal(t, 2, len(packages))
} else {
require.Equal(t, 4, len(packages))
require.Equal(t, 3, len(packages))
}

require.NotNil(t, packages["arduino"])
Expand Down Expand Up @@ -191,7 +194,7 @@ func TestLoadHardwareWithBoardManagerFolderStructure(t *testing.T) {

func TestLoadLotsOfHardware(t *testing.T) {
ctx := &types.Context{
HardwareDirs: paths.NewPathList("downloaded_board_manager_stuff", "downloaded_hardware", filepath.Join("..", "hardware"), "hardware", "user_hardware"),
HardwareDirs: paths.NewPathList("downloaded_board_manager_stuff", "downloaded_hardware", filepath.Join("..", "hardware"), "user_hardware"),
}

commands := []types.Command{
Expand All @@ -207,9 +210,9 @@ func TestLoadLotsOfHardware(t *testing.T) {

if runtime.GOOS == "windows" {
//a package is a symlink, and windows does not support them
require.Equal(t, 5, len(packages))
require.Equal(t, 4, len(packages))
} else {
require.Equal(t, 6, len(packages))
require.Equal(t, 5, len(packages))
}

require.NotNil(t, packages["arduino"])
Expand Down
16 changes: 8 additions & 8 deletions legacy/builder/test/includes_to_include_folders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestIncludesToIncludeFolders(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -66,7 +66,7 @@ func TestIncludesToIncludeFoldersSketchWithIfDef(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -101,7 +101,7 @@ func TestIncludesToIncludeFoldersIRremoteLibrary(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -139,7 +139,7 @@ func TestIncludesToIncludeFoldersANewLibrary(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestIncludesToIncludeFoldersDuplicateLibs(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware", "user_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "user_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
SketchLocation: paths.New("user_hardware", "my_avr_platform", "avr", "libraries", "SPI", "examples", "BarometricPressureSensor", "BarometricPressureSensor.ino"),
Expand Down Expand Up @@ -211,7 +211,7 @@ func TestIncludesToIncludeFoldersDuplicateLibsWithConflictingLibsOutsideOfPlatfo
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware", "user_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "user_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -249,7 +249,7 @@ func TestIncludesToIncludeFoldersDuplicateLibs2(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware", "downloaded_board_manager_stuff"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "downloaded_board_manager_stuff"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -287,7 +287,7 @@ func TestIncludesToIncludeFoldersSubfolders(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down
8 changes: 4 additions & 4 deletions legacy/builder/test/libraries_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestLoadLibrariesAVR(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
Expand Down Expand Up @@ -151,7 +151,7 @@ func TestLoadLibrariesSAM(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
FQBN: parseFQBN(t, "arduino:sam:arduino_due_x_dbg"),
Expand Down Expand Up @@ -234,7 +234,7 @@ func TestLoadLibrariesAVRNoDuplicateLibrariesFolders(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries", filepath.Join("downloaded_hardware", "arduino", "avr", "libraries")),
FQBN: parseFQBN(t, "arduino:avr:leonardo"),
Expand Down Expand Up @@ -263,7 +263,7 @@ func TestLoadLibrariesMyAVRPlatform(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "user_hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "user_hardware", "downloaded_hardware"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries", filepath.Join("downloaded_hardware", "arduino", "avr", "libraries")),
FQBN: parseFQBN(t, "my_avr_platform:avr:custom_yun"),
Expand Down
4 changes: 2 additions & 2 deletions legacy/builder/test/load_vid_pid_specific_properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestLoadVIDPIDSpecificPropertiesWhenNoVIDPIDAreProvided(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "./tools_builtin"),
SketchLocation: paths.New("sketch1", "sketch1.ino"),
FQBN: parseFQBN(t, "arduino:avr:micro"),
Expand Down Expand Up @@ -59,7 +59,7 @@ func TestLoadVIDPIDSpecificProperties(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools", "./tools_builtin"),
SketchLocation: paths.New("sketch1", "sketch1.ino"),
FQBN: parseFQBN(t, "arduino:avr:micro"),
Expand Down
8 changes: 4 additions & 4 deletions legacy/builder/test/merge_sketch_with_bootloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestMergeSketchWithBootloader(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestMergeSketchWithBootloaderSketchInBuildPath(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -173,7 +173,7 @@ func TestMergeSketchWithBootloaderWhenNoBootloaderAvailable(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down Expand Up @@ -211,7 +211,7 @@ func TestMergeSketchWithBootloaderPathIsParameterized(t *testing.T) {
DownloadCoresAndToolsAndLibraries(t)

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "hardware", "downloaded_hardware", "user_hardware"),
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware", "user_hardware"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
BuiltInLibrariesDirs: paths.NewPathList("downloaded_libraries"),
OtherLibrariesDirs: paths.NewPathList("libraries"),
Expand Down
2 changes: 1 addition & 1 deletion legacy/builder/test/platform_keys_rewrite_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

func TestLoadPlatformKeysRewrite(t *testing.T) {
ctx := &types.Context{
HardwareDirs: paths.NewPathList("downloaded_hardware", filepath.Join("..", "hardware"), "hardware"),
HardwareDirs: paths.NewPathList("downloaded_hardware", filepath.Join("..", "hardware")),
}

commands := []types.Command{
Expand Down
Loading