Add coverage tools to cmake/autotools builds - #65
Closed
d-torrance wants to merge 57 commits into
Closed
Conversation
Builds the image from M2/BUILD/docker/testbot/Dockerfile and pushes it to ghcr.io/macaulay2/testbot, tagged with the current Macaulay2 version (from M2/VERSION) and "latest". [ci skip]
this commit contains the aux files moving and also some refactoring of pushFwdRingHelper and pushAuxHgs that were hard to excise from the test / docs move for some reason :(
this produces a basis ordering which is more naturally aligned with the basis for the pushforward of the coefficient ring. this simplifies the gymnastics in computation of pushforward of elements.
removes unnecessary call to pushFwd(RingMap) in the middle of pushFwd(RingMap, Module) that was giving significant slowdown. Following this simplify and unify duplicate codepaths for pushFwd(RingMap) and pushFwd(RingMap, Module).
performance of `summands` method appears highly sensitive to the presentation of the module it is passed. The PushForward package is being refactored in a way that results in a different presentation for the `frobeniusPushforward' used in this test and this causes the test to hang. Disabling it pending investigation by @Devlin-Mallory and @mahrud into why. See PR discussion for more context.
This appears naturally in the context of pushing forward the maps in a free resolution.
…rd method in my experience working with these patterns it is easy to lead to confusion if you for example create a pushFwd with an explicit map and then call bare pushforward of an element. it will successfully pushforward the element but probably to a different pushforward module. starting off requiring an explicit map seems reasonable as it is harder to claw functionality out of the api than it is to add it later.
Mostly libjs-* -> node-* now that we use dh-nodejs for building the Visualize package. [ci skip]
[ci skip]
[ci skip]
AFAIK, there is no plan to do this [ci skip]
Adds a --enable-gcov option (modeled on --enable-profile) that builds with
--coverage -O0, plus -fprofile-abs-path under gcc so gcov/gcovr can resolve
sources from the out-of-tree build; it also disables stripping.
Coverage data (.gcda) is generated automatically whenever any coverage-built
binary exits, so no target runs the tests for you: just run the unit tests,
make check, or the M2 binary on your own code. Two top-level targets clear
and report on the accumulated data:
coverage-reset delete accumulated .gcda (tree-wide)
coverage-report produce an HTML report via gcovr (engine-scoped by default;
override COVERAGE_ROOT/COVERAGE_OBJDIR for the whole tree)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds a -DGCOV=ON option that builds with --coverage -O0, plus -fprofile-abs-path under gcc, mirroring the PROFILING flag block. New cmake/gcov.cmake provides coverage-reset and coverage-report (gcovr) targets, paralleling the autotools setup; coverage data is generated by running any coverage-built binary (unit tests, ctest, or the M2 binary). Also fixes a pre-existing typo in the dormant Clang coverage.cmake, which searched for clang-format instead of llvm-cov. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The coverage-report target now prints the report path as an OSC 8 terminal hyperlink (file://host/path) via printf, so terminals that support it render it as a clickable link. Done for both the autotools (Makefile.in) and cmake (gcov.cmake) targets. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gcov can report the same function on more than one line (e.g. inlines compiled at -O0), which gcovr's default --merge-mode-functions=strict treats as a fatal error. Pass merge-use-line-min so those entries are merged and attributed to the function's first line. Applied to both the autotools and cmake targets; the autotools value is overridable via COVERAGE_MERGE_MODE. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
-fprofile-abs-path is gcc-only (clang rejects it), and it was only a convenience for source resolution -- which gcovr already handles via its --root/--object-directory options. Removing it keeps --coverage portable across gcc and clang and avoids a compiler-specific guard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Consolidate the declaration and flag-setting logic into one block, quote macro arguments with [...], use AS_IF instead of raw test/if, and keep lines within 80 columns. No functional change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
On macOS, applying --coverage before AC_FC_LIBRARY_LDFLAGS/AX_BLAS/AX_LAPACK let gfortran expand --coverage to -lgcov and bake it into FCLIBS/BLAS_LIBS. The final clang link then pulled in both gcc's libgcov and clang's own libclang_rt.profile, producing duplicate __gcov_reset/__gcov_fork symbols. Move the gcov flag block after that detection so only the compiler's own coverage runtime ends up on the link line. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pass the object tree to gcovr as a positional search path instead of via --object-directory. --object-directory forces gcov to run in a single directory, which cannot resolve the relative source paths of objects built in deeper VPATH subdirectories (e.g. Macaulay2/e/unit-tests), causing "could not infer a working directory" errors. As a search path, gcovr runs gcov in each data file's own directory, so every source resolves. Also default COVERAGE_ROOT/COVERAGE_OBJDIR to the whole tree, drop the hardcoded unit-tests exclude, and add a GCOVR_OPTIONS variable for passing extra gcovr options (filters, excludes, formats). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Report over the whole tree by default (root = source tree, build tree passed as a positional search path rather than --object-directory), drop the hardcoded unit-tests exclude, and add a GCOVR_OPTIONS cache variable for passing extra gcovr options (split with separate_arguments). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
|
Closing in favor of Macaulay2#4489 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We add an
--enable-gcovoption toconfigureso that M2 gets compiled with all the right flags forgcovto do its thing. Then we can run some M2 code and callmake coverage-reportto get a nicegcovr-generated report of the coverage. Callmake coverage-resetto reset the accumulated data before generating a fresh report.There's also some analogous cmake stuff I haven't tested yet.
AI Disclosure
🤖 This was all Claude, baby! 🤖