Skip to content

Commit db8a597

Browse files
committed
Add serialization test support for perf results
1 parent 185f645 commit db8a597

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/SerializationTests.jl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
module SerializationTests
22

3-
using BenchmarkTools
3+
using BenchmarkTools, LinuxPerf
44
using Test
55

66
function eq(x::T, y::T) where {T<:Union{values(BenchmarkTools.SUPPORTED_TYPES)...}}
77
return all(i -> eq(getfield(x, i), getfield(y, i)), 1:fieldcount(T))
88
end
9+
eq(x::String, y::String) = x == y
10+
eq(x::NTuple{3,Bool}, y::NTuple{3,Bool}) = x == y
11+
function eq(x::LinuxPerf.Stats, y::LinuxPerf.Stats)
12+
return all(a -> eq(a[1], a[2]), zip(x.threads, y.threads))
13+
end
14+
function eq(x::LinuxPerf.ThreadStats, y::LinuxPerf.ThreadStats)
15+
return x.pid == y.pid && x.groups == y.groups
16+
end
17+
eq(x::Nothing, y) = isnothing(y)
18+
eq(x, y::Nothing) = isnothing(x)
19+
eq(x::Nothing, y::Nothing) = true
920
eq(x::T, y::T) where {T} = isapprox(x, y)
1021

1122
function withtempdir(f::Function)

0 commit comments

Comments
 (0)