Skip to content

Allow CTest as a test driver #870

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 14 commits into from
Sep 21, 2021

Conversation

vector-of-bool
Copy link
Contributor

Previously, a single CTest test was defined for test-libmongoc. This change allows CTest to see the individual test cases contained within test-libmongoc. These can be selected and executed with the CTest CLI, including with some parallelism.

Changes are only visible with CMake 3.10 or newer. Earlier CMake versions should be unaffected.

This changeset does not modify how the tests are executed in CI. In the future, if we wish to adopt CTest as a test runner, the CTest-emitted results could be transformed via simple scripting back into Evergreen test results.

CTest can be executed with parallelism with the -j/--parallel options. Tests execute well in parallel except when they attempt to modify a shared resource. This can be fixed by attaching concurrency properties to tests as appropriate, or by ensuring that tests each receive and use a unique copy of the resource under contention, but such changes are beyond the scope of this changeset.

These changes relate-to and partially-address CXX-2301 and CXX-2302, but do not complete them.

(The choice of @@ctest-skipped@@ as a skip-marker is arbitrary and insignificant.)

Previously, a single test was defined for test-libmongoc.
This change allows CTest to see the individual test cases
contained within test-libmongoc. These can be selected
and executed with the CTest CLI, including with
some parallelism.
Copy link
Contributor

@chardan chardan left a comment

Choose a reason for hiding this comment

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

+1. Bearing in mind my basic CMake know-how and not-solid understanding of how that command-line tooling goes, this looks good. Hopefully it will help us make many new tests! :-)

Copy link
Contributor

@eramongodb eramongodb left a comment

Choose a reason for hiding this comment

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

There are two tests that fail to be registered with CTest (shows up in test-libmongoc --list-tests but not in ctest -N):

/bson/oid/after_fork
/Client/exhaust_cursor/after_reset

Total tests registered should total 2212, but currently total 2210 according to ctest -N. I could not figure out why these two tests are being dropped from examining the current set of changes.

Copy link
Contributor

@rcsanchez97 rcsanchez97 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

I have not used ctest much. But it looks like an improvement over using test-libmongoc.

The -I option lets me specify an indexed range of tests to run. I have hacked test-libmongoc to support that when running a sequence of time consuming tests during development.

I like the consolidated output of skipped tests.

LGTM

Copy link
Contributor

@eramongodb eramongodb left a comment

Choose a reason for hiding this comment

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

Other than a couple remaining questions, LGTM.

Output of attempts to run tests when none are registered (e.g. built Debug, attempt to run Release tests) can be rather noisy, but I prefer the noise over little/no feedback. Great work getting both single and multi-config generators to work properly. I hope this paves the way to a parallel-friendly test suite. 👍

Copy link
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

LGTM

@vector-of-bool vector-of-bool merged commit 130938a into mongodb:master Sep 21, 2021
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.

5 participants