diff --git a/src/host/mapreduce.jl b/src/host/mapreduce.jl index 4a1283138..f5d301306 100644 --- a/src/host/mapreduce.jl +++ b/src/host/mapreduce.jl @@ -24,6 +24,12 @@ neutral_element(::typeof(Base.mul_prod), T) = one(T) neutral_element(::typeof(Base.min), T) = typemax(T) neutral_element(::typeof(Base.max), T) = typemin(T) neutral_element(::typeof(Base._extrema_rf), ::Type{<:NTuple{2,T}}) where {T} = typemax(T), typemin(T) +@static if isdefined(Base, :and_all) # VERSION >~ v"1.13-" + neutral_element(::typeof(Base.:(and_all)), T) = ~zero(T) +end +@static if isdefined(Base, :or_any) # VERSION >~ v"1.13-" + neutral_element(::typeof(Base.:(or_any)), T) = zero(T) +end # resolve ambiguities Base.mapreduce(f, op, A::AnyGPUArray, As::AbstractArrayOrBroadcasted...; diff --git a/test/runtests.jl b/test/runtests.jl index 1efbbcc94..abc81ee0b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -276,11 +276,11 @@ t1 = now() elapsed = canonicalize(Dates.CompoundPeriod(t1-t0)) println("Testing finished in $elapsed") +# construct a testset to render the test results +completed_tests = Set{String}() +o_ts = Test.DefaultTestSet("Overall") @static if VERSION < v"1.13.0-DEV.1044" - # construct a testset to render the test results - o_ts = Test.DefaultTestSet("Overall") Test.push_testset(o_ts) - completed_tests = Set{String}() for (testname, (resp,)) in results push!(completed_tests, testname) if isa(resp, Test.DefaultTestSet) @@ -349,10 +349,7 @@ println("Testing finished in $elapsed") throw(Test.FallbackTestSetException("Test run finished with errors")) end else - # construct a testset to render the test results - o_ts = Test.DefaultTestSet("Overall") Test.@with_testset o_ts begin - completed_tests = Set{String}() for (testname, (resp,)) in results push!(completed_tests, testname) if isa(resp, Test.DefaultTestSet) @@ -413,7 +410,14 @@ else end println() Test.print_test_results(o_ts, 1) - if !o_ts.anynonpass + + success = @static if VERSION < v"1.13.0-DEV.1044" + !o_ts.anynonpass + else + o_ts.anynonpass == 0x01 + end + + if success println(" \033[32;1mSUCCESS\033[0m") else println(" \033[31;1mFAILURE\033[0m\n") diff --git a/test/setup.jl b/test/setup.jl index ea0945b28..3fa69f848 100644 --- a/test/setup.jl +++ b/test/setup.jl @@ -4,15 +4,16 @@ include("testsuite.jl") using Random +@static if VERSION >= v"1.13.0-DEV.1044" + using Base.ScopedValues +end ## entry point function runtests(f, name) - old_print_setting = Test.TESTSET_PRINT_ENABLE[] @static if VERSION < v"1.13.0-DEV.1044" + old_print_setting = Test.TESTSET_PRINT_ENABLE[] Test.TESTSET_PRINT_ENABLE[] = false - else - Test.TESTSET_PRINT_ENABLE[] => false end try @@ -34,7 +35,11 @@ function runtests(f, name) $f() end end - data = Core.eval(mod, ex) + data = @static if VERSION < v"1.13.0-DEV.1044" + Core.eval(mod, ex) + else + @with Test.TESTSET_PRINT_ENABLE => false Core.eval(mod, ex) + end #data[1] is the testset # process results @@ -62,8 +67,6 @@ function runtests(f, name) finally @static if VERSION < v"1.13.0-DEV.1044" Test.TESTSET_PRINT_ENABLE[] = old_print_setting - else - Test.TESTSET_PRINT_ENABLE[] => old_print_setting end end end