From 6d4f13a7de21990243c7c69354b877ca303f018b Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Wed, 19 May 2021 08:53:43 +0200 Subject: [PATCH 1/4] [skip changelog] Update go-paths-helper dependency --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d9e7e87844b..4af7602abc3 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.14 require ( github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c - github.com/arduino/go-paths-helper v1.4.0 + github.com/arduino/go-paths-helper v1.5.0 github.com/arduino/go-properties-orderedmap v1.3.0 github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b diff --git a/go.sum b/go.sum index 232f81baed5..fa688ad2e28 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,8 @@ github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3 github.com/arduino/go-paths-helper v1.2.0/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck= github.com/arduino/go-paths-helper v1.4.0 h1:ilnseAdxmN1bFnLxxXHRtcdmt9jBf3O4jtYfWfqule4= github.com/arduino/go-paths-helper v1.4.0/go.mod h1:V82BWgAAp4IbmlybxQdk9Bpkz8M4Qyx+RAFKaG9NuvU= +github.com/arduino/go-paths-helper v1.5.0 h1:RVo189hD+GhUS1rQ3gixwK1nSbvVR8MGIGa7Gxv2bdM= +github.com/arduino/go-paths-helper v1.5.0/go.mod h1:V82BWgAAp4IbmlybxQdk9Bpkz8M4Qyx+RAFKaG9NuvU= github.com/arduino/go-properties-orderedmap v1.3.0 h1:4No/vQopB36e7WUIk6H6TxiSEJPiMrVOCZylYmua39o= github.com/arduino/go-properties-orderedmap v1.3.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk= github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b h1:9hDi4F2st6dbLC3y4i02zFT5quS4X6iioWifGlVwfy4= From 685f340709f66e20e25c68c058c25d307b575bfc Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Wed, 19 May 2021 08:59:45 +0200 Subject: [PATCH 2/4] [skip changelog] Lib install dir path is now canonical This stems mainly from the fact the CI uses 8.3 naming convention for paths on Windows, that causes several issues when trying to verify that certain paths are printed in the output of certain commands. Making sure that canonical paths are set as installation directory for all libraries makes it easier to test. For more info on 8.3 paths see: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#short-vs-long-names --- arduino/libraries/loader.go | 4 ++-- test/test_compile.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arduino/libraries/loader.go b/arduino/libraries/loader.go index 70e738d3fdd..0546229745a 100644 --- a/arduino/libraries/loader.go +++ b/arduino/libraries/loader.go @@ -67,7 +67,7 @@ func makeNewLibrary(libraryDir *paths.Path, location LibraryLocation) (*Library, library := &Library{} library.Location = location - library.InstallDir = libraryDir + library.InstallDir = libraryDir.Canonical() if libraryDir.Join("src").Exist() { library.Layout = RecursiveLayout library.SourceDir = libraryDir.Join("src") @@ -127,7 +127,7 @@ func makeNewLibrary(libraryDir *paths.Path, location LibraryLocation) (*Library, func makeLegacyLibrary(path *paths.Path, location LibraryLocation) (*Library, error) { library := &Library{ - InstallDir: path, + InstallDir: path.Canonical(), Location: location, SourceDir: path, Layout: FlatLayout, diff --git a/test/test_compile.py b/test/test_compile.py index 381f2ec18ed..7f8ec6455a8 100644 --- a/test/test_compile.py +++ b/test/test_compile.py @@ -928,7 +928,7 @@ def test_compile_with_library_priority(run_command, data_dir): # Manually installs a library git_url = "https://github.com/arduino-libraries/WiFi101.git" - manually_install_lib_path = Path(data_dir, "my-libraries", "WiFi101") + manually_install_lib_path = os.path.realpath(Path(data_dir, "my-libraries", "WiFi101")) assert Repo.clone_from(git_url, manually_install_lib_path, multi_options=["-b 0.16.1"]) # Install the same library we installed manually @@ -946,7 +946,7 @@ def test_compile_with_library_priority(run_command, data_dir): res = run_command(f"compile -b {fqbn} {sketch_path} --library {manually_install_lib_path} -v") assert res.ok - cli_installed_lib_path = Path(data_dir, "libraries", "WiFi101") + cli_installed_lib_path = os.path.realpath(Path(data_dir, "libraries", "WiFi101")) expected_output = [ 'Multiple libraries were found for "WiFi101.h"', f" Used: {manually_install_lib_path}", From 02733d7c83216abf2269e1944271c3653e763c2c Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Wed, 19 May 2021 09:40:22 +0200 Subject: [PATCH 3/4] [skip changelog] Fix esp8266 test --- test/test_compile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_compile.py b/test/test_compile.py index 7f8ec6455a8..62f921f5b2a 100644 --- a/test/test_compile.py +++ b/test/test_compile.py @@ -581,7 +581,7 @@ def test_compile_with_archives_and_long_paths(run_command): assert run_command("update") # Install core to compile - assert run_command("core install esp8266:esp8266") + assert run_command("core install esp8266:esp8266@2.7.4") # Install test library assert run_command("lib install ArduinoIoTCloud") From 525ed5974961d77e33309b9d7808ddcf834358e6 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Wed, 19 May 2021 10:13:23 +0200 Subject: [PATCH 4/4] [skip changelog] Changed test paths to canonical --- test/conftest.py | 8 ++++---- test/test_compile.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index e7e2b231490..2688ef7bdf8 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -55,13 +55,13 @@ def data_dir(tmpdir_factory): # due to the above on Windows we cut the tmp path straight to /tmp/xxxxxxxx if platform.system() == "Windows": with tempfile.TemporaryDirectory() as tmp: - yield tmp + yield os.path.realpath(tmp) # We don't need to remove the directory since # tempfile.TemporaryDirectory deletes itself # automatically when exits its scope. else: data = tmpdir_factory.mktemp("ArduinoTest") - yield str(data) + yield os.path.realpath(data) shutil.rmtree(data, ignore_errors=True) @@ -82,7 +82,7 @@ def downloads_dir(tmpdir_factory, worker_id): if not lock.is_file(): lock.touch() - yield str(download_dir) + yield os.path.realpath(download_dir) shutil.rmtree(download_dir, ignore_errors=True) @@ -94,7 +94,7 @@ def working_dir(tmpdir_factory): at the end, this way all the tests work in isolation. """ work_dir = tmpdir_factory.mktemp("ArduinoTestWork") - yield str(work_dir) + yield os.path.realpath(work_dir) shutil.rmtree(work_dir, ignore_errors=True) diff --git a/test/test_compile.py b/test/test_compile.py index 62f921f5b2a..67da7a579b5 100644 --- a/test/test_compile.py +++ b/test/test_compile.py @@ -928,7 +928,7 @@ def test_compile_with_library_priority(run_command, data_dir): # Manually installs a library git_url = "https://github.com/arduino-libraries/WiFi101.git" - manually_install_lib_path = os.path.realpath(Path(data_dir, "my-libraries", "WiFi101")) + manually_install_lib_path = Path(data_dir, "my-libraries", "WiFi101") assert Repo.clone_from(git_url, manually_install_lib_path, multi_options=["-b 0.16.1"]) # Install the same library we installed manually @@ -946,7 +946,7 @@ def test_compile_with_library_priority(run_command, data_dir): res = run_command(f"compile -b {fqbn} {sketch_path} --library {manually_install_lib_path} -v") assert res.ok - cli_installed_lib_path = os.path.realpath(Path(data_dir, "libraries", "WiFi101")) + cli_installed_lib_path = Path(data_dir, "libraries", "WiFi101") expected_output = [ 'Multiple libraries were found for "WiFi101.h"', f" Used: {manually_install_lib_path}",