Skip to content
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

Improvements to test suite and code coverage #175

Merged
merged 3 commits into from
Jul 29, 2022

Conversation

marshallward
Copy link
Member

This PR includes multiple improvements to the test suite related to code coverage

  • Failed code coverage uploads to codecov.io now only issue an error for pull requests. Uploads are still attempted, but are not reported as failures if the upload fails for any reason.

    In the Makefile, this is controlled by the REQUIRE_COVERAGE_UPLOAD flag parameter.

  • The README and inline documentation of .testing/Makefile have been overhauled to reflect many of the recent changes.

  • The asterisk syntax of gcov reports is now removed before upload to codecov.io.

    Although the asterisk is a useful indicator of partial coverage, these lines were being ignored by codecov.io and unreported. This caused greater confusion when another report had zero coverage, indicating incorrectly that the line was uncovered. By removing the asterisk, and relying on other metadata to indicate partial coverage, the codecov.io report accuracy now matches the gcov output.

  • Separate rules for generating and reporting code coverage

    It is now much simpler to generate code coverage reports locally, and issues related to uploading to codecov.io can now be ignored.

  • Makefile executables with names other than MOM6 are now accommodated.

  • .testing/Makefile flag overhaul

    Several uncommon flags were removed or renamed, and other new flags were added. As before, these are mostly for internal use and should not affect users. Examples:

    • FCFLAGS_FMS now defines the Fortran flags used to build FMS, rather than the flags needed by MOM6 to use FMS. Previously, it was not possible to independently set the FMS flags.
    • FCFLAGS_DEPS now contains the flags required to access depenencies (i.e. FMS)
    • DEPS, which used to indicate the path to the dependencies, has been removed, and is replaced with deps.

@codecov
Copy link

codecov bot commented Jul 28, 2022

Codecov Report

Merging #175 (f1ddd8c) into dev/gfdl (a054c7a) will increase coverage by 3.54%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##           dev/gfdl     #175      +/-   ##
============================================
+ Coverage     34.01%   37.55%   +3.54%     
============================================
  Files           259      258       -1     
  Lines         70289    71543    +1254     
  Branches      13021    13407     +386     
============================================
+ Hits          23906    26871    +2965     
+ Misses        41879    39729    -2150     
- Partials       4504     4943     +439     
Impacted Files Coverage Δ
src/diagnostics/MOM_obsolete_diagnostics.F90 25.00% <0.00%> (-25.00%) ⬇️
...ig_src/drivers/unit_tests/MOM_unit_test_driver.F90 92.00% <0.00%> (-8.00%) ⬇️
src/framework/MOM_unit_scaling.F90 63.10% <0.00%> (-3.92%) ⬇️
src/framework/MOM_write_cputime.F90 68.25% <0.00%> (-1.24%) ⬇️
src/core/MOM_check_scaling.F90 98.48% <0.00%> (-0.73%) ⬇️
src/core/MOM_density_integrals.F90 17.08% <0.00%> (ø)
src/tracer/MOM_tracer_diabatic.F90 31.22% <0.00%> (ø)
src/user/benchmark_initialization.F90 95.78% <0.00%> (ø)
src/user/circle_obcs_initialization.F90 75.00% <0.00%> (ø)
config_src/infra/FMS1/MOM_time_manager.F90 100.00% <0.00%> (ø)
... and 105 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

@marshallward
Copy link
Member Author

marshallward commented Jul 29, 2022

The testing is reporting as unfinished because build-test-nans was renamed to build-coverage. I did this because it does not appear to be doing the NaN test anymore.

This may need an admin override, and the "new" renamed test should be added to the GitHub verification. Maybe we could also prematurely add it to the requirements, although this will disrupt other PRs.

Copy link
Member

@adcroft adcroft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Two minor changes suggested.

.testing/Makefile Show resolved Hide resolved
.github/workflows/coverage.yml Outdated Show resolved Hide resolved
@adcroft
Copy link
Member

adcroft commented Jul 29, 2022

build-test-nans was removed so why is it saying "expected - waiting or status to be reported"? Is it because this is a PR and the target does have that test?

image

@marshallward
Copy link
Member Author

marshallward commented Jul 29, 2022

build-test-nans was removed so why is it saying "expected - waiting or status to be reported"? Is it because this is a PR and the target does have that test?

It was removed from this PR but GitHub is still configured to look for the old one.


BTW I think what is currently happening:

  1. build-test-nans is required, but does not exist, so merging has been blocked
  2. build-coverage was found in the directory, but is not on the list of required tests, so perhaps GitHub Actions just decided to run it anwyay.

@adcroft
Copy link
Member

adcroft commented Jul 29, 2022

Yes, we'll change the list of required tests when this is merged

marshallward and others added 3 commits July 29, 2022 16:16
Primarily changes to improve coverage reporting, but some other changes
as well:

* New separate rules for `codecov` and `report.cov`

* REPORT_COVERAGE was split into two flags:
  * DO_COVERAGE: Enable code coverage reporting
  * REQUIRE_COVERAGE_UPLOAD: If true, error if upload fails

* We now report codecov upload failures in the log, but only raise an
  error (i.e. nonzero return code) if REQUIRE_COVERAGE_UPLOAD is true.

* GitHub Actions now only reports failed uploads to CodeCov for pull
  requests.

* Separate FCFLAGS_FMS flag to control FCFLAGS for FMS builds
  - also renamed the old FCFLAGS_FMS to FCFLAGS_DEPS, which was
    previously used to pass the flags to the FMS library/modfiles

* $(DEPS) was dropped, and we just use `deps` now.

* Updated the header instructions

* README update

* Codecov.io and GitHub Actions CIs were updated to support changes
Not sure if this is wise, but codecov is severely screwing up these
entries.
Updates .testing/Makefile to allow for alternative executable names and
multiple executables in one build directory.

Until now, the .testing/Makefile assumes all executables are called
"MOM6". With the introduction of makedep, executables are called by the
name indicated by the Fortran program statement.

Changes:
- BUILDS used to be a list of directories under build/ . Now is a list
  of <directory>/<exec_name>.

- UNIT_EXECS lists possible executables within build/unit . This list
  allows us to override targets at the command-line.

- Replaces many $(foreach b,$(BUILDS), ...) constructs in favor of
  build/%/... rules. i.e. reduces use of $(BUILDS) in general

- Corrected name of executable in build/unit

Co-authored-by: Marshall Ward <[email protected]>
@adcroft adcroft merged commit 8b609d0 into NOAA-GFDL:dev/gfdl Jul 29, 2022
@marshallward marshallward deleted the cov_ci_fixes branch September 16, 2022 20:59
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