-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add a testsuite for inference caching #567
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8109be1
Add a testsuite for inference caching
vchuravy 76505a0
fixup! Add a testsuite for inference caching
vchuravy ef449c4
write package out to disk
vchuravy f25773e
Handle foreign CI
vchuravy 1fe1867
Also test PTX
vchuravy af34689
fixup! Also test PTX
vchuravy f62f940
fixup! Also test PTX
vchuravy 90e90ab
fixup! Also test PTX
vchuravy 9f3fb47
Test no longer runs in isolation
vchuravy 268d891
Don't run tests on 1.9&co
vchuravy aaab1b3
fixup the testsetup logic
vchuravy 97594ea
fixup! fixup the testsetup logic
vchuravy 090a952
fixup! fixup! fixup the testsetup logic
vchuravy 86211b2
don't define runtime_module twice
vchuravy 1b35376
breakup precompilation tests into their own testitem
vchuravy d786ac6
filter in runtests
vchuravy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
@testsetup module Precompile | ||
|
||
using Test | ||
using ReTestItems | ||
|
||
export precompile_test_harness, check_presence, create_standalone | ||
|
||
function precompile_test_harness(@nospecialize(f), testset::String) | ||
@testset "$testset" begin | ||
precompile_test_harness(f, true) | ||
end | ||
end | ||
function precompile_test_harness(@nospecialize(f), separate::Bool) | ||
load_path = mktempdir() | ||
load_cache_path = separate ? mktempdir() : load_path | ||
try | ||
pushfirst!(LOAD_PATH, load_path) | ||
pushfirst!(DEPOT_PATH, load_cache_path) | ||
f(load_path) | ||
finally | ||
try | ||
rm(load_path, force=true, recursive=true) | ||
catch err | ||
@show err | ||
end | ||
if separate | ||
try | ||
rm(load_cache_path, force=true, recursive=true) | ||
catch err | ||
@show err | ||
end | ||
end | ||
filter!((≠)(load_path), LOAD_PATH) | ||
separate && filter!((≠)(load_cache_path), DEPOT_PATH) | ||
end | ||
nothing | ||
end | ||
|
||
function check_presence(mi, token) | ||
found = false | ||
ci = isdefined(mi, :cache) ? mi.cache : nothing | ||
while ci !== nothing | ||
if ci.owner === token && ci.max_world == typemax(UInt) | ||
found = true | ||
break | ||
end | ||
ci = isdefined(ci, :next) ? ci.next : nothing | ||
end | ||
return found | ||
end | ||
|
||
function create_standalone(load_path, name::String, file) | ||
cp(joinpath(@__DIR__, "runtime.jl"), joinpath(load_path, "runtime.jl"), force=true) | ||
|
||
TS = include(file) | ||
code = TS.code | ||
if code.head == :begin | ||
code.head = :block | ||
end | ||
@assert code.head == :block | ||
code = Expr(:module, true, Symbol(name), code) | ||
|
||
# Write out the test setup as a micro package | ||
write(joinpath(load_path, "$name.jl"), string(code)) | ||
Base.compilecache(Base.PkgId(name)) | ||
end | ||
|
||
end # testsetup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't do things without drinking coffee first. This should needs a version bound to limit it for 1.11.
In 1.11-beta2 it should not be necessary anymore