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
44 changes: 25 additions & 19 deletions be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,13 @@ set (PALO_LINK_LIBS ${PALO_LINK_LIBS}
)

# Set libraries for test
set (TEST_LINK_LIBS ${PALO_LINK_LIBS} gmock LLVMSupport)
set (TEST_LINK_LIBS ${PALO_LINK_LIBS}
${WL_START_GROUP}
gmock
gtest
LLVMSupport
${WL_END_GROUP}
)

# Set CXX flags
SET(CXX_COMMON_FLAGS "-msse4.2 -Wall -Wno-sign-compare -Wno-deprecated -pthread -fno-omit-frame-pointer")
Expand All @@ -394,7 +400,7 @@ add_definitions(-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H)
set(BUILD_SHARED_LIBS OFF)

if (${MAKE_TEST} STREQUAL "ON")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -DGTEST_USE_OWN_TR1_TUPLE=0")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
add_definitions(-DBE_TEST)
endif ()
Expand All @@ -416,6 +422,23 @@ add_subdirectory(${SRC_DIR}/testutil)
add_subdirectory(${SRC_DIR}/rpc)
add_subdirectory(${SRC_DIR}/aes)

# Utility CMake function to make specifying tests and benchmarks less verbose
FUNCTION(ADD_BE_TEST TEST_NAME)
set(BUILD_OUTPUT_ROOT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/")
# This gets the directory where the test is from (e.g. 'exprs' or 'runtime')
get_filename_component(DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
get_filename_component(TEST_DIR_NAME ${TEST_NAME} PATH)
get_filename_component(TEST_FILE_NAME ${TEST_NAME} NAME)

ADD_EXECUTABLE(${TEST_FILE_NAME} ${TEST_NAME}.cpp)
TARGET_LINK_LIBRARIES(${TEST_FILE_NAME} ${TEST_LINK_LIBS})
SET_TARGET_PROPERTIES(${TEST_FILE_NAME} PROPERTIES COMPILE_FLAGS "-Dprivate=public -Dprotected=public")
if (NOT "${TEST_DIR_NAME}" STREQUAL "")
SET_TARGET_PROPERTIES(${TEST_FILE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}/${DIR_NAME}/${TEST_DIR_NAME}")
endif()
ADD_TEST(${TEST_FILE_NAME} "${BUILD_OUTPUT_ROOT_DIRECTORY}/${TEST_NAME}")
ENDFUNCTION()

if (${MAKE_TEST} STREQUAL "ON")
add_subdirectory(${TEST_DIR}/agent)
add_subdirectory(${TEST_DIR}/olap)
Expand All @@ -425,7 +448,6 @@ if (${MAKE_TEST} STREQUAL "ON")
add_subdirectory(${TEST_DIR}/exec)
add_subdirectory(${TEST_DIR}/exprs)
add_subdirectory(${TEST_DIR}/runtime)
add_subdirectory(${TEST_DIR}/udf)
endif ()

# Install be
Expand All @@ -445,19 +467,3 @@ install(FILES
${BASE_DIR}/../conf/be.conf
DESTINATION ${OUTPUT_DIR}/conf)

# Utility CMake function to make specifying tests and benchmarks less verbose
FUNCTION(ADD_BE_TEST TEST_NAME)
# This gets the directory where the test is from (e.g. 'exprs' or 'runtime')
get_filename_component(DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
get_filename_component(TEST_DIR_NAME ${TEST_NAME} PATH)
get_filename_component(TEST_FILE_NAME ${TEST_NAME} NAME)

ADD_EXECUTABLE(${TEST_FILE_NAME} ${TEST_NAME}.cpp)
TARGET_LINK_LIBRARIES(${TEST_FILE_NAME} ${TEST_LINK_LIBS})
SET_TARGET_PROPERTIES(${TEST_FILE_NAME} PROPERTIES COMPILE_FLAGS "-Dprivate=public -Dprotected=public")
if (NOT "${TEST_DIR_NAME}" STREQUAL "")
SET_TARGET_PROPERTIES(${TEST_FILE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}/${DIR_NAME}/${TEST_DIR_NAME}")
endif()
ADD_TEST(${TEST_FILE_NAME} "${BUILD_OUTPUT_ROOT_DIRECTORY}/${DIR_NAME}/${TEST_NAME}")
ENDFUNCTION()

2 changes: 1 addition & 1 deletion be/src/runtime/export_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Status ExportSink::send(RuntimeState* state, RowBatch* batch) {
std::stringstream ss;
for (int i = 0; i < num_rows;) {
ss.str("");
for (int j = 0; j < batch_send_rows, i < num_rows; ++j, ++i) {
for (int j = 0; j < batch_send_rows && i < num_rows; ++j, ++i) {
RETURN_IF_ERROR(gen_row_buffer(batch->get_row(i), &ss));
}

Expand Down
2 changes: 2 additions & 0 deletions be/test/agent/mock_task_worker_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define BDG_PALO_BE_SRC_MOCK_MOCK_TASK_WORKER_POOL_H

#include "agent/status.h"
#include "agent/task_worker_pool.h"

namespace palo {

Expand All @@ -25,6 +26,7 @@ const uint32_t PUSH_MAX_RETRY = 3;
const uint32_t REPORT_TASK_WORKER_COUNT = 1;
const uint32_t REPORT_DISK_STATE_WORKER_COUNT = 1;
const uint32_t REPORT_OLAP_TABLE_WORKER_COUNT = 1;
const uint32_t DOWNLOAD_FILE_MAX_RETRY = 3;

class MockTaskWorkerPool : public TaskWorkerPool {
public:
Expand Down
1 change: 1 addition & 0 deletions be/test/agent/task_worker_pool_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "agent/mock_file_downloader.h"
#include "agent/mock_pusher.h"
#include "agent/mock_utils.h"
#include "agent/mock_task_worker_pool.h"
#include "agent/task_worker_pool.h"
#include "agent/utils.h"
#include "olap/mock_command_executor.h"
Expand Down
2 changes: 1 addition & 1 deletion be/test/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
# under the License.

# where to put generated libraries
set(EXECUTABLE_OUTPUT_PATH "${BINARY_DIR}/test/common")
set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/test/common")

ADD_BE_TEST(resource_tls_test)
4 changes: 2 additions & 2 deletions be/test/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# under the License.

# where to put generated binaries
set(EXECUTABLE_OUTPUT_PATH "${BINARY_DIR}/test/runtime")
set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/test/runtime")

#ADD_BE_TEST(buffered_tuple_stream_test)
#ADD_BE_TEST(sorter_test)
Expand Down Expand Up @@ -53,4 +53,4 @@ ADD_BE_TEST(disk_io_mgr_test)
ADD_BE_TEST(mem_limit_test)
ADD_BE_TEST(buffered_block_mgr2_test)
ADD_BE_TEST(buffered_tuple_stream2_test)
ADD_BE_TEST(export_task_mgr_test)
#ADD_BE_TEST(export_task_mgr_test)
2 changes: 1 addition & 1 deletion be/test/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# under the License.

# where to put generated libraries
set(EXECUTABLE_OUTPUT_PATH "${BINARY_DIR}/test/util")
set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/test/util")

#ADD_BE_TEST(integer-array-test)
#ADD_BE_TEST(runtime_profile_test)
Expand Down
2 changes: 1 addition & 1 deletion fe/src/com/baidu/palo/qe/Coordinator.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public Coordinator(ConnectContext context, Analyzer analyzer, Planner planner) {

// Used for pull load task coordinator
public Coordinator(TUniqueId queryId, DescriptorTable descTable,
List<PlanFragment> fragments, List<ScanNode> scanNodes, String cluster) {
List<PlanFragment> fragments, List<ScanNode> scanNodes, String cluster) {
this.isBlockQuery = true;
this.queryId = queryId;
this.descTable = descTable.toThrift();
Expand Down
1 change: 1 addition & 0 deletions fe/src/com/baidu/palo/task/PullLoadJobMgr.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.baidu.palo.thrift.TStatusCode;

import com.google.common.collect.Maps;

import org.apache.kudu.client.shaded.com.google.common.collect.Queues;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
5 changes: 3 additions & 2 deletions fe/src/com/baidu/palo/task/PullLoadTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import com.baidu.palo.common.InternalException;
import com.baidu.palo.common.Status;
import com.baidu.palo.load.BrokerFileGroup;
import com.baidu.palo.load.LoadJob;
import com.baidu.palo.qe.Coordinator;
import com.baidu.palo.qe.QeProcessor;
import com.baidu.palo.thrift.TQueryType;
import com.baidu.palo.thrift.TStatusCode;
import com.baidu.palo.thrift.TUniqueId;

import com.google.common.collect.Maps;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -162,7 +162,7 @@ public synchronized void onFailed(Status failStatus) {
}
}

public void actualExecute() {
private void actualExecute() {
int waitSecond = (int) (getLeftTimeMs() / 1000);
if (waitSecond <= 0) {
onCancelled();
Expand Down Expand Up @@ -207,6 +207,7 @@ public void executeOnce() throws InternalException {
planner.getFragments(), planner.getScanNodes(), db.getClusterName());
curCoordinator.setQueryType(TQueryType.LOAD);
curCoordinator.setExecMemoryLimit(execMemLimit);
curCoordinator.setTimeout((int) (getLeftTimeMs() / 1000));
}

boolean needUnregister = false;
Expand Down