From b061ffb18b96bfc0109a528a679c32aa2b61cb63 Mon Sep 17 00:00:00 2001 From: Zack Winter <3457246+zackwintermdb@users.noreply.github.com> Date: Mon, 26 Jan 2026 11:23:07 -0800 Subject: [PATCH] SERVER-117275 Compress coredumps in unit test wrapper (#46919) GitOrigin-RevId: e63046efaa6b4a4c28282ca8a6180ac8e7f80636 --- .bazelrc | 6 +++++- bazel/test_wrapper.sh | 4 ++-- evergreen/gather_mongo_coredumps.sh | 10 ++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.bazelrc b/.bazelrc index c436a2ae700..3ad09a2664a 100644 --- a/.bazelrc +++ b/.bazelrc @@ -428,8 +428,12 @@ common:remote_test --strategy=TestRunner=remote common:remote_test --features=-thin_archive common:remote_test --remote_download_outputs=minimal common:remote_test --test_output=summary + +# The below line unsets the no-remote-cache execution info for the given strategies +# even though upon first glance it looks like it's setting it. common:remote_test --modify_execution_info=^(TestRunner|CppLink|CppArchive|SolibSymlink|ExtractDebugInfo|StripDebugInfo|CcGenerateIntermediateDwp|CcGenerateDwp)$=-no-remote-cache -common:remote_test --remote_download_regex=.*\.core$ +common:remote_test --remote_download_regex=.*\.(zip|core|mdmp|gz)$ + test:remote_test --test_tag_filters=-incompatible_with_bazel_remote_test # Coverage diff --git a/bazel/test_wrapper.sh b/bazel/test_wrapper.sh index 29da0f6134d..5a3592e8519 100755 --- a/bazel/test_wrapper.sh +++ b/bazel/test_wrapper.sh @@ -56,8 +56,8 @@ RET=$? CORE_FILE=$(find -L ./ -name "*.core") if [ -f "$CORE_FILE" ]; then - CORE_FILENAME="dump_$(date +%s%N).core" - mv $CORE_FILE "$TEST_UNDECLARED_OUTPUTS_DIR/$CORE_FILENAME" + CORE_FILENAME="dump_$(date +%s%N).core.gz" + gzip -c $CORE_FILE >"$TEST_UNDECLARED_OUTPUTS_DIR/$CORE_FILENAME" echo "Writing coredump to $CORE_FILENAME..." fi diff --git a/evergreen/gather_mongo_coredumps.sh b/evergreen/gather_mongo_coredumps.sh index 763543c317d..bcb3ad643f5 100755 --- a/evergreen/gather_mongo_coredumps.sh +++ b/evergreen/gather_mongo_coredumps.sh @@ -11,3 +11,13 @@ for core_file in $core_files; do ln -sf $core_file $base_name fi done + +# Find all gzipped core files and decompress them to src +gzipped_core_files=$(/usr/bin/find -H .. bazel-testlogs -name "*.core.gz" 2>/dev/null) +for gzipped_core_file in $gzipped_core_files; do + base_name=$(echo $gzipped_core_file | sed "s/.*\///" | sed "s/\.gz$//") + # Decompress file if it does not already exist + if [ ! -f $base_name ]; then + gunzip -c $gzipped_core_file >$base_name + fi +done