Skip to content

Test: added allocations tests for types that are known to be allocation-free (SKIP THEM FOR NOW) #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 9, 2025

Conversation

franckgaga
Copy link
Member

@franckgaga franckgaga commented Apr 9, 2025

I choose to use the builtin @allocations macro for two reasons:

  1. no additional test depedency (e.g. BechmarkTools)
  2. it's faster than @ballocations in BechmarkTools

As a drawback there is known limitations (or feature? 😄) for exemple JuliaLang/julia#51112. A simple workaround for this specific issue is to create another function that calls the tested in-place function and returns nothing:

using Test
function myfunc2!(arg1, arg2)
    myfunc!(arg1, arg2)
    return nothing
end
@test @allocations(myfunc2!(arg1, arg2)) == 0

It seems to work well on Julia 1.11.

@franckgaga franckgaga changed the title Test: added no-allocations test for types that are known to be allocation-free at runtime Test: added allocations test for types that are known to be allocation-free at runtime Apr 9, 2025
@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.88%. Comparing base (a8b8c9b) to head (a412fcf).
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #187   +/-   ##
=======================================
  Coverage   98.88%   98.88%           
=======================================
  Files          25       25           
  Lines        4205     4205           
=======================================
  Hits         4158     4158           
  Misses         47       47           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@franckgaga
Copy link
Member Author

franckgaga commented Apr 9, 2025

Also skip pre version in CI badge with this addition in CI.yml:

continue-on-error: ${{ matrix.version == 'nightly' || matrix.version == 'pre' }}

For now the tests on the pre version does not precompile at all. I am pretty confident that it's not caused by MPC.jl, so let's remove this test from CI badge.

@franckgaga
Copy link
Member Author

franckgaga commented Apr 9, 2025

The tests pass if coverage=false, but fail otherwise on Julia v1.11.4. This is caused by JuliaLang/julia#49978 and JuliaLang/julia#57220

Will skip the allocations test for now with @test_skip and see how the issue evolves.

@franckgaga franckgaga changed the title Test: added allocations test for types that are known to be allocation-free at runtime Test: added allocations test for types that are known to be allocation-free (SKIP THEM FOR NOW) Apr 9, 2025
@franckgaga franckgaga changed the title Test: added allocations test for types that are known to be allocation-free (SKIP THEM FOR NOW) Test: added allocations tests for types that are known to be allocation-free (SKIP THEM FOR NOW) Apr 9, 2025
@franckgaga franckgaga merged commit fe935e7 into main Apr 9, 2025
3 of 4 checks passed
@franckgaga franckgaga deleted the test_alloc branch April 9, 2025 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants