Repository: JuliaLang/julia
File: base/util.jl (Julia)

Code before:
                  exit_on_error::Bool=false,
                  revise::Bool=false,
                  propagate_project::Bool=false,
                  seed::Union{BitInteger,Nothing}=nothing,
                  julia_args::Cmd=``)
    if isa(tests,AbstractString)
        tests = split(tests)
    end
    exit_on_error && push!(tests, "--exit-on-error")
    revise && push!(tests, "--revise")
    seed !== nothing && push!(tests, "--seed=0x$(string(seed % UInt128, base=16))") # cast to UInt128 to avoid a minus sign
    ENV2 = copy(ENV)
    ENV2["JULIA_CPU_THREADS"] = "$ncores"
    pathsep = Sys.iswindows() ? ";" : ":"
    ENV2["JULIA_DEPOT_PATH"] = string(mktempdir(; cleanup = true), pathsep) # make sure the default depots can be loaded
    ENV2["JULIA_LOAD_PATH"] = string("@", pathsep, "@stdlib")
    ENV2["JULIA_TESTS"] = "true"
    delete!(ENV2, "JULIA_PROJECT")
    project_flag = propagate_project ? `--project` : ``
    try
        run(setenv(`$(julia_cmd()) $julia_args $project_flag $(joinpath(Sys.BINDIR,
            Base.DATAROOTDIR, "julia", "test", "runtests.jl")) $tests`, ENV2))
        nothing
    catch
        # evaluate versioninfo in the test environment so the listed env vars are the same
        vinfo = read(setenv(`$(julia_cmd()) -e 'let InteractiveUtils = Base.require_stdlib(Base.PkgId(Base.UUID(0xb77e0a4c_d291_57a0_90e8_8db25a27a240), "InteractiveUtils")); InteractiveUtils.versioninfo(); end'`, ENV2), String)
        msg = "A test has failed. Please submit a bug report (https://github.com/JuliaLang/julia/issues)\n" *
              "including error messages above and the output of versioninfo():\n$(vinfo)"
        if isinteractive()
            error(msg)
        else
            print(stderr, "ERROR: ", msg)
            exit(1)
        end
    end
end

"""
    isdebugbuild()

Return `true` if julia is a debug version.
"""
function isdebugbuild()
    return ccall(:jl_is_debugbuild, Cint, ()) != 0
end


Review comment (suggestion):
```suggestion
        vinfo = read(setenv(`$(julia_cmd()) -e 'let InteractiveUtils = Base.require_stdlib(Base.PkgId(Base.UUID(0xb77e0a4c_d291_57a0_90e8_8db25a27a240), "InteractiveUtils")); @invokelatest(InteractiveUtils.versioninfo()); end'`, ENV2), String)
```


Code after:
                  exit_on_error::Bool=false,
                  revise::Bool=false,
                  propagate_project::Bool=false,
                  seed::Union{BitInteger,Nothing}=nothing,
                  julia_args::Cmd=``)
    if isa(tests,AbstractString)
        tests = split(tests)
    end
    exit_on_error && push!(tests, "--exit-on-error")
    revise && push!(tests, "--revise")
    seed !== nothing && push!(tests, "--seed=0x$(string(seed % UInt128, base=16))") # cast to UInt128 to avoid a minus sign
    ENV2 = copy(ENV)
    ENV2["JULIA_CPU_THREADS"] = "$ncores"
    pathsep = Sys.iswindows() ? ";" : ":"
    ENV2["JULIA_DEPOT_PATH"] = string(mktempdir(; cleanup = true), pathsep) # make sure the default depots can be loaded
    ENV2["JULIA_LOAD_PATH"] = string("@", pathsep, "@stdlib")
    ENV2["JULIA_TESTS"] = "true"
    delete!(ENV2, "JULIA_PROJECT")
    project_flag = propagate_project ? `--project` : ``
    try
        run(setenv(`$(julia_cmd()) $julia_args $project_flag $(joinpath(Sys.BINDIR,
            Base.DATAROOTDIR, "julia", "test", "runtests.jl")) $tests`, ENV2))
        nothing
    catch
        # evaluate versioninfo in the test environment so the listed env vars are the same
        vinfo = read(setenv(`$(julia_cmd()) -e 'let InteractiveUtils = Base.require_stdlib(Base.PkgId(Base.UUID(0xb77e0a4c_d291_57a0_90e8_8db25a27a240), "InteractiveUtils")); @invokelatest(InteractiveUtils.versioninfo()); end'`, ENV2), String)
        msg = "A test has failed. Please submit a bug report (https://github.com/JuliaLang/julia/issues)\n" *
              "including error messages above and the output of versioninfo():\n$(vinfo)"
        if isinteractive()
            error(msg)
        else
            print(stderr, "ERROR: ", msg)
            exit(1)
        end
    end
end

"""
    isdebugbuild()

Return `true` if julia is a debug version.
"""
function isdebugbuild()
    return ccall(:jl_is_debugbuild, Cint, ()) != 0
end