From eca378f771d6c359ca8391e20825ea72159a4756 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Thu, 6 Jul 2023 17:39:05 +1200 Subject: [PATCH 1/3] test: fix file permissions in PackageBundler tests --- test/packagebundler.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/packagebundler.jl b/test/packagebundler.jl index 9c69844ad..ce91eec67 100644 --- a/test/packagebundler.jl +++ b/test/packagebundler.jl @@ -1,6 +1,10 @@ import Tar -pkg1 = joinpath(@__DIR__, "fixtures", "ignorefiles", "Pkg1") +tmp_fixtures = tempname() +cp(joinpath(@__DIR__, "fixtures"), tmp_fixtures) +chmod(tmp_fixtures, 0o777; recursive=true) + +pkg1 = joinpath(tmp_fixtures, "ignorefiles", "Pkg1") if !isdir(joinpath(pkg1, ".git")) mkdir(joinpath(pkg1, ".git")) # can't check in sub-repos touch(joinpath(pkg1, ".git", "test")) From e3f6b0d0df6a430dff7eab5c7fa74575e15d4861 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Thu, 6 Jul 2023 17:42:56 +1200 Subject: [PATCH 2/3] ... --- test/packagebundler.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/packagebundler.jl b/test/packagebundler.jl index ce91eec67..abe07c076 100644 --- a/test/packagebundler.jl +++ b/test/packagebundler.jl @@ -1,6 +1,7 @@ import Tar tmp_fixtures = tempname() +@show tmp_fixtures cp(joinpath(@__DIR__, "fixtures"), tmp_fixtures) chmod(tmp_fixtures, 0o777; recursive=true) From 8ee828305ca5a8133991556e826aa8fe581ef176 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Thu, 6 Jul 2023 17:47:34 +1200 Subject: [PATCH 3/3] ... --- test/jobs.jl | 12 ++++++++++-- test/packagebundler.jl | 13 ++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/test/jobs.jl b/test/jobs.jl index 31fad39c9..d65a9c547 100644 --- a/test/jobs.jl +++ b/test/jobs.jl @@ -1,5 +1,13 @@ +# We have to copy the test environment files to a temporary directory +# because PackageBundler needs write access to them. +JOBENVS = let tmp = tempname() + cp(joinpath(@__DIR__, "jobenvs"), tmp) + chmod(tmp, 0o777; recursive=true) + tmp +end + @testset "JuliaHub.script" begin - jobfile(path...) = joinpath(@__DIR__, "jobenvs", "job1", path...) + jobfile(path...) = joinpath(JOBENVS, "job1", path...) let s = JuliaHub.script(; code="1", project="name=1", manifest="name=1", artifacts="name=1") @test s.code == "1" @@ -50,7 +58,7 @@ end @testset "JuliaHub.appbundle" begin - jobfile(path...) = joinpath(@__DIR__, "jobenvs", "job1", path...) + jobfile(path...) = joinpath(JOBENVS, "job1", path...) bundle = JuliaHub.appbundle(jobfile(), "script.jl") @test isfile(bundle.environment.tarball_path) diff --git a/test/packagebundler.jl b/test/packagebundler.jl index abe07c076..7c525bc9a 100644 --- a/test/packagebundler.jl +++ b/test/packagebundler.jl @@ -1,11 +1,14 @@ import Tar -tmp_fixtures = tempname() -@show tmp_fixtures -cp(joinpath(@__DIR__, "fixtures"), tmp_fixtures) -chmod(tmp_fixtures, 0o777; recursive=true) +# We have to copy the test environment files to a temporary directory +# because PackageBundler needs write access to them. +TMP_FIXTURES = let tmp = tempname() + cp(joinpath(@__DIR__, "fixtures"), tmp) + chmod(tmp, 0o777; recursive=true) + tmp +end -pkg1 = joinpath(tmp_fixtures, "ignorefiles", "Pkg1") +pkg1 = joinpath(TMP_FIXTURES, "ignorefiles", "Pkg1") if !isdir(joinpath(pkg1, ".git")) mkdir(joinpath(pkg1, ".git")) # can't check in sub-repos touch(joinpath(pkg1, ".git", "test"))