Skip to content

Commit

Permalink
Fix codegen test on debug version (JuliaLang#46065)
Browse files Browse the repository at this point in the history
* test: fix codegen debug lib name

* test: skip some codegen tests in debug version
  • Loading branch information
inkydragon committed Jul 18, 2022
1 parent 820c08b commit 82c3a6f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/compiler/codegen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ const opt_level = Base.JLOptions().opt_level
const coverage = (Base.JLOptions().code_coverage > 0) || (Base.JLOptions().malloc_log > 0)
const Iptr = sizeof(Int) == 8 ? "i64" : "i32"

const is_debug_build = ccall(:jl_is_debugbuild, Cint, ()) != 0
function libjulia_codegen_name()
is_debug_build ? "libjulia-codegen-debug" : "libjulia-codegen"
end

# `_dump_function` might be more efficient but it doesn't really matter here...
get_llvm(@nospecialize(f), @nospecialize(t), raw=true, dump_module=false, optimize=true) =
sprint(code_llvm, f, t, raw, dump_module, optimize)

if opt_level > 0
if !is_debug_build && opt_level > 0
# Make sure getptls call is removed at IR level with optimization on
@test !occursin(" call ", get_llvm(identity, Tuple{String}))
end
Expand Down Expand Up @@ -104,7 +109,7 @@ function test_jl_dump_llvm_opt()
end
end

if opt_level > 0
if !is_debug_build && opt_level > 0
# Make sure `jl_string_ptr` is inlined
@test !occursin(" call ", get_llvm(jl_string_ptr, Tuple{String}))
# Make sure `Core.sizeof` call is inlined
Expand Down Expand Up @@ -675,10 +680,11 @@ U41096 = Term41096{:U}(Modulate41096(:U, false))

@test !newexpand41096((t=t41096, μ=μ41096, U=U41096), :U)


# test that we can start julia with libjulia-codegen removed; PR #41936
mktempdir() do pfx
cp(dirname(Sys.BINDIR), pfx; force=true)
libpath = relpath(dirname(dlpath("libjulia-codegen")), dirname(Sys.BINDIR))
libpath = relpath(dirname(dlpath(libjulia_codegen_name())), dirname(Sys.BINDIR))
libs_deleted = 0
for f in filter(f -> startswith(f, "libjulia-codegen"), readdir(joinpath(pfx, libpath)))
rm(joinpath(pfx, libpath, f); force=true, recursive=true)
Expand Down

0 comments on commit 82c3a6f

Please sign in to comment.