Skip to content

Do not put project stdlibs into the base (non-incremental) sysimage #987

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

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/PackageCompiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ function create_sysimage(packages::Union{Nothing, Symbol, Vector{String}, Vector
if base_sysimage !== nothing
error("cannot specify `base_sysimage` when `incremental=false`")
end
sysimage_stdlibs = filter_stdlibs ? gather_stdlibs_project(ctx) : stdlibs_in_sysimage()
sysimage_stdlibs = filter_stdlibs ? String[] : stdlibs_in_sysimage()
base_sysimage = create_fresh_base_sysimage(sysimage_stdlibs; cpu_target, sysimage_build_args)
else
base_sysimage = something(base_sysimage, unsafe_string(Base.JLOptions().image_file))
Expand Down
90 changes: 26 additions & 64 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ const is_slow_ci = is_ci && Sys.ARCH == :aarch64 && !Sys.isapple()

const is_julia_1_6 = VERSION.major == 1 && VERSION.minor == 6
const is_julia_1_9 = VERSION.major == 1 && VERSION.minor == 9
const is_julia_1_11 = VERSION.major == 1 && VERSION.minor == 11
const is_julia_1_12 = VERSION.major == 1 && VERSION.minor == 12

if is_ci || is_gha_ci
@info "This is a CI job" Sys.ARCH VERSION is_ci is_gha_ci
Expand All @@ -46,8 +44,6 @@ end
const jlver_some_tests_skipped = [
is_julia_1_6,
is_julia_1_9,
is_julia_1_11,
is_julia_1_12,
]

if any(jlver_some_tests_skipped)
Expand Down Expand Up @@ -107,18 +103,6 @@ end
end
@testset for incremental in incrementals_list
if incremental == false
if is_gha_ci && (is_julia_1_11 || is_julia_1_12)
# On Julia 1.11 and 1.12, `incremental=false` is currently broken.
# 1.11: https://github.com/JuliaLang/PackageCompiler.jl/issues/976
# 1.12: No GitHub issue yet.
# So, for now, we skip the `incremental=false` tests on Julia 1.11 and 1.12
# But ONLY on GHA (GitHub Actions).
# On PkgEval, we do run these tests. This is intentional - we want PkgEval to
# detect regressions, as well as fixes for those regressions.
@warn "[GHA CI] This is Julia $(VERSION.major).$(VERSION.minor); skipping incremental=false test due to known bug: #976 (for 1.11), issue TODO (for 1.12)"
@test_skip false
continue
end
if is_slow_ci
@warn "Skipping the (incremental=false, filter_stdlibs=false) test because this is \"slow CI\""
@test_skip false
Expand Down Expand Up @@ -226,58 +210,36 @@ end
end # testset

if !is_slow_ci
if is_gha_ci && is_julia_1_12
# On Julia 1.12, `incremental=false` is currently broken when doing `create_library()`.
# 1.12: No GitHub issue yet.
# So, for now, we skip the `incremental=false` tests on Julia 1.12 when doing `create_library()`.
# But ONLY on GHA (GitHub Actions).
# On PkgEval, we do run these tests. This is intentional - we want PkgEval to
# detect regressions, as well as fixes for those regressions.
@warn "[GHA CI] This is Julia $(VERSION.major).$(VERSION.minor); skipping incremental=false test when doing `create_library()` due to known bug: issue TODO (for 1.12)"
@test_skip false
else
# Test library creation
lib_source_dir = joinpath(@__DIR__, "..", "examples/MyLib")
lib_target_dir = joinpath(tmp, "MyLibCompiled")

# This is why we have to skip this test on 1.12:
incremental = false

filter = true
lib_name = "inc"

tmp_lib_src_dir = joinpath(tmp, "MyLib")
cp(lib_source_dir, tmp_lib_src_dir)
create_library(tmp_lib_src_dir, lib_target_dir; incremental=incremental, force=true, filter_stdlibs=filter,
precompile_execution_file=joinpath(lib_source_dir, "build", "generate_precompile.jl"),
precompile_statements_file=joinpath(lib_source_dir, "build", "additional_precompile.jl"),
lib_name=lib_name, version=v"1.0.0")
rm(tmp_lib_src_dir; recursive=true)
end
# Test library creation
lib_source_dir = joinpath(@__DIR__, "..", "examples/MyLib")
lib_target_dir = joinpath(tmp, "MyLibCompiled")

# This is why we have to skip this test on 1.12:
incremental = false

filter = true
lib_name = "inc"

tmp_lib_src_dir = joinpath(tmp, "MyLib")
cp(lib_source_dir, tmp_lib_src_dir)
create_library(tmp_lib_src_dir, lib_target_dir; incremental=incremental, force=true, filter_stdlibs=filter,
precompile_execution_file=joinpath(lib_source_dir, "build", "generate_precompile.jl"),
precompile_statements_file=joinpath(lib_source_dir, "build", "additional_precompile.jl"),
lib_name=lib_name, version=v"1.0.0")
rm(tmp_lib_src_dir; recursive=true)
end

# Test creating an empty sysimage
if !is_slow_ci
if is_gha_ci && is_julia_1_12
# On Julia 1.12, `incremental=false` is currently broken when doing `create_library()`.
# 1.12: No GitHub issue yet.
# So, for now, we skip the `incremental=false` tests on Julia 1.12 when doing `create_library()`.
# But ONLY on GHA (GitHub Actions).
# On PkgEval, we do run these tests. This is intentional - we want PkgEval to
# detect regressions, as well as fixes for those regressions.
@warn "[GHA CI] This is Julia $(VERSION.major).$(VERSION.minor); skipping incremental=false test when doing `create_library()` due to known bug: issue TODO (for 1.12)"
@test_skip false
else
tmp = mktempdir()
sysimage_path = joinpath(tmp, "empty." * Libdl.dlext)
foreach(x -> touch(joinpath(tmp, x)), ["Project.toml", "Manifest.toml"])
tmp = mktempdir()
sysimage_path = joinpath(tmp, "empty." * Libdl.dlext)
foreach(x -> touch(joinpath(tmp, x)), ["Project.toml", "Manifest.toml"])

# This is why we need to skip this test on 1.12:
incremental=false

create_sysimage(String[]; sysimage_path=sysimage_path, incremental=incremental, filter_stdlibs=true, project=tmp)
hello = read(`$(Base.julia_cmd()) -J $(sysimage_path) -e 'print("hello, world")'`, String)
@test hello == "hello, world"
end
# This is why we need to skip this test on 1.12:
incremental=false

create_sysimage(String[]; sysimage_path=sysimage_path, incremental=incremental, filter_stdlibs=true, project=tmp)
hello = read(`$(Base.julia_cmd()) -J $(sysimage_path) -e 'print("hello, world")'`, String)
@test hello == "hello, world"
end
end
Loading