Skip to content
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 .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ steps:
end

println("+++ :julia: Running tests")
Pkg.test(; coverage=true)'
Pkg.test(; coverage=true, test_args=`--platform cuda`)'
agents:
queue: "juliagpu"
cuda: "*"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
Pkg.develop(path="lib/intrinsics")
end'
- uses: julia-actions/julia-runtest@v1
with:
test_args: '--platform pocl'
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
with:
Expand Down
8 changes: 6 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if do_help
--list List all available tests.
--quickfail Fail the entire run as soon as a single test errored.
--jobs=N Launch `N` processes to perform tests (default: Sys.CPU_THREADS).
--platform=NAME Run tests on the platform named `NAME` (default: all platforms).

Remaining arguments filter the tests that will be executed.""")
exit(0)
Expand Down Expand Up @@ -99,6 +100,8 @@ if do_list
end
exit(0)
end
## --platform selector
do_platform, platform = extract_flag!(ARGS, "--platform", nothing)
## no options should remain
optlike_args = filter(startswith("-"), ARGS)
if !isempty(optlike_args)
Expand Down Expand Up @@ -245,8 +248,9 @@ try
# run the test
running_tests[test] = now()
try

resp = remotecall_fetch(runtests, wrkr, test_runners[test], test)
resp = remotecall_fetch(runtests, wrkr,
test_runners[test], test,
platform)
catch e
isa(e, InterruptException) && return
resp = Any[e]
Expand Down
29 changes: 25 additions & 4 deletions test/setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,33 @@ using Random

## entry point

function runtests(f, name)
const targets = []

function runtests(f, name, platform_filter)
old_print_setting = Test.TESTSET_PRINT_ENABLE[]
Test.TESTSET_PRINT_ENABLE[] = false

if isempty(targets)
for platform in cl.platforms(),
device in cl.devices(platform)
if platform_filter !== nothing
# filter on the name or vendor
names = lowercase.([platform.name, platform.vendor])
if !any(contains(platform_filter), names)
continue
end
end
push!(targets, (; platform, device))
end
if isempty(targets)
if platform_filter === nothing
throw(ArgumentError("No OpenCL platforms found"))
else
throw(ArgumentError("No OpenCL platforms found matching $platform_filter"))
end
end
end

try
# generate a temporary module to execute the tests in
mod_name = Symbol("Test", rand(1:100), "Main_", replace(name, '/' => '_'))
Expand All @@ -76,9 +99,7 @@ function runtests(f, name)
OpenCL.allowscalar(false)

@timed @testset $"$name" begin
@testset "\$(device.name)" for platform in cl.platforms(),
device in cl.devices(platform)

@testset "\$(device.name)" for (; platform, device) in $targets
cl.platform!(platform)
cl.device!(device)

Expand Down
Loading