File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,30 @@ 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
367+ tasks = Task[]
368+ iobs = IOBuffer[]
369+ Sys. CPU_THREADS == 1 && error (" Cannot test for atomic usage log file interaction effectively with only Sys.CPU_THREADS=1" )
370+ for i in 1 : Sys. CPU_THREADS
371+ iob = IOBuffer ()
372+ t = @async run (pipeline (` $(Base. julia_cmd ())
373+ --project="$(pkgdir (Pkg)) "
374+ -e "import Pkg; t = Timer(10); while isopen(t) Pkg.activate(temp = true); Pkg.Types.EnvCache(); end"` ,
375+ stderr = iob, stdout = devnull ))
376+ push! (tasks, t)
377+ push! (iobs, iob)
378+ end
379+ for i in eachindex (tasks)
380+ try
381+ fetch (tasks[i]) # If any of these failed it will throw when fetched
382+ catch
383+ print (String (take! (iobs[i])))
384+ break
385+ end
386+ end
387+ @test any (istaskfailed, tasks) == false
388+ end
389+
366390 @testset " adding nonexisting packages" begin
367391 nonexisting_pkg = randstring (14 )
368392 @test_throws PkgError Pkg. add (nonexisting_pkg)
You can’t perform that action at this time.
0 commit comments