mirror of
https://github.com/apache/doris.git
synced 2026-11-04 16:03:23 +00:00
## 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 <gavinchou@apache.org>
53 lines
1.7 KiB
C++
53 lines
1.7 KiB
C++
// Licensed to the Apache Software Foundation (ASF) under one
|
|
// or more contributor license agreements. See the NOTICE file
|
|
// distributed with this work for additional information
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
// to you under the Apache License, Version 2.0 (the
|
|
// "License"); you may not use this file except in compliance
|
|
// with the License. You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing,
|
|
// software distributed under the License is distributed on an
|
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
// KIND, either express or implied. See the License for the
|
|
// specific language governing permissions and limitations
|
|
// under the License.
|
|
|
|
#include "common/stopwatch.h"
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <chrono>
|
|
#include <thread>
|
|
|
|
using namespace doris::cloud;
|
|
|
|
int main(int argc, char** argv) {
|
|
::testing::InitGoogleTest(&argc, argv);
|
|
|
|
return RUN_ALL_TESTS();
|
|
}
|
|
|
|
TEST(StopWatchTest, SimpleTest) {
|
|
{
|
|
StopWatch s;
|
|
s.start();
|
|
std::this_thread::sleep_for(std::chrono::microseconds(1000));
|
|
ASSERT_TRUE(s.elapsed_us() >= 1000);
|
|
|
|
s.pause();
|
|
std::this_thread::sleep_for(std::chrono::microseconds(1000));
|
|
ASSERT_TRUE(s.elapsed_us() >= 1000 && s.elapsed_us() < 1500);
|
|
|
|
s.resume();
|
|
std::this_thread::sleep_for(std::chrono::microseconds(1000));
|
|
ASSERT_TRUE(s.elapsed_us() >= 1000 && s.elapsed_us() < 2500);
|
|
|
|
s.reset();
|
|
std::this_thread::sleep_for(std::chrono::microseconds(1000));
|
|
ASSERT_TRUE(s.elapsed_us() >= 1000 && s.elapsed_us() < 1500);
|
|
}
|
|
}
|