From b5233e219c07fbf98713a0335f8179cda5cd034f Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Wed, 27 Mar 2024 14:44:33 +0100 Subject: [PATCH] Re-enable profiling tests on M1/14.4 when using Xcode 15.3. (#322) --- test/profiling.jl | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/test/profiling.jl b/test/profiling.jl index 76eaa9636..9d2b53b15 100644 --- a/test/profiling.jl +++ b/test/profiling.jl @@ -1,25 +1,37 @@ @testset "profiling" begin -if MTL.is_m1(current_device()) && macos_version() >= v"14.4" -@warn "Skipping profiling tests because of an M1-related bug on macOS 14.4" +# determine if we can even run these tests +run_tests = false +if parse(Bool, get(ENV, "CI", "false")) + @warn "Skipping profiling tests on CI due to sandboxing issues" +elseif !success(`xctrace version`) + @warn "Skipping profiling tests because xctrace is not available; please install Xcode first" else + version_output = chomp(read(`xctrace version`, String)) + m = match(r"xctrace version (\d+).(\d+)", version_output) + if m === nothing + error("Could not parse xctrace version output:\n$version_output") + else + xcode_version = VersionNumber(parse(Int, m.captures[1]), parse(Int, m.captures[2])) + if MTL.is_m1(current_device()) && macos_version() >= v"14.4" && xcode_version < v"15.3" + @warn "Skipping profiling tests because of an M1-related bug on macOS 14.4 and Xcode < 15.3; please upgrade Xcode first" + else + run_tests = true + end + end +end +if run_tests mktempdir() do tmpdir cd(tmpdir) do -if parse(Bool, get(ENV, "CI", "false")) -@warn "Skipping profiling tests on CI due to sandboxing issues" -else - @testset "macro" begin Metal.@profile identity(nothing) @test isdir("julia_1.trace") end end - -end - end end + end