-
-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[breaking] Fix:
lib list --fqbn
and lib examples --fqbn
do not sh…
…ow platform bundled lib when lib of same name is installed globally (#2113) * Added test * Factored function to determine library compatibility * Made ComputePriority function public * fix: use the libraries resolution algorithm to determine library priority * Slightly refactored 'lib list' command call * Updated UPGRADING.md * Added test for a similar bug in `lib examples` See #1656
- Loading branch information
Showing
7 changed files
with
74 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1547,3 +1547,43 @@ func TestLibQueryParameters(t *testing.T) { | |
require.Contains(t, string(stdout), | ||
"Starting download \x1b[36murl\x1b[0m=\"https://downloads.arduino.cc/libraries/github.com/firmata/Firmata-2.5.9.zip?query=upgrade-builtin\"\n") | ||
} | ||
|
||
func TestLibBundlesWhenLibWithTheSameNameIsInstalledGlobally(t *testing.T) { | ||
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t) | ||
defer env.CleanUp() | ||
|
||
// See: https://github.com/arduino/arduino-cli/issues/1566 | ||
_, _, err := cli.Run("core", "install", "arduino:[email protected]") | ||
require.NoError(t, err) | ||
{ | ||
stdout, _, err := cli.Run("lib", "list", "--all", "--fqbn", "arduino:samd:mkrzero", "USBHost", "--format", "json") | ||
require.NoError(t, err) | ||
j := requirejson.Parse(t, stdout) | ||
j.Query(`.[0].library.name`).MustEqual(`"USBHost"`) | ||
j.Query(`.[0].library.compatible_with."arduino:samd:mkrzero"`).MustEqual(`true`) | ||
} | ||
_, _, err = cli.Run("lib", "install", "[email protected]") | ||
require.NoError(t, err) | ||
{ | ||
// Check that the architecture-specific library is still listed | ||
stdout, _, err := cli.Run("lib", "list", "--all", "--fqbn", "arduino:samd:mkrzero", "USBHost", "--format", "json") | ||
require.NoError(t, err) | ||
j := requirejson.Parse(t, stdout) | ||
j.Query(`.[0].library.name`).MustEqual(`"USBHost"`) | ||
j.Query(`.[0].library.compatible_with."arduino:samd:mkrzero"`).MustEqual(`true`) | ||
} | ||
|
||
// See: https://github.com/arduino/arduino-cli/issues/1656 | ||
{ | ||
_, _, err = cli.Run("core", "update-index", "--additional-urls", "https://arduino.esp8266.com/stable/package_esp8266com_index.json") | ||
require.NoError(t, err) | ||
_, _, err = cli.Run("core", "install", "--additional-urls", "https://arduino.esp8266.com/stable/package_esp8266com_index.json", "esp8266:[email protected]") | ||
require.NoError(t, err) | ||
_, _, err = cli.Run("lib", "install", "[email protected]") | ||
require.NoError(t, err) | ||
stdout, _, err := cli.Run("lib", "examples", "--fqbn", "esp8266:esp8266:generic", "ArduinoOTA", "--format", "json") | ||
require.NoError(t, err) | ||
requirejson.Parse(t, stdout).Query(`.[].library.examples[0]`).MustContain(`"BasicOTA"`) | ||
requirejson.Parse(t, stdout).Query(`.[].library.examples[1]`).MustContain(`"OTALeds"`) | ||
} | ||
} |