Skip to content

Commit

Permalink
Move supported check to runtests.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
christiangnrd committed Dec 26, 2024
1 parent ef8ca82 commit 6590bcf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
22 changes: 22 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
using Distributed
using Dates
using Metal
using Printf: @sprintf
import REPL
using Test

# Quit without erroring if Metal loaded without issues on unsupported platforms
if !Sys.isapple()
@info """Metal.jl succesfully loaded on non-macOS system.
Skipping tests."""
Sys.exit()
else # if Sys.isapple()
archchecker = occursin(read(`xcrun metal-arch --name`, String))
if archchecker("Paravirtual") # Virtualized graphics (probably Github Actions runners)
@info """Metal.jl succesfully loaded on macOS system with unsupported Paravirtual graphics.
Skipping tests."""
Sys.exit()
elseif !archchecker("applegpu") # Every other unsupported system (Intel or AMD graphics)
@info """Metal.jl succesfully loaded on macOS system with unsupported graphics.
Skipping tests."""
Sys.exit()
end
end

# If we ever error here, fix above
Metal.functional() || error("Metal.jl is not functional on this system")

# parse some command-line arguments
function extract_flag!(args, flag, default=nothing)
for f in args
Expand Down
21 changes: 0 additions & 21 deletions test/setup.jl
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
using Distributed, Test, Metal, Adapt, ObjectiveC, ObjectiveC.Foundation

# Quit without erroring if Metal loaded without issues on unsupported platforms
if !Sys.isapple()
@info """Metal.jl succesfully loaded on non-macOS system.
Skipping tests."""
Sys.exit()
else # if Sys.isapple()
archchecker = occursin(read(`xcrun metal-arch --name`, String))
if archchecker("Paravirtual") # Virtualized graphics (probably Github Actions runners)
@info """Metal.jl succesfully loaded on macOS system with unsupported Paravirtual graphics.
Skipping tests."""
Sys.exit()
elseif !archchecker("applegpu") # Every other unsupported system (Intel or AMD graphics)
@info """Metal.jl succesfully loaded on macOS system with unsupported graphics.
Skipping tests."""
Sys.exit()
end
end

# If we ever error here, fix above
Metal.functional() || error("Metal.jl is not functional on this system")

# GPUArrays has a testsuite that isn't part of the main package.
# Include it directly.
import GPUArrays
Expand Down

0 comments on commit 6590bcf

Please sign in to comment.