Skip to content

Commit 316f0fe

Browse files
authored
Construct proper URIs for paths when run on WSL in tests (#57061)
#55454 produces the correct URIs when run on WSL, but the tests don't use the same logic and so they fail on WSL at the moment. This fixes the tests on WSL. CC @tecosaur
1 parent b0ae24f commit 316f0fe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/path.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,14 @@
312312
end
313313

314314
@testset "uripath" begin
315-
host = if Sys.iswindows() "" else gethostname() end
315+
host = if Sys.iswindows()
316+
""
317+
elseif ispath("/proc/sys/fs/binfmt_misc/WSLInterop")
318+
distro = get(ENV, "WSL_DISTRO_NAME", "") # See <https://patrickwu.space/wslconf/>
319+
"wsl%24/$distro" # See <https://github.com/microsoft/terminal/pull/14993> and <https://learn.microsoft.com/en-us/windows/wsl/filesystems>
320+
else
321+
gethostname()
322+
end
316323
sysdrive, uridrive = if Sys.iswindows() "C:\\", "C:/" else "/", "" end
317324
@test Base.Filesystem.uripath("$(sysdrive)some$(sep)file.txt") == "file://$host/$(uridrive)some/file.txt"
318325
@test Base.Filesystem.uripath("$(sysdrive)another$(sep)$(sep)folder$(sep)file.md") == "file://$host/$(uridrive)another/folder/file.md"

0 commit comments

Comments
 (0)