Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DEPOT_PATH instead of HOME in cmdlineargs test #38855

Merged
merged 2 commits into from
Dec 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions test/cmdlineargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,10 @@ let exename = `$(Base.julia_cmd()) --startup-file=no`
println(ARGS)
""")
close(io)
mkpath(joinpath(dir, ".julia", "config"))
cp(testfile, joinpath(dir, ".julia", "config", "startup.jl"))
mkpath(joinpath(dir, "config"))
cp(testfile, joinpath(dir, "config", "startup.jl"))

withenv((Sys.iswindows() ? "USERPROFILE" : "HOME") => dir) do
withenv("JULIA_DEPOT_PATH" => dir) do
output = "[\"foo\", \"-bar\", \"--baz\"]"
@test readchomp(`$exename $testfile foo -bar --baz`) == output
@test readchomp(`$exename $testfile -- foo -bar --baz`) == output
Expand All @@ -485,7 +485,7 @@ let exename = `$(Base.julia_cmd()) --startup-file=no`

a = joinpath(dir, "a.jl")
b = joinpath(dir, "b.jl")
c = joinpath(dir, ".julia", "config", "startup.jl")
c = joinpath(dir, "config", "startup.jl")

write(a, """
println(@__FILE__)
Expand All @@ -501,7 +501,7 @@ let exename = `$(Base.julia_cmd()) --startup-file=no`

readsplit(cmd) = split(readchomp(cmd), '\n')

withenv((Sys.iswindows() ? "USERPROFILE" : "HOME") => dir) do
withenv("JULIA_DEPOT_PATH" => dir) do
@test readsplit(`$exename $a`) ==
[a, a,
b, a]
Expand Down Expand Up @@ -610,9 +610,9 @@ let exename = Base.julia_cmd()
# --startup-file
let JL_OPTIONS_STARTUPFILE_ON = 1,
JL_OPTIONS_STARTUPFILE_OFF = 2
# `HOME=$tmpdir` to avoid errors in the user startup.jl, which hangs the tests. Issue #17642
# `JULIA_DEPOT_PATH=$tmpdir` to avoid errors in the user startup.jl, which hangs the tests. Issue #17642
mktempdir() do tmpdir
withenv("HOME"=>tmpdir) do
withenv("JULIA_DEPOT_PATH"=>tmpdir) do
@test parse(Int,readchomp(`$exename -E "Base.JLOptions().startupfile" --startup-file=yes`)) == JL_OPTIONS_STARTUPFILE_ON
end
end
Expand Down