Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions be/test/olap/bit_field_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(
Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 4 additions & 3 deletions be/test/olap/column_reader_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> off;
Expand Down Expand Up @@ -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(
Expand Down
24 changes: 12 additions & 12 deletions be/test/olap/olap_header_manager_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,19 @@
#include <sstream>
#include <fstream>

#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include <gtest/gtest.h>
#include <boost/filesystem.hpp>
#include <json2pb/json_to_pb.h>

#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 {
Expand All @@ -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];
Expand All @@ -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;
};
Expand Down
24 changes: 13 additions & 11 deletions be/test/olap/olap_meta_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,47 @@
#include <string>
#include <sstream>

#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include <gtest/gtest.h>
#include <boost/filesystem.hpp>

#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 {

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) {
Expand Down
9 changes: 6 additions & 3 deletions be/test/olap/run_length_byte_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(
Expand Down Expand Up @@ -713,6 +714,8 @@ class TestRunLengthByte : public testing::Test {
StorageByteBuffer* _shared_buffer;
ReadOnlyFileStream* _stream;
OlapReaderStatistics _stats;

std::string _file_path = "./ut_dir/tmp_file";
};


Expand Down
17 changes: 11 additions & 6 deletions be/test/olap/run_length_integer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(
Expand Down Expand Up @@ -87,6 +88,8 @@ class TestRunLengthUnsignInteger : public testing::Test {
StorageByteBuffer* _shared_buffer;
ReadOnlyFileStream* _stream;
OlapReaderStatistics _stats;

std::string _file_path = "./ut_dir/tmp_file";
};


Expand Down Expand Up @@ -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);
Expand All @@ -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(
Expand Down Expand Up @@ -399,6 +403,7 @@ virtual void SetUp() {
StorageByteBuffer* _shared_buffer;
ReadOnlyFileStream* _stream;
OlapReaderStatistics _stats;
std::string _file_path = "./ut_dir/tmp_file";
};


Expand Down
2 changes: 1 addition & 1 deletion thirdparty/build-thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down
8 changes: 4 additions & 4 deletions thirdparty/vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down