Skip to content

Commit 1106085

Browse files
Fixes for Julia nightly (#624)
* Nightly test runner fixes * `and_all` and `or_any` * Formatting * Factor out common code
1 parent 3be4a09 commit 1106085

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

src/host/mapreduce.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ neutral_element(::typeof(Base.mul_prod), T) = one(T)
2424
neutral_element(::typeof(Base.min), T) = typemax(T)
2525
neutral_element(::typeof(Base.max), T) = typemin(T)
2626
neutral_element(::typeof(Base._extrema_rf), ::Type{<:NTuple{2,T}}) where {T} = typemax(T), typemin(T)
27+
@static if isdefined(Base, :and_all) # VERSION >~ v"1.13-"
28+
neutral_element(::typeof(Base.:(and_all)), T) = ~zero(T)
29+
end
30+
@static if isdefined(Base, :or_any) # VERSION >~ v"1.13-"
31+
neutral_element(::typeof(Base.:(or_any)), T) = zero(T)
32+
end
2733

2834
# resolve ambiguities
2935
Base.mapreduce(f, op, A::AnyGPUArray, As::AbstractArrayOrBroadcasted...;

test/runtests.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,11 @@ t1 = now()
276276
elapsed = canonicalize(Dates.CompoundPeriod(t1-t0))
277277
println("Testing finished in $elapsed")
278278

279+
# construct a testset to render the test results
280+
completed_tests = Set{String}()
281+
o_ts = Test.DefaultTestSet("Overall")
279282
@static if VERSION < v"1.13.0-DEV.1044"
280-
# construct a testset to render the test results
281-
o_ts = Test.DefaultTestSet("Overall")
282283
Test.push_testset(o_ts)
283-
completed_tests = Set{String}()
284284
for (testname, (resp,)) in results
285285
push!(completed_tests, testname)
286286
if isa(resp, Test.DefaultTestSet)
@@ -349,10 +349,7 @@ println("Testing finished in $elapsed")
349349
throw(Test.FallbackTestSetException("Test run finished with errors"))
350350
end
351351
else
352-
# construct a testset to render the test results
353-
o_ts = Test.DefaultTestSet("Overall")
354352
Test.@with_testset o_ts begin
355-
completed_tests = Set{String}()
356353
for (testname, (resp,)) in results
357354
push!(completed_tests, testname)
358355
if isa(resp, Test.DefaultTestSet)
@@ -413,7 +410,14 @@ else
413410
end
414411
println()
415412
Test.print_test_results(o_ts, 1)
416-
if !o_ts.anynonpass
413+
414+
success = @static if VERSION < v"1.13.0-DEV.1044"
415+
!o_ts.anynonpass
416+
else
417+
o_ts.anynonpass == 0x01
418+
end
419+
420+
if success
417421
println(" \033[32;1mSUCCESS\033[0m")
418422
else
419423
println(" \033[31;1mFAILURE\033[0m\n")

test/setup.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ include("testsuite.jl")
44

55
using Random
66

7+
@static if VERSION >= v"1.13.0-DEV.1044"
8+
using Base.ScopedValues
9+
end
710

811
## entry point
912

1013
function runtests(f, name)
11-
old_print_setting = Test.TESTSET_PRINT_ENABLE[]
1214
@static if VERSION < v"1.13.0-DEV.1044"
15+
old_print_setting = Test.TESTSET_PRINT_ENABLE[]
1316
Test.TESTSET_PRINT_ENABLE[] = false
14-
else
15-
Test.TESTSET_PRINT_ENABLE[] => false
1617
end
1718

1819
try
@@ -34,7 +35,11 @@ function runtests(f, name)
3435
$f()
3536
end
3637
end
37-
data = Core.eval(mod, ex)
38+
data = @static if VERSION < v"1.13.0-DEV.1044"
39+
Core.eval(mod, ex)
40+
else
41+
@with Test.TESTSET_PRINT_ENABLE => false Core.eval(mod, ex)
42+
end
3843
#data[1] is the testset
3944

4045
# process results
@@ -62,8 +67,6 @@ function runtests(f, name)
6267
finally
6368
@static if VERSION < v"1.13.0-DEV.1044"
6469
Test.TESTSET_PRINT_ENABLE[] = old_print_setting
65-
else
66-
Test.TESTSET_PRINT_ENABLE[] => old_print_setting
6770
end
6871
end
6972
end

0 commit comments

Comments
 (0)