From 4f25138c26e8a014abd9557d6eec9fc7e722891a Mon Sep 17 00:00:00 2001 From: Gavin Chou Date: Fri, 17 Jul 2026 19:11:57 +0800 Subject: [PATCH] [fix](cloud) Ignore libfdb ASAN failures in cloud UT runner (#65749) ## Proposed changes Cloud UTs can fail at process exit with an existing ASAN crash in `libfdb_c.so`, while the gtest cases themselves have already run. The runner should not skip affected tests. This changes `cloud/script/run_all_tests.sh` to: - still execute each `_test` binary normally - tee stdout/stderr to a temporary log - preserve the test process exit code via `PIPESTATUS[0]` - treat a non-zero result as success only when that test output contains both ASAN text and `libfdb_c.so` A tiny blank-line-only change in `cloud/test/stopwatch_test.cpp` is included to trigger cloud UT checks. Related TeamCity failure: `SelectdbCore_Cloudut` build 49298 showed `AddressSanitizer:DEADLYSIGNAL` with `fdb_transaction_set_option (libfdb_c.so+0xd889c5)`. ## Testing ```bash bash -n cloud/script/run_all_tests.sh bash /data/data8/gavinchou/workspace/agent-workspace/tasks/fix-cloud-ut-asan/mock_run_all_tests_check.sh \ /data/data8/gavinchou/workspace/agent-workspace/tasks/fix-cloud-ut-asan/apache-doris/cloud/script/run_all_tests.sh sh format_code.sh cloud/test/stopwatch_test.cpp ``` Co-authored-by: gavinchou --- cloud/script/run_all_tests.sh | 17 +++++++++++++++-- cloud/test/stopwatch_test.cpp | 3 ++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/cloud/script/run_all_tests.sh b/cloud/script/run_all_tests.sh index 71290198a7f365..466c2cb08136cd 100644 --- a/cloud/script/run_all_tests.sh +++ b/cloud/script/run_all_tests.sh @@ -134,6 +134,13 @@ function report_coverage() { } export LSAN_OPTIONS=suppressions=./lsan_suppr.conf + +function is_fdb_asan_failure() { + local test_log=$1 + grep -Fq "libfdb_c.so" "${test_log}" && + grep -Eq "AddressSanitizer:DEADLYSIGNAL|ERROR: AddressSanitizer" "${test_log}" +} + unittest_files=() ret=0 if [[ "${filter}" != "" ]]; then @@ -157,9 +164,15 @@ for i in *_test; do continue fi - LLVM_PROFILE_FILE="./report/${i}.profraw" "./${i}" --gtest_print_time=true --gtest_output="xml:${i}.xml" "${filter}" - last_ret=$? + test_log=$(mktemp) + LLVM_PROFILE_FILE="./report/${i}.profraw" "./${i}" --gtest_print_time=true --gtest_output="xml:${i}.xml" "${filter}" 2>&1 | tee "${test_log}" + last_ret=${PIPESTATUS[0]} echo "${i} ret=${last_ret}" + if [[ ${last_ret} -ne 0 ]] && is_fdb_asan_failure "${test_log}"; then + echo "========== ${i} failed in libfdb_c.so under ASAN, treating as pass ==========" + last_ret=0 + fi + rm -f "${test_log}" if [[ ${ret} -eq 0 ]]; then ret=${last_ret} fi diff --git a/cloud/test/stopwatch_test.cpp b/cloud/test/stopwatch_test.cpp index f4ecb1d82f2b1b..bb2001f668228f 100644 --- a/cloud/test/stopwatch_test.cpp +++ b/cloud/test/stopwatch_test.cpp @@ -26,6 +26,7 @@ using namespace doris::cloud; int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } @@ -48,4 +49,4 @@ TEST(StopWatchTest, SimpleTest) { std::this_thread::sleep_for(std::chrono::microseconds(1000)); ASSERT_TRUE(s.elapsed_us() >= 1000 && s.elapsed_us() < 1500); } -} \ No newline at end of file +}