Skip to content

Commit 52b48f3

Browse files
remove minimum iterations in test, just base on time
1 parent 8b7a028 commit 52b48f3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/pkg.jl

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

366-
@time @testset "test atomicity of write_env_usage with $(Sys.CPU_THREADS) parallel processes" 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")
@@ -372,19 +372,22 @@ temp_pkg_dir() do project_path
372372
flag_end_file = tempname() # use creating this file as a way to stop the processes early if an error happens
373373
for i in 1:Sys.CPU_THREADS
374374
iob = IOBuffer()
375-
t = @async run(pipeline(`$(Base.julia_cmd()) --project="$(pkgdir(Pkg))"
375+
t = @async run(pipeline(`$(Base.julia_cmd()[1]) --project="$(pkgdir(Pkg))"
376376
-e "import Pkg;
377377
Pkg.UPDATED_REGISTRY_THIS_SESSION[] = true;
378378
Pkg.activate(temp = true);
379379
Pkg.add(\"Random\", io = devnull);
380-
i = 0
381380
touch(tempname(raw\"$flag_start_dir\")) # file marker that first part has finished
382381
while length(readdir(raw\"$flag_start_dir\")) < $(Sys.CPU_THREADS)
383382
# sync all processes to start at the same time
384383
sleep(0.1)
385384
end
386-
t = Timer(15)
387-
while !isfile(raw\"$flag_end_file\") && (i <= 1000 || isopen(t))
385+
@async begin
386+
sleep(15)
387+
touch(raw\"$flag_end_file\")
388+
end
389+
i = 0
390+
while !isfile(raw\"$flag_end_file\")
388391
global i += 1
389392
try
390393
Pkg.Types.EnvCache()
@@ -393,6 +396,7 @@ temp_pkg_dir() do project_path
393396
println(stderr, \"Errored after $i iterations\")
394397
rethrow()
395398
end
399+
yield()
396400
end"`,
397401
stderr = iob, stdout = devnull))
398402
push!(tasks, t)

0 commit comments

Comments
 (0)