Revision 3a383ea77148445d51ca6838fec7578a570914db authored by Jeff Bezanson on 06 October 2021, 23:07:18 UTC, committed by Valentin Churavy on 13 October 2021, 19:02:35 UTC
(cherry picked from commit 2f00fe1d10eb54ee697abf09169b396b9264cb53)
1 parent c5ff713
Raw File
stress_fd_exec.jl
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Test
let ps = Pipe[]
    ulimit_n = tryparse(Int, readchomp(`sh -c 'ulimit -n'`))
    try
        for i = 1:100*something(ulimit_n, 1000)
            p = Pipe()
            Base.link_pipe!(p)
            push!(ps, p)
        end
        if ulimit_n === nothing
            @warn "`ulimit -n` is set to unlimited, fd exhaustion cannot be tested"
            @test_broken false
        else
            @test false
        end
    catch ex
        isa(ex, Base.IOError) || rethrow()
        @test ex.code in (Base.UV_EMFILE, Base.UV_ENFILE)
    finally
        foreach(close, ps)
    end
end
back to top