diff --git a/be/test/olap/bit_field_test.cpp b/be/test/olap/bit_field_test.cpp index 44859bfc1c6aed..1c603120fdc15d 100755 --- a/be/test/olap/bit_field_test.cpp +++ b/be/test/olap/bit_field_test.cpp @@ -35,7 +35,8 @@ class TestBitField : public testing::Test { } void SetUp() { - system("rm tmp_file"); + system("mkdir -p ./ut_dir/"); + system("rm ./ut_dir/tmp_file"); _out_stream = new (std::nothrow) OutStream(OLAP_DEFAULT_COLUMN_STREAM_BUFFER_SIZE, NULL); ASSERT_TRUE(_out_stream != NULL); _writer = new (std::nothrow) BitFieldWriter(_out_stream); @@ -52,13 +53,13 @@ class TestBitField : public testing::Test { } void CreateReader() { - ASSERT_EQ(OLAP_SUCCESS, _helper.open_with_mode("tmp_file", + ASSERT_EQ(OLAP_SUCCESS, _helper.open_with_mode(_file_path.c_str(), O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR)); _out_stream->write_to_file(&_helper, 0); _helper.close(); - ASSERT_EQ(OLAP_SUCCESS, _helper.open_with_mode("tmp_file", + ASSERT_EQ(OLAP_SUCCESS, _helper.open_with_mode(_file_path.c_str(), O_RDONLY, S_IRUSR | S_IWUSR)); _shared_buffer = StorageByteBuffer::create( @@ -87,6 +88,8 @@ class TestBitField : public testing::Test { StorageByteBuffer* _shared_buffer; ReadOnlyFileStream* _stream; OlapReaderStatistics _stats; + + std::string _file_path = "./ut_dir/tmp_file"; }; TEST_F(TestBitField, ReadWriteOneBit) { diff --git a/be/test/olap/column_reader_test.cpp b/be/test/olap/column_reader_test.cpp index fb99929cdfa630..e1f68eb104df12 100644 --- a/be/test/olap/column_reader_test.cpp +++ b/be/test/olap/column_reader_test.cpp @@ -130,10 +130,11 @@ class TestColumn : public testing::Test { ASSERT_TRUE(_column_reader != NULL); - system("rm ./tmp_file"); + system("mkdir -p ./ut_dir"); + system("rm ./ut_dir/tmp_file"); ASSERT_EQ(OLAP_SUCCESS, - helper.open_with_mode("tmp_file", + helper.open_with_mode("./ut_dir/tmp_file", O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR)); std::vector off; @@ -177,7 +178,7 @@ class TestColumn : public testing::Test { } helper.close(); - ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode("tmp_file", + ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode("./ut_dir/tmp_file", O_RDONLY, S_IRUSR | S_IWUSR)); _shared_buffer = StorageByteBuffer::create( diff --git a/be/test/olap/olap_header_manager_test.cpp b/be/test/olap/olap_header_manager_test.cpp index 11011dfbfd9fa0..0774a92c7b7cfb 100755 --- a/be/test/olap/olap_header_manager_test.cpp +++ b/be/test/olap/olap_header_manager_test.cpp @@ -19,21 +19,19 @@ #include #include -#include "gtest/gtest.h" -#include "gmock/gmock.h" +#include +#include +#include + #include "olap/store.h" #include "olap/olap_header_manager.h" #include "olap/olap_define.h" -#include "boost/filesystem.hpp" -#include "json2pb/json_to_pb.h" +#include "util/file_utils.h" #ifndef BE_TEST #define BE_TEST #endif -using ::testing::_; -using ::testing::Return; -using ::testing::SetArgPointee; using std::string; namespace doris { @@ -43,13 +41,14 @@ const std::string header_path = "./be/test/olap/test_data/header.txt"; class OlapHeaderManagerTest : public testing::Test { public: virtual void SetUp() { - std::string root_path = "./store"; - ASSERT_TRUE(boost::filesystem::create_directory(root_path)); - _store = new(std::nothrow) OlapStore(root_path); + _root_path = "./ut_dir/olap_header_mgr_test"; + FileUtils::remove_all(_root_path); + FileUtils::create_dir(_root_path); + _store = new(std::nothrow) OlapStore(_root_path); ASSERT_NE(nullptr, _store); Status st = _store->load(); ASSERT_TRUE(st.ok()); - ASSERT_TRUE(boost::filesystem::exists("./store/meta")); + ASSERT_TRUE(boost::filesystem::exists(_root_path + "/meta")); std::ifstream infile(header_path); char buffer[1024]; @@ -64,10 +63,11 @@ class OlapHeaderManagerTest : public testing::Test { virtual void TearDown() { delete _store; - ASSERT_TRUE(boost::filesystem::remove_all("./store")); + ASSERT_TRUE(boost::filesystem::remove_all(_root_path)); } private: + std::string _root_path; OlapStore* _store; std::string _json_header; }; diff --git a/be/test/olap/olap_meta_test.cpp b/be/test/olap/olap_meta_test.cpp index 226385aed06b11..fd33321dff2717 100644 --- a/be/test/olap/olap_meta_test.cpp +++ b/be/test/olap/olap_meta_test.cpp @@ -18,19 +18,17 @@ #include #include -#include "gtest/gtest.h" -#include "gmock/gmock.h" +#include +#include + #include "olap/olap_meta.h" #include "olap/olap_define.h" -#include "boost/filesystem.hpp" +#include "util/file_utils.h" #ifndef BE_TEST #define BE_TEST #endif -using ::testing::_; -using ::testing::Return; -using ::testing::SetArgPointee; using std::string; namespace doris { @@ -38,25 +36,29 @@ namespace doris { class OlapMetaTest : public testing::Test { public: virtual void SetUp() { - std::string root_path = "./"; - _meta = new OlapMeta(root_path); + _root_path = "./ut_dir/olap_meta_test"; + FileUtils::remove_all(_root_path); + FileUtils::create_dir(_root_path); + + _meta = new OlapMeta(_root_path); OLAPStatus s = _meta->init(); ASSERT_EQ(OLAP_SUCCESS, s); - ASSERT_TRUE(boost::filesystem::exists("./meta")); + ASSERT_TRUE(boost::filesystem::exists(_root_path + "/meta")); } virtual void TearDown() { delete _meta; - ASSERT_TRUE(boost::filesystem::remove_all("./meta")); + FileUtils::remove_all(_root_path); } private: + std::string _root_path; OlapMeta* _meta; }; TEST_F(OlapMetaTest, TestGetRootPath) { std::string root_path = _meta->get_root_path(); - ASSERT_EQ("./", root_path); + ASSERT_EQ("./ut_dir/olap_meta_test", root_path); } TEST_F(OlapMetaTest, TestPutAndGet) { diff --git a/be/test/olap/run_length_byte_test.cpp b/be/test/olap/run_length_byte_test.cpp index 65db8a833b3aa9..2702e67b7d9c34 100755 --- a/be/test/olap/run_length_byte_test.cpp +++ b/be/test/olap/run_length_byte_test.cpp @@ -664,7 +664,8 @@ class TestRunLengthByte : public testing::Test { } virtual void SetUp() { - system("rm tmp_file"); + system("mkdir -p ./ut_dir"); + system("rm -rf ./ut_dir/tmp_file"); _out_stream = new (std::nothrow) OutStream(OLAP_DEFAULT_COLUMN_STREAM_BUFFER_SIZE, NULL); ASSERT_TRUE(_out_stream != NULL); _writer = new (std::nothrow) RunLengthByteWriter(_out_stream); @@ -680,12 +681,12 @@ class TestRunLengthByte : public testing::Test { } void CreateReader() { - ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode("tmp_file", + ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode(_file_path.c_str(), O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR)); _out_stream->write_to_file(&helper, 0); helper.close(); - ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode("tmp_file", + ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode(_file_path.c_str(), O_RDONLY, S_IRUSR | S_IWUSR)); _shared_buffer = StorageByteBuffer::create( @@ -713,6 +714,8 @@ class TestRunLengthByte : public testing::Test { StorageByteBuffer* _shared_buffer; ReadOnlyFileStream* _stream; OlapReaderStatistics _stats; + + std::string _file_path = "./ut_dir/tmp_file"; }; diff --git a/be/test/olap/run_length_integer_test.cpp b/be/test/olap/run_length_integer_test.cpp index fafb4a035a74b6..d6bba95493db1f 100755 --- a/be/test/olap/run_length_integer_test.cpp +++ b/be/test/olap/run_length_integer_test.cpp @@ -37,7 +37,8 @@ class TestRunLengthUnsignInteger : public testing::Test { } virtual void SetUp() { - system("rm tmp_file"); + system("mkdir -p ./ut_dir"); + system("rm -rf ./ut_dir/tmp_file"); _out_stream = new (std::nothrow) OutStream(OLAP_DEFAULT_COLUMN_STREAM_BUFFER_SIZE, NULL); ASSERT_TRUE(_out_stream != NULL); _writer = new (std::nothrow) RunLengthIntegerWriter(_out_stream, false); @@ -54,12 +55,12 @@ class TestRunLengthUnsignInteger : public testing::Test { } void CreateReader() { - ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode("tmp_file", + ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode(_file_path.c_str(), O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR)); _out_stream->write_to_file(&helper, 0); helper.close(); - ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode("tmp_file", + ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode(_file_path.c_str(), O_RDONLY, S_IRUSR | S_IWUSR)); _shared_buffer = StorageByteBuffer::create( @@ -87,6 +88,8 @@ class TestRunLengthUnsignInteger : public testing::Test { StorageByteBuffer* _shared_buffer; ReadOnlyFileStream* _stream; OlapReaderStatistics _stats; + + std::string _file_path = "./ut_dir/tmp_file"; }; @@ -350,7 +353,8 @@ class TestRunLengthSignInteger : public testing::Test { } virtual void SetUp() { - system("rm tmp_file"); + system("mkdir -p ./ut_dir"); + system("rm ./ut_dir/tmp_file"); _out_stream = new (std::nothrow) OutStream(OLAP_DEFAULT_COLUMN_STREAM_BUFFER_SIZE, NULL); ASSERT_TRUE(_out_stream != NULL); _writer = new (std::nothrow) RunLengthIntegerWriter(_out_stream, false); @@ -366,12 +370,12 @@ virtual void SetUp() { } void CreateReader() { - ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode("tmp_file", + ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode(_file_path.c_str(), O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR)); _out_stream->write_to_file(&helper, 0); helper.close(); - ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode("tmp_file", + ASSERT_EQ(OLAP_SUCCESS, helper.open_with_mode(_file_path.c_str(), O_RDONLY, S_IRUSR | S_IWUSR)); _shared_buffer = StorageByteBuffer::create( @@ -399,6 +403,7 @@ virtual void SetUp() { StorageByteBuffer* _shared_buffer; ReadOnlyFileStream* _stream; OlapReaderStatistics _stats; + std::string _file_path = "./ut_dir/tmp_file"; }; diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh index 26e7fb067005a0..a37a4d57157401 100755 --- a/thirdparty/build-thirdparty.sh +++ b/thirdparty/build-thirdparty.sh @@ -489,7 +489,7 @@ build_brpc() { rm -rf CMakeCache.txt CMakeFiles/ LDFLAGS="-L${TP_LIB_DIR} -static-libstdc++ -static-libgcc" \ $CMAKE_CMD -v -DBUILD_SHARED_LIBS=0 -DCMAKE_INSTALL_PREFIX=$TP_INSTALL_DIR \ - -DBRPC_WITH_GLOG=ON -DCMAKE_INCLUDE_PATH="$TP_INSTALL_DIR/include" \ + -DBRPC_WITH_GLOG=ON -DWITH_GLOG=ON -DCMAKE_INCLUDE_PATH="$TP_INSTALL_DIR/include" \ -DCMAKE_LIBRARY_PATH="$TP_INSTALL_DIR/lib;$TP_INSTALL_DIR/lib64" \ -DPROTOBUF_PROTOC_EXECUTABLE=$TP_INSTALL_DIR/bin/protoc \ -DProtobuf_PROTOC_EXECUTABLE=$TP_INSTALL_DIR/bin/protoc .. diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh index ddf2ff0797a292..a8c25285161766 100644 --- a/thirdparty/vars.sh +++ b/thirdparty/vars.sh @@ -194,10 +194,10 @@ LEVELDB_SOURCE=leveldb-1.20 LEVELDB_MD5SUM="298b5bddf12c675d6345784261302252" # brpc -BRPC_DOWNLOAD="https://github.com/apache/incubator-brpc/archive/v0.9.0.tar.gz" -BRPC_NAME=incubator-brpc-0.9.0.tar.gz -BRPC_SOURCE=incubator-brpc-0.9.0 -BRPC_MD5SUM="79dfdc8b6e2d7a08dc68f14c5fabe6b7" +BRPC_DOWNLOAD="https://github.com/apache/incubator-brpc/archive/0.9.5.tar.gz" +BRPC_NAME=incubator-brpc-0.9.5.tar.gz +BRPC_SOURCE=incubator-brpc-0.9.5 +BRPC_MD5SUM="c9f46e4c97a9cd5f836ba2c6c56978dd" # rocksdb ROCKSDB_DOWNLOAD="https://github.com/facebook/rocksdb/archive/v5.14.2.tar.gz"