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

Migrate some tests to CTest #5216

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

thejohnfreeman
Copy link
Collaborator

First, it is important to define "test". A test should be an executable that returns 0 if and only if it passes. This is the form of test that CTest understands. The purpose of this PR is to configure the project for CTest tests, introduce a third-party battle-tested unit test framework1, and migrate a few existing tests to that framework.

  • Creates a top-level tests/ directory for holding tests. src/test still exists, but the intent is to separate, in the filesystem, CTest tests from everything else.
  • Adds CMake configuration to add tests in tests/ as CTest tests.
  • Moves all tests of the crypto module and some tests of the basics module to tests/.

Footnotes

  1. The unit test framework in this PR is doctest, but I'm not married to it. It is easy to switch among any of the popular frameworks like Catch2 or GoogleTest.

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.8%. Comparing base (ea1fffe) to head (dcbb3c6).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #5216     +/-   ##
=========================================
- Coverage     77.9%   77.8%   -0.0%     
=========================================
  Files          783     782      -1     
  Lines        66677   66577    -100     
  Branches      8108    8110      +2     
=========================================
- Hits         51921   51819    -102     
- Misses       14756   14758      +2     
Files with missing lines Coverage Δ
include/xrpl/basics/CompressionAlgorithms.h 0.0% <ø> (ø)
src/libxrpl/crypto/csprng.cpp 55.6% <ø> (ø)
src/libxrpl/protocol/SecretKey.cpp 85.0% <ø> (ø)
src/xrpld/core/SociDB.h 100.0% <ø> (ø)
src/xrpld/core/detail/SociDB.cpp 64.8% <ø> (ø)
src/xrpld/net/detail/RegisterSSLCerts.cpp 100.0% <ø> (ø)
src/xrpld/nodestore/backend/NuDBFactory.cpp 61.3% <ø> (ø)
src/xrpld/nodestore/detail/codec.h 35.3% <ø> (ø)
src/xrpld/nodestore/detail/varint.h 85.0% <ø> (ø)
src/xrpld/overlay/detail/ZeroCopyStream.h 61.8% <ø> (ø)
... and 1 more

... and 8 files with indirect coverage changes

Impacted file tree graph

@thejohnfreeman
Copy link
Collaborator Author

Oh, I'll need to modify the CI to run the CTest tests. For that, I think it makes sense to remove the xrpld --unittest test from CTest and run it separately. CTest will not echo its output progress, and it takes a long time.

I might need help fixing the coverage report too.

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.

1 participant