[fix](ut)support run be-ut on release mode (#18119)

Fixed improper usage. So now be ut could be run on release mode.
btw, split be build type environment variable to be/be-ut.
This commit is contained in:
zclllyybb
2023-03-27 23:00:03 +08:00
committed by GitHub
parent 115e52c16c
commit 5191b4f473
6 changed files with 15 additions and 12 deletions

View File

@ -134,18 +134,18 @@ TEST_F(PrimaryKeyIndexTest, builder) {
MemPool pool;
while (remaining > 0) {
std::unique_ptr<segment_v2::IndexedColumnIterator> iter;
DCHECK(index_reader.new_iterator(&iter).ok());
EXPECT_TRUE(index_reader.new_iterator(&iter).ok());
size_t num_to_read = std::min(batch_size, remaining);
auto index_type = vectorized::DataTypeFactory::instance().create_data_type(
index_reader.type_info()->type(), 1, 0);
auto index_column = index_type->create_column();
Slice last_key_slice(last_key);
DCHECK(iter->seek_at_or_after(&last_key_slice, &exact_match).ok());
EXPECT_TRUE(iter->seek_at_or_after(&last_key_slice, &exact_match).ok());
size_t num_read = num_to_read;
DCHECK(iter->next_batch(&num_read, index_column).ok());
DCHECK(num_to_read == num_read);
EXPECT_TRUE(iter->next_batch(&num_read, index_column).ok());
EXPECT_EQ(num_to_read, num_read);
last_key = index_column->get_data_at(num_read - 1).to_string();
// exclude last_key, last_key will be read in next batch.
if (num_read == batch_size && num_read != remaining) {

View File

@ -17,15 +17,14 @@
#include "runtime/test_env.h"
#include <gtest/gtest.h>
#include <sys/stat.h>
#include <memory>
#include "olap/storage_engine.h"
#include "runtime/fragment_mgr.h"
#include "runtime/result_queue_mgr.h"
#include "util/disk_info.h"
#include "util/priority_thread_pool.hpp"
namespace doris {
@ -43,7 +42,7 @@ void TestEnv::init_tmp_file_mgr(const std::vector<std::string>& tmp_dirs, bool o
DiskInfo::init();
// will use DiskInfo::num_disks(), DiskInfo should be initialized before
auto st = _tmp_file_mgr->init_custom(tmp_dirs, one_dir_per_device);
DCHECK(st.ok()) << st;
EXPECT_TRUE(st.ok());
}
TestEnv::~TestEnv() {
@ -97,7 +96,7 @@ void TestEnv::init_storage_engine(bool need_open, const std::vector<std::string>
} else {
_engine = new StorageEngine(options);
}
DCHECK(st.ok()) << st;
EXPECT_TRUE(st.ok());
_exec_env->set_storage_engine(_engine);
}

View File

@ -17,6 +17,8 @@
#include "testutil/desc_tbl_builder.h"
#include <gtest/gtest.h>
#include <vector>
#include "runtime/descriptors.h"
@ -75,7 +77,7 @@ DescriptorTbl* DescriptorTblBuilder::build() {
}
Status status = DescriptorTbl::create(_obj_pool, thrift_desc_tbl, &desc_tbl);
DCHECK(status.ok());
EXPECT_TRUE(status.ok());
return desc_tbl;
}

View File

@ -327,7 +327,9 @@ TEST_F(ThreadPoolTest, TestZeroQueueSize) {
#ifndef THREAD_SANITIZER
TEST_F(ThreadPoolTest, TestDeadlocks) {
::testing::FLAGS_gtest_death_test_style = "threadsafe";
#ifdef __APPLE__
#ifdef NDEBUG
const char* death_msg = "doris::ThreadPool::check_not_pool_thread_unlocked()";
#elif defined(__APPLE__)
const char* death_msg =
"_ZNSt3__1L8__invokeIRNS_6__bindIMN5doris10ThreadPoolEFvvEJPS3_EEEJEEEDTclscT_fp_"
"spscT0_fp0_EEOS9_DpOSA_|_ZNSt3__18__invokeB6v15007IRNS_6__"

View File

@ -618,7 +618,7 @@ std::shared_ptr<arrow::Array> create_array_array(std::vector<ColumnArray::Offset
size_t& counter) {
using offset_type = typename arrow::ListType::offset_type;
size_t num_rows = vec_offsets.size() - 1;
DCHECK(null_map.size() == num_rows);
EXPECT_EQ(null_map.size(), num_rows);
size_t offsets_bytes = (vec_offsets.size()) * sizeof(offset_type);
auto offsets_buf_tmp = arrow::AllocateBuffer(offsets_bytes);
std::shared_ptr<arrow::Buffer> offsets_buf = std::move(offsets_buf_tmp.ValueOrDie());

View File

@ -123,7 +123,7 @@ if [[ -z "${PARALLEL}" ]]; then
PARALLEL="$(($(nproc) / 5 + 1))"
fi
CMAKE_BUILD_TYPE="${BUILD_TYPE:-ASAN}"
CMAKE_BUILD_TYPE="${BUILD_TYPE_UT:-ASAN}"
CMAKE_BUILD_TYPE="$(echo "${CMAKE_BUILD_TYPE}" | awk '{ print(toupper($0)) }')"
echo "Get params: