From 653fbf115239905a9d30ba285f5fdfc1b513b0ab Mon Sep 17 00:00:00 2001 From: nhz2 Date: Thu, 4 Jan 2024 23:01:24 -0500 Subject: [PATCH 1/2] test without symlink on windows --- .github/workflows/test.yml | 8 ++++++++ test/runtests.jl | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 01062b5c86..3aa0948a38 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,12 +34,19 @@ jobs: pkg-server: - "" - "pkg.julialang.org" + break-symlink: + - "false" + - "true" julia-version: # - '1.6' - 'nightly' exclude: - os: macOS-latest julia-arch: x86 + - os: macOS-latest + break-symlink: "true" + - os: ubuntu-latest + break-symlink: "true" steps: - name: Set git to use LF and fix TEMP on windows if: matrix.os == 'windows-latest' @@ -59,6 +66,7 @@ jobs: coverage: true env: JULIA_PKG_SERVER: ${{ matrix.pkg-server }} + JULIA_TEST_BREAK_BASE_SYMLINK: ${{ matrix.break-symlink }} JULIA_TEST_VERBOSE_LOGS_DIR: ${{ github.workspace }} - uses: actions/upload-artifact@v4 if: ${{ always() }} diff --git a/test/runtests.jl b/test/runtests.jl index ea41b1633b..fd40762013 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -14,6 +14,17 @@ original_wd = pwd() import Pkg using Test, Logging +# Break Base.symlink to simulate the typical Microsoft Windows user experience. +if get(ENV, "JULIA_TEST_BREAK_BASE_SYMLINK", "false") == "true" + function Base.symlink(a::AbstractString, b::AbstractString; kwargs...) + throw(Base.IOError( + """On Windows, creating symlinks requires Administrator privileges. + symlink($(repr(a)), $(repr(b))): operation not permitted (EPERM)""", + -4048, + )) + end +end + if realpath(dirname(dirname(Base.pathof(Pkg)))) != realpath(dirname(@__DIR__)) @show dirname(dirname(Base.pathof(Pkg))) realpath(dirname(@__DIR__)) error("The wrong Pkg is being tested") From 81884c8ae976bb2a64aa20a02605d13c9bbd465b Mon Sep 17 00:00:00 2001 From: nhz2 Date: Fri, 5 Jan 2024 01:13:28 -0500 Subject: [PATCH 2/2] use existing BINARYPROVIDER_COPYDEREF env var --- .github/workflows/test.yml | 8 -------- test/artifacts.jl | 17 +++++++++++++++++ test/runtests.jl | 11 ----------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3aa0948a38..01062b5c86 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,19 +34,12 @@ jobs: pkg-server: - "" - "pkg.julialang.org" - break-symlink: - - "false" - - "true" julia-version: # - '1.6' - 'nightly' exclude: - os: macOS-latest julia-arch: x86 - - os: macOS-latest - break-symlink: "true" - - os: ubuntu-latest - break-symlink: "true" steps: - name: Set git to use LF and fix TEMP on windows if: matrix.os == 'windows-latest' @@ -66,7 +59,6 @@ jobs: coverage: true env: JULIA_PKG_SERVER: ${{ matrix.pkg-server }} - JULIA_TEST_BREAK_BASE_SYMLINK: ${{ matrix.break-symlink }} JULIA_TEST_VERBOSE_LOGS_DIR: ${{ github.workspace }} - uses: actions/upload-artifact@v4 if: ${{ always() }} diff --git a/test/artifacts.jl b/test/artifacts.jl index cf80f17a01..6a8aa79a6e 100644 --- a/test/artifacts.jl +++ b/test/artifacts.jl @@ -796,4 +796,21 @@ end end end +if Sys.iswindows() + @testset "installing artifacts when symlinks are copied" begin + # copy symlinks to simulate the typical Microsoft Windows user experience. + withenv("BINARYPROVIDER_COPYDEREF" => "true") do + temp_pkg_dir() do tmpdir + artifacts_toml = joinpath(tmpdir, "Artifacts.toml") + cp(joinpath(@__DIR__, "test_packages", "ArtifactInstallation", "Artifacts.toml"), artifacts_toml) + Pkg.activate(tmpdir) + cts_hash = artifact_hash("collapse_the_symlink", artifacts_toml) + @test !artifact_exists(cts_hash) + Pkg.instantiate() + @test artifact_exists(cts_hash) + end + end + end +end + end # module diff --git a/test/runtests.jl b/test/runtests.jl index fd40762013..ea41b1633b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -14,17 +14,6 @@ original_wd = pwd() import Pkg using Test, Logging -# Break Base.symlink to simulate the typical Microsoft Windows user experience. -if get(ENV, "JULIA_TEST_BREAK_BASE_SYMLINK", "false") == "true" - function Base.symlink(a::AbstractString, b::AbstractString; kwargs...) - throw(Base.IOError( - """On Windows, creating symlinks requires Administrator privileges. - symlink($(repr(a)), $(repr(b))): operation not permitted (EPERM)""", - -4048, - )) - end -end - if realpath(dirname(dirname(Base.pathof(Pkg)))) != realpath(dirname(@__DIR__)) @show dirname(dirname(Base.pathof(Pkg))) realpath(dirname(@__DIR__)) error("The wrong Pkg is being tested")