Skip to content

Commit

Permalink
add timings + used memory to tests (#3285)
Browse files Browse the repository at this point in the history
* add timings + used memory to tests

* print available ram and test texture_atlas size

* make sure texture atlas doesn't grow in size

* Update database.jl
  • Loading branch information
SimonDanisch authored Oct 12, 2023
1 parent 0523494 commit 513b4ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ReferenceTests/src/database.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ macro reference_test(name, code)
funcs = used_functions(code)
skip = (title in SKIP_TITLES) || any(x-> x in funcs, SKIP_FUNCTIONS)
return quote
t1 = time()
@testset $(title) begin
if $skip
@test_broken false
Expand All @@ -46,6 +47,11 @@ macro reference_test(name, code)
push!($REGISTERED_TESTS, $title)
end
end
elapsed = round(time() - t1; digits=3)
total = Sys.total_memory()
mem = round((total - Sys.free_memory()) / 10^9; digits=3)
# TODO, write to file and create an overview in the end, similar to the benchmark results!
println("Used $(mem)gb of $(round(total / 10^9; digits=3))gb RAM, time: $(elapsed)s")
end
end

Expand Down
6 changes: 6 additions & 0 deletions WGLMakie/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ Makie.inline!(Makie.automatic)
recorded_files, recording_dir = @include_reference_tests "refimages.jl"
missing_images, scores = ReferenceTests.record_comparison(recording_dir)
ReferenceTests.test_comparison(scores; threshold = 0.032)

end

@testset "memory leaks" begin
GC.gc(true)
@test Base.summarysize(WGLMakie.TEXTURE_ATLAS) / 10^6 < 9
end

0 comments on commit 513b4ac

Please sign in to comment.