Skip to content

Commit 69136e9

Browse files
committed
Fixed integration test
1 parent 13342eb commit 69136e9

File tree

5 files changed

+22
-70
lines changed

5 files changed

+22
-70
lines changed

internal/integrationtest/board/board_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,10 @@ func TestBoardListallWithManuallyInstalledPlatform(t *testing.T) {
237237
"platform": {
238238
"metadata": {
239239
"id": "arduino-beta-development:samd",
240+
"manually_installed": true
240241
},
241242
"release": {
242243
"installed": true,
243-
"version": "1.8.11",
244244
"name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards"
245245
},
246246
}
@@ -251,10 +251,10 @@ func TestBoardListallWithManuallyInstalledPlatform(t *testing.T) {
251251
"platform": {
252252
"metadata": {
253253
"id": "arduino-beta-development:samd",
254+
"manually_installed": true
254255
},
255256
"release": {
256257
"installed": true,
257-
"version": "1.8.11",
258258
"name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards"
259259
},
260260
}

internal/integrationtest/board/hardware_loading_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ func TestHardwareLoading(t *testing.T) {
182182
"platforms": [
183183
{
184184
"id": "my_avr_platform:avr",
185-
"installed_version": "9.9.9",
185+
"installed_version": "",
186186
"releases": {
187-
"9.9.9": {
187+
"": {
188188
"name": "My AVR Boards",
189189
"boards": [
190190
{
@@ -207,7 +207,7 @@ func TestHardwareLoading(t *testing.T) {
207207
"id": "my_symlinked_avr_platform:avr",
208208
"manually_installed": true,
209209
"releases": {
210-
"9.9.9": {
210+
"": {
211211
}
212212
}
213213
}

internal/integrationtest/compile_4/compile_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ type buildOptions struct {
828828
Verbose bool
829829
}
830830

831-
func tryBuild(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI, fqbn string, optionsArg ...*buildOptions) (*builderOutput, error) {
831+
func tryBuild(t *testing.T, _ *integrationtest.Environment, cli *integrationtest.ArduinoCLI, fqbn string, optionsArg ...*buildOptions) (*builderOutput, error) {
832832
var options *buildOptions
833833
if len(optionsArg) == 0 {
834834
options = &buildOptions{}
@@ -870,7 +870,7 @@ func tryBuild(t *testing.T, env *integrationtest.Environment, cli *integrationte
870870
return &out, err
871871
}
872872

873-
func tryPreprocess(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI, fqbn string) (*paths.Path, []byte, error) {
873+
func tryPreprocess(t *testing.T, _ *integrationtest.Environment, cli *integrationtest.ArduinoCLI, fqbn string) (*paths.Path, []byte, error) {
874874
subTestName := strings.Split(t.Name(), "/")[1]
875875
sketchPath, err := paths.New("testdata", subTestName).Abs()
876876
require.NoError(t, err)

internal/integrationtest/core/core_test.go

+15-63
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"encoding/json"
2020
"fmt"
2121
"os"
22-
"path/filepath"
2322
"runtime"
2423
"sort"
2524
"strconv"
@@ -52,12 +51,16 @@ func TestCorrectHandlingOfPlatformVersionProperty(t *testing.T) {
5251
"platforms": [
5352
{
5453
"id":"DxCore-dev:megaavr",
54+
"manually_installed": true,
5555
"installed_version":"1.4.10",
5656
"releases": {
57-
"1.4.10": {
57+
"": {
5858
"name":"DxCore"
5959
}
60-
}
60+
},
61+
"installed_version": "",
62+
"latest_version": "",
63+
"has_manually_installed_release": true
6164
}
6265
]
6366
}`)
@@ -512,63 +515,9 @@ func TestCoreListAllManuallyInstalledCore(t *testing.T) {
512515
requirejson.Contains(t, stdout, `{"platforms":[
513516
{
514517
"id": "arduino-beta-development:avr",
515-
"latest_version": "1.8.3",
518+
"latest_version": "",
516519
"releases": {
517-
"1.8.3": {
518-
"name": "Arduino AVR Boards"
519-
}
520-
}
521-
}
522-
]}`)
523-
}
524-
525-
func TestCoreListShowsLatestVersionWhenMultipleReleasesOfAManuallyInstalledCoreArePresent(t *testing.T) {
526-
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
527-
defer env.CleanUp()
528-
529-
_, _, err := cli.Run("core", "update-index")
530-
require.NoError(t, err)
531-
532-
// Verifies only cores in board manager are shown
533-
stdout, _, err := cli.Run("core", "list", "--all", "--json")
534-
require.NoError(t, err)
535-
requirejson.Query(t, stdout, `.platforms | length > 0`, `true`)
536-
length, err := strconv.Atoi(requirejson.Parse(t, stdout).Query(".platforms | length").String())
537-
require.NoError(t, err)
538-
539-
// Manually installs a core in sketchbooks hardware folder
540-
gitUrl := "https://github.com/arduino/ArduinoCore-avr.git"
541-
repoDir := cli.SketchbookDir().Join("hardware", "arduino-beta-development", "avr")
542-
_, err = git.PlainClone(filepath.Join(repoDir.String(), "1.8.3"), false, &git.CloneOptions{
543-
URL: gitUrl,
544-
ReferenceName: plumbing.NewTagReferenceName("1.8.3"),
545-
})
546-
require.NoError(t, err)
547-
548-
tmp := paths.New(t.TempDir(), "1.8.4")
549-
_, err = git.PlainClone(tmp.String(), false, &git.CloneOptions{
550-
URL: gitUrl,
551-
ReferenceName: plumbing.NewTagReferenceName("1.8.4"),
552-
})
553-
require.NoError(t, err)
554-
555-
err = tmp.Rename(repoDir.Join("1.8.4"))
556-
require.NoError(t, err)
557-
558-
// When manually installing 2 releases of the same core, the newest one takes precedence
559-
stdout, _, err = cli.Run("core", "list", "--all", "--json")
560-
require.NoError(t, err)
561-
requirejson.Query(t, stdout, `.platforms | length`, fmt.Sprint(length+1))
562-
requirejson.Contains(t, stdout, `{"platforms":[
563-
{
564-
"id": "arduino-beta-development:avr",
565-
"latest_version": "1.8.4",
566-
"installed_version": "1.8.4",
567-
"releases": {
568-
"1.8.3": {
569-
"name": "Arduino AVR Boards"
570-
},
571-
"1.8.3": {
520+
"": {
572521
"name": "Arduino AVR Boards"
573522
}
574523
}
@@ -606,12 +555,15 @@ func TestCoreListUpdatableAllFlags(t *testing.T) {
606555
requirejson.Contains(t, stdout, `{"platforms":[
607556
{
608557
"id": "arduino-beta-development:avr",
609-
"latest_version": "1.8.3",
558+
"manually_installed": true,
559+
"installed_version": "",
560+
"latest_version": "",
610561
"releases": {
611-
"1.8.3": {
562+
"": {
612563
"name": "Arduino AVR Boards"
613564
}
614-
}
565+
},
566+
"has_manually_installed_release": true
615567
}
616568
]}`)
617569
}
@@ -1009,7 +961,7 @@ func TestCoreWithMissingCustomBoardOptionsIsLoaded(t *testing.T) {
1009961
{
1010962
"id": "arduino-beta-dev:platform_with_missing_custom_board_options",
1011963
"releases": {
1012-
"4.2.0": {
964+
"": {
1013965
"boards": [
1014966
{
1015967
"fqbn": "arduino-beta-dev:platform_with_missing_custom_board_options:nessuno"

internal/integrationtest/testdata/user_hardware/arduino/avr/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)