Skip to content

Commit

Permalink
Fix tests that construct TrialContents
Browse files Browse the repository at this point in the history
Should be fine on 32 bit systems as we seem to always use Float64.
  • Loading branch information
Zentrik committed Dec 29, 2023
1 parent 07883ad commit 0ef2b49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,8 @@ function generate_benchmark_definition(
if $(params.experimental_enable_linux_perf)
# Based on https://github.com/JuliaPerf/LinuxPerf.jl/blob/a7fee0ff261a5b5ce7a903af7b38d1b5c27dd931/src/LinuxPerf.jl#L1043-L1061
__linux_perf_groups = BenchmarkTools.LinuxPerf.set_default_spaces(
$(params.linux_perf_options.events), $(params.linux_perf_options.spaces)
$(params.linux_perf_options.events),
$(params.linux_perf_options.spaces),
)
__linux_perf_bench = BenchmarkTools.LinuxPerf.make_bench_threaded(
__linux_perf_groups; threads=$(params.linux_perf_options.threads)
Expand Down
16 changes: 8 additions & 8 deletions test/TrialsTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ using Test
# Trial #
#########
trial1 = BenchmarkTools.Trial(BenchmarkTools.Parameters(; evals=2))
push!(trial1, TrialContents(2, 1, 4, 5, nothing, nothing, nothing))
push!(trial1, TrialContents(21, 0, 41, 51, nothing, nothing, nothing))
push!(trial1, TrialContents(2.0, 1.0, 4, 5, nothing, nothing, nothing))
push!(trial1, TrialContents(21.0, 0.0, 41, 51, nothing, nothing, nothing))

trial2 = BenchmarkTools.Trial(BenchmarkTools.Parameters(; time_tolerance=0.15))
push!(trial2, TrialContents(21, 0, 41, 51, nothing, nothing, nothing))
push!(trial2, TrialContents(2, 1, 4, 5, nothing, nothing, nothing))
push!(trial2, TrialContents(21.0, 0.0, 41, 51, nothing, nothing, nothing))
push!(trial2, TrialContents(2.0, 1.0, 4, 5, nothing, nothing, nothing))

push!(trial2, TrialContents(21, 0, 41, 51, nothing, nothing, nothing))
push!(trial2, TrialContents(21.0, 0.0, 41, 51, nothing, nothing, nothing))
@test length(trial2) == 3
deleteat!(trial2, 3)
@test length(trial1) == length(trial2) == 2
Expand All @@ -35,7 +35,7 @@ trial2.params = trial1.params

@test trial1[2] == push!(
BenchmarkTools.Trial(BenchmarkTools.Parameters(; evals=2)),
TrialContents(21, 0, 4, 5, nothing, nothing, nothing),
TrialContents(21.0, 0.0, 4, 5, nothing, nothing, nothing),
)
@test trial1[1:end] == trial1

Expand Down Expand Up @@ -63,11 +63,11 @@ rmskew!(trial3)
randtrial = BenchmarkTools.Trial(BenchmarkTools.Parameters())

for _ in 1:40
push!(randtrial, TrialContents(rand(1:20), 1, 1, 1, nothing, nothing, nothing))
push!(randtrial, TrialContents(rand(1.0:20.0), 1.0, 1, 1, nothing, nothing, nothing))
end

while mean(randtrial) <= median(randtrial)
push!(randtrial, TrialContents(rand(10:20), 1, 1, 1, nothing, nothing, nothing))
push!(randtrial, TrialContents(rand(10.0:20.0), 1.0, 1, 1, nothing, nothing, nothing))
end

rmskew!(randtrial)
Expand Down

0 comments on commit 0ef2b49

Please sign in to comment.