Skip to content

Commit 21b7046

Browse files
alternative
1 parent 6655c6b commit 21b7046

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/pkg.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,15 +363,26 @@ temp_pkg_dir() do project_path
363363
@test any(x -> startswith(x, manifest), keys(usage))
364364
end
365365

366-
@testset "atomic write_env_usage with $(Sys.CPU_THREADS) processes for 10 seconds" begin
366+
@testset "test atomicity of write_env_usage with $(Sys.CPU_THREADS) parallel processes" begin
367367
tasks = Task[]
368368
iobs = IOBuffer[]
369369
Sys.CPU_THREADS == 1 && error("Cannot test for atomic usage log file interaction effectively with only Sys.CPU_THREADS=1")
370370
run(`$(Base.julia_cmd()) --project="$(pkgdir(Pkg))" -e "import Pkg"`) # to precompile Pkg given we're in a different depot
371371
for i in 1:Sys.CPU_THREADS
372372
iob = IOBuffer()
373373
t = @async run(pipeline(`$(Base.julia_cmd()) --project="$(pkgdir(Pkg))"
374-
-e "import Pkg; for i in 1:50 Pkg.activate(temp = true); Pkg.add(\"Random\", io = devnull); Pkg.Types.EnvCache(); end"`,
374+
-e "import Pkg;
375+
Pkg.UPDATED_REGISTRY_THIS_SESSION[] = true;
376+
Pkg.activate(temp = true);
377+
Pkg.add(\"Random\", io = devnull);
378+
for i in 1:100
379+
try
380+
Pkg.Types.EnvCache()
381+
catch
382+
println(stderr, \"Errored after $i iterations\")
383+
rethrow()
384+
end
385+
end"`,
375386
stderr = iob, stdout = devnull))
376387
push!(tasks, t)
377388
push!(iobs, iob)

0 commit comments

Comments
 (0)