Skip to content

Commit 3ad45e2

Browse files
Test suite: Assume compatible system if xcode not installed (#539)
1 parent f3549a4 commit 3ad45e2

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

test/runtests.jl

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,24 @@ if !Sys.isapple()
1212
Skipping tests."""
1313
Sys.exit()
1414
else # if Sys.isapple()
15-
archchecker = occursin(read(`xcrun metal-arch --name`, String))
16-
if archchecker("Paravirtual") # Virtualized graphics (probably Github Actions runners)
17-
@warn """Metal.jl succesfully loaded on macOS system with unsupported Paravirtual graphics.
18-
This system is unsupported but should still load.
19-
Skipping tests."""
20-
Sys.exit()
21-
elseif !archchecker("applegpu") # Every other unsupported system (Intel or AMD graphics)
22-
@warn """Metal.jl succesfully loaded on macOS system with unsupported graphics.
23-
This system is unsupported but should still load.
24-
Skipping tests."""
25-
Sys.exit()
15+
cmd = pipeline(Cmd(`xcrun -f metal-arch`, ignorestatus = true), stdout = devnull, stderr = devnull)
16+
is_xcode_present = run(cmd).exitcode == 0
17+
18+
if is_xcode_present
19+
archchecker = occursin(read(`xcrun metal-arch --name`, String))
20+
if archchecker("Paravirtual") # Virtualized graphics (probably Github Actions runners)
21+
@warn """Metal.jl succesfully loaded on macOS system with unsupported Paravirtual graphics.
22+
This system is unsupported but should still load.
23+
Skipping tests."""
24+
Sys.exit()
25+
elseif !archchecker("applegpu") # Every other unsupported system (Intel or AMD graphics)
26+
@warn """Metal.jl succesfully loaded on macOS system with unsupported graphics.
27+
This system is unsupported but should still load.
28+
Skipping tests."""
29+
Sys.exit()
30+
end
31+
else
32+
@info "GPU architecture could not be detected, assuming supported device."
2633
end
2734
end
2835

0 commit comments

Comments
 (0)