Skip to content

Conversation

@vchuravy
Copy link
Member

Currently struggling with the fact that nested macros and interpolation are a pain

@vchuravy vchuravy marked this pull request as ready for review October 15, 2025 21:36
end
catch err
isa(err, Test.TestSetException) || rethrow()
function execute(::Type{TestRecord}, mod, f, name, color, custom_args)::TestRecord
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The split here is so that the execute is the only function you need to customize.


function runtest(RecordType::Type{<:AbstractTestRecord}, f, name, init_code, color, custom_args)
# generate a temporary module to execute the tests in
mod = Core.eval(Main, Expr(:module, true, gensym(name), Expr(:block)))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this isn't in the custom_record_init anymore we can write it again as:

Suggested change
mod = Core.eval(Main, Expr(:module, true, gensym(name), Expr(:block)))
mod = @eval(Main, module $(gensym(name)) end)

stats = redirect_stdio(stdout=io, stderr=io) do
@timed try
# Since we are in a double quote we need to use this form to escape `$`
if $(Expr(:$, :say_hello))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked with Jeff in person about this, and it is seems to be the "right way".

@vchuravy vchuravy requested review from Copilot and maleadt and removed request for Copilot October 16, 2025 01:40
# entry point
#

function runtest(::Type{TestRecord}, f, name, init_code, color)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we passing color here?

custom_record_init = quote
import ParallelTestRunner: Test
struct CustomTestRecord <: ParallelTestRunner.AbstractTestRecord
# TODO: Would it be better to wrap "ParallelTestRunner.TestRecord "
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maleadt this is probably the biggest open design question.

@vchuravy
Copy link
Member Author

In https://github.com/JuliaGPU/OpenCL.jl/blob/cdff90d17f662e2746940e42d7997d3d99cc995c/test/runtests.jl#L9 I show how to extract a custom command line flag, but what is missing right now is some sort of --help.

@vchuravy
Copy link
Member Author

Looking at CUDA.jl the missing features I am seeing are:

  • Custom command line argument help
  • Prioritization of core/initialization test
  • Parallelism adjustment based on GPU memory
  • exename adjustment for sanitizer
  • On worker recylce, accumulation into TimerOutputs

"""
function runtests(mod::Module, ARGS; test_filter = Returns(true), RecordType = TestRecord,
custom_tests::Dict{String, Expr}=Dict{String, Expr}(), init_code = :(),
custom_tests::Dict{String, Expr}=Dict{String, Expr}(), init_code = :(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated whitespace change

Suggested change
custom_tests::Dict{String, Expr}=Dict{String, Expr}(), init_code = :(),
custom_tests::Dict{String, Expr}=Dict{String, Expr}(), init_code = :(),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants