Skip to content

Commit 9a8a788

Browse files
authored
Mark tests broken based on nightly (#87)
* mark tests broken based on 1.9 nightly * run CI on 1.7 too * more, incl. overall testset
1 parent 4fca843 commit 9a8a788

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
version:
19+
- '1.7' # Lowest claimed support in Project.toml
1920
- '1' # Latest Release
2021
- 'nightly'
2122
os:

test/Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
1313
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1414

1515
[compat]
16-
ChainRules = "1.5"
17-
ChainRulesCore = "1.2"
16+
ChainRules = "1.44.5"
17+
ChainRulesCore = "1.15.3"
1818
Combinatorics = "1"
1919
StaticArrays = "1"
2020
StatsBase = "0.33"
21-
StructArrays = "0.6"
21+
StructArrays = "0.6.12"
2222
julia = "1.7"

test/runtests.jl

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ using ChainRulesCore
55
using ChainRulesCore: ZeroTangent, NoTangent, frule_via_ad, rrule_via_ad
66
using Symbolics
77
using LinearAlgebra
8-
98
using Test
109

10+
const fwd = Diffractor.PrimeDerivativeFwd
11+
const bwd = Diffractor.PrimeDerivativeBack
12+
13+
@testset verbose=true "Diffractor.jl" begin # overall testset, ensures all tests run
14+
1115
# Unit tests
1216
function tup2(f)
1317
a, b = ∂⃖{2}()(f, 1)
@@ -88,9 +92,9 @@ let var"'" = Diffractor.PrimeDerivativeBack
8892
@test @inferred(sin'(1.0)) == cos(1.0)
8993
@test @inferred(sin''(1.0)) == -sin(1.0)
9094
@test sin'''(1.0) == -cos(1.0)
91-
@test sin''''(1.0) == sin(1.0)
92-
@test sin'''''(1.0) == cos(1.0)
93-
@test sin''''''(1.0) == -sin(1.0)
95+
@test sin''''(1.0) == sin(1.0) broken = VERSION >= v"1.8"
96+
@test sin'''''(1.0) == cos(1.0) broken = VERSION >= v"1.8"
97+
@test sin''''''(1.0) == -sin(1.0) broken = VERSION >= v"1.8"
9498

9599
f_getfield(x) = getfield((x,), 1)
96100
@test f_getfield'(1) == 1
@@ -101,9 +105,9 @@ let var"'" = Diffractor.PrimeDerivativeBack
101105

102106
complicated_2sin(x) = (x = map(sin, Diffractor.xfill(x, 2)); x[1] + x[2])
103107
@test @inferred(complicated_2sin'(1.0)) == 2sin'(1.0)
104-
@test @inferred(complicated_2sin''(1.0)) == 2sin''(1.0)
105-
@test @inferred(complicated_2sin'''(1.0)) == 2sin'''(1.0)
106-
@test @inferred(complicated_2sin''''(1.0)) == 2sin''''(1.0)
108+
@test @inferred(complicated_2sin''(1.0)) == 2sin''(1.0) broken=true
109+
@test @inferred(complicated_2sin'''(1.0)) == 2sin'''(1.0) broken=true
110+
@test @inferred(complicated_2sin''''(1.0)) == 2sin''''(1.0) broken=true
107111

108112
# Control flow cases
109113
@test @inferred((x->simple_control_flow(true, x))'(1.0)) == sin'(1.0)
@@ -149,9 +153,6 @@ end
149153
# Regression tests
150154
@test gradient(x -> sum(abs2, x .+ 1.0), zeros(3))[1] == [2.0, 2.0, 2.0]
151155

152-
const fwd = Diffractor.PrimeDerivativeFwd
153-
const bwd = Diffractor.PrimeDerivativeBack
154-
155156
function f_broadcast(a)
156157
l = a / 2.0 * [[0. 1. 1.]; [1. 0. 1.]; [1. 1. 0.]]
157158
return sum(l)
@@ -161,7 +162,15 @@ end
161162
# Make sure that there's no infinite recursion in kwarg calls
162163
g_kw(;x=1.0) = sin(x)
163164
f_kw(x) = g_kw(;x)
164-
@test bwd(f_kw)(1.0) == bwd(sin)(1.0)
165+
@test bwd(f_kw)(1.0) == bwd(sin)(1.0) broken=true
166+
#=
167+
MethodError: no method matching +(::Tangent{var"#g_kw#47"{var"#g_kw#11#48"}, NamedTuple{(Symbol("#g_kw#11"),), Tuple{ZeroTangent}}}, ::Tangent{Diffractor.KwFunc{var"#g_kw#47"{var"#g_kw#11#48"}, var"#g_kw#47##kw"}, NamedTuple{(:kwf,), Tuple{ZeroTangent}}})
168+
...
169+
[2] elementwise_add(a::NamedTuple{(:contents,), Tuple{Tangent{var"#g_kw#47"{var"#g_kw#11#48"}, NamedTuple{(Symbol("#g_kw#11"),), Tuple{ZeroTangent}}}}}, b::NamedTuple{(:contents,), Tuple{Tangent{Diffractor.KwFunc{var"#g_kw#47"{var"#g_kw#11#48"}, var"#g_kw#47##kw"}, NamedTuple{(:kwf,), Tuple{ZeroTangent}}}}})
170+
@ ChainRulesCore ~/.julia/packages/ChainRulesCore/ctmSK/src/tangent_types/tangent.jl:287
171+
[3] +(a::Tangent{Core.Box, NamedTuple{(:contents,), Tuple{Tangent{var"#g_kw#47"{var"#g_kw#11#48"}, NamedTuple{(Symbol("#g_kw#11"),), Tuple{ZeroTangent}}}}}}, b::Tangent{Core.Box, NamedTuple{(:contents,), Tuple{Tangent{Diffractor.KwFunc{var"#g_kw#47"{var"#g_kw#11#48"}, var"#g_kw#47##kw"}, NamedTuple{(:kwf,), Tuple{ZeroTangent}}}}}})
172+
@ ChainRulesCore ~/.julia/packages/ChainRulesCore/ctmSK/src/tangent_arithmetic.jl:130
173+
=#
165174

166175
function f_crit_edge(a, b, c, x)
167176
# A function with two critical edges. This used to trigger an issue where
@@ -220,3 +229,5 @@ z45, delta45 = frule_via_ad(DiffractorRuleConfig(), (0,1), x -> log(exp(x)), 2)
220229

221230
# Higher order control flow not yet supported (https://github.com/JuliaDiff/Diffractor.jl/issues/24)
222231
#include("pinn.jl")
232+
233+
end # overall testset

0 commit comments

Comments
 (0)