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
6 changes: 6 additions & 0 deletions src/host/mapreduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...;
Expand Down
18 changes: 11 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
15 changes: 9 additions & 6 deletions test/setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading