-
Notifications
You must be signed in to change notification settings - Fork 455
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
vector-of-bool
merged 14 commits into
mongodb:master
from
vector-of-bool:ctest-awareness
Sep 21, 2021
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
59eb591
Allow fine-grained test control via CTest
vector-of-bool 579c936
Spelling
vector-of-bool ad6f442
Tag CXX-2301 CXX-2302
vector-of-bool fae123d
Conditional test generation
vector-of-bool 3968e88
exit(1) instead of abort() for test failures
vector-of-bool 45c0fe0
Resolve conflicting file generation in multiconf generation
vector-of-bool 1410b75
Fix duplicate test registration
vector-of-bool 03840ea
Fix conflicts with multiconf generators. Increase test timeout
vector-of-bool 73c1c4d
Back to abort(). Use a signal handler to see abnormal termination.
vector-of-bool de0fd08
Missing <signal.h>
vector-of-bool a13189c
Modify multi-conf test behavior to match VS behavior
vector-of-bool ccd6466
Tweak comment on --ctest-run
vector-of-bool f193d63
Missing newline in signal handler output
vector-of-bool 7abb340
Fix argv-check with --ctest-run
vector-of-bool File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# This file is include()'d by CTest. It executes test-libmongoc to get a list | ||
# of all tests that are registered. Each test is then defined as a CTest test, | ||
# allowing CTest to control the execution, parallelization, and collection of | ||
# test results. | ||
|
||
if (NOT EXISTS "${TEST_LIBMONGOC_EXE}") | ||
# This will fail if 'test-libmongoc' is not compiled yet. | ||
message (WARNING "The test executable ${TEST_LIBMONGOC_EXE} is not present. " | ||
"Its tests will not be registered") | ||
add_test (mongoc/not-found NOT_FOUND) | ||
return () | ||
endif () | ||
|
||
# Get the list of tests | ||
execute_process ( | ||
COMMAND "${TEST_LIBMONGOC_EXE}" --list-tests --no-fork | ||
OUTPUT_VARIABLE tests_out | ||
WORKING_DIRECTORY "${SRC_ROOT}" | ||
RESULT_VARIABLE retc | ||
) | ||
if (retc) | ||
# Failed to list the tests. That's bad. | ||
message (FATAL_ERROR "Failed to run test-libmongoc to discover tests [${retc}]:\n${tests_out}") | ||
endif () | ||
|
||
# Split lines on newlines | ||
string (REPLACE "\n" ";" lines "${tests_out}") | ||
|
||
# Generate the test definitions | ||
foreach (line IN LISTS lines) | ||
if (NOT line MATCHES "^/") | ||
# Only generate if the line begins with `/`, which all tests should. | ||
continue () | ||
endif () | ||
# The new test name is prefixed with 'mongoc' | ||
set (test "mongoc${line}") | ||
eramongodb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Define the test. Use `--ctest-run` to tell it that CTest is in control. | ||
add_test ("${test}" "${TEST_LIBMONGOC_EXE}" --ctest-run "${line}") | ||
set_tests_properties ("${test}" PROPERTIES | ||
# test-libmongoc expects to execute in the root of the source directory | ||
WORKING_DIRECTORY "${SRC_ROOT}" | ||
# If a test emits '@@ctest-skipped@@', this tells us that the test is | ||
# skipped. | ||
SKIP_REGULAR_EXPRESSION "@@ctest-skipped@@" | ||
# 45 seconds of timeout on each test. | ||
TIMEOUT 45 | ||
) | ||
endforeach () |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.