Skip to content

MONGOCRYPT-889 skip building tests when BUILD_TESTING=OFF#1139

Merged
kevinAlbs merged 5 commits intomongodb:masterfrom
kevinAlbs:do-not-build-tests
Mar 23, 2026
Merged

MONGOCRYPT-889 skip building tests when BUILD_TESTING=OFF#1139
kevinAlbs merged 5 commits intomongodb:masterfrom
kevinAlbs:do-not-build-tests

Conversation

@kevinAlbs
Copy link
Copy Markdown
Collaborator

@kevinAlbs kevinAlbs commented Mar 20, 2026

Summary

Skip building tests when BUILD_TESTING=OFF

Background & Motivation

Attempting to update the C driver to use a newer libmongocrypt resulted in an error on Windows:

[2026/03/19 15:32:15.763] Command 'archive.targz_extract' in function 'fetch-build' (step 1.3 of 7) failed: extracting file '\data\mci\f53c\build.tar.gz': extracting path '\data\mci\f53c\mongoc': artifact path name 'libmongocrypt/cmake-build/mc-mlib.int128.test.dir/RelWithDebInfo/mc-mlib..227B0180.tlog/' should be relative to the root path: relative path starts with '..'.

The failure to untar a path with two dots is reported in DEVPROD-30287. The path being untarred is part of the test build. As a workaround, this PR skips building more test executables when BUILD_TESTING=OFF. With this PR applied, updating libmongocrypt the C driver succeeds to extract a produced tarball.

Intended to work around error untarring paths with two dots.
@kevinAlbs kevinAlbs marked this pull request as ready for review March 20, 2026 13:21
@kevinAlbs kevinAlbs requested a review from a team as a code owner March 20, 2026 13:21
Comment thread .evergreen/build_all.sh Outdated
Comment on lines +104 to +110
if [[ "${BUILD_TESTING:?}" =~ ^(0|OFF|NO|FALSE|n|off|no|false)$ ]]; then
echo "Skipping tests since BUILD_TESTING is false"
exit 0;
fi

_cmake_with_env --build "$BINARY_DIR" --target test-mongocrypt test_kms_request
run_chdir "$BINARY_DIR" run_ctest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ideally, BUILD_TESTING=TRUE should add the test targets as default build targets, and this branch would be unnecessary. Is the branch required?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. This branch appears unnecessary. --target install also builds all. ctest exits successfully if BUILD_TESTING=FALSE (printing: "No test configuration file found!").

Removed the explicit listing of test-mongocrypt and test_kms_request as build targets (which does error with "No rule to make target" if BUILD_TESTING=FALSE).

Added a LIBMONGOCRYPT_BUILD_VARIANTS environment variable so the C driver can skip unnecessarily building unnneeded libmongocrypt variants.

No need to skip ctest if BUILD_TESTING is false. The ctest command exits with "No test configuration file found!" if `BUILD_TESTING=FALSE`.
to skip build time for the C driver (only needs first build)
@kevinAlbs kevinAlbs changed the title Skip building tests when BUILD_TESTING=OFF MONGOCRYPT-889 skip building tests when BUILD_TESTING=OFF Mar 23, 2026
@kevinAlbs kevinAlbs merged commit 6d6bc38 into mongodb:master Mar 23, 2026
54 of 56 checks passed
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