file(REAL_PATH "${CMAKE_CURRENT_SOURCE_DIR}" GTEST_REAL_PATH)
file(REAL_PATH "${GTEST_REAL_PATH}/../../.." GLUTEN_REAL_PATH)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testConfig.h.in
${CMAKE_CURRENT_SOURCE_DIR}/testConfig.h)
if(ENABLE_TESTS)
macro(add_gtest_sources prefix common_path)
add_glob(${prefix}_sources ${common_path}/gtest*.cpp)
endmacro()
set(USE_INTERNAL_GTEST_LIBRARY 0)
set(BENCHMARK_ENABLE_TESTING OFF)
enable_testing()
include(CTest)
include_directories(${GTEST_INCLUDE_DIRS})
set(TEST_DATA_DIR "${ClickHouse_SOURCE_DIR}/utils/extern-local-engine/tests")
set(HAVE_POSIX_REGEX 1)
set(LOCAL_ENGINE_DIR "${ClickHouse_SOURCE_DIR}/utils/extern-local-engine")
add_gtest_sources(local_engine_gtest .)
if(ENABLE_LOCAL_UDFS)
file(
GLOB children CONFIGURE_DEPENDS
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
../Parser/*_udf/tests)
foreach(child ${children})
add_gtest_sources(local_engine_gtest ${child})
endforeach()
file(
GLOB children CONFIGURE_DEPENDS
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
../Parser/*_udf)
foreach(child ${children})
add_headers_and_sources(local_engine_udf ${child})
endforeach()
endif()
file(
GLOB children CONFIGURE_DEPENDS
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
../Parser/*_function_parser)
foreach(child ${children})
add_headers_and_sources(local_engine_function_parser ${child})
endforeach()
message("local engine gtest sources: ${local_engine_gtest_sources}")
message("local engine udf sources: ${local_engine_udf_sources}")
message(
"local engine function parser sources: ${local_engine_function_parser_sources}"
)
add_executable(
unit_tests_local_engine
gluten_test_util.cpp ${local_engine_gtest_sources}
${local_engine_udf_sources} ${local_engine_function_parser_sources})
target_include_directories(
unit_tests_local_engine
PRIVATE ${ClickHouse_SOURCE_DIR}/utils/extern-local_engine
${CMAKE_CURRENT_SOURCE_DIR})
target_compile_options(unit_tests_local_engine PRIVATE -Wno-unreachable-code)
target_link_libraries(
unit_tests_local_engine
PRIVATE gluten_clickhouse_backend_libs clickhouse_parsers loggers
ch_contrib::gmock_all ch_contrib::gtest)
target_link_libraries(unit_tests_local_engine PRIVATE ch_parquet)
endif()
if(ENABLE_BENCHMARKS)
include_directories(benchmark_local_engine SYSTEM PUBLIC
${ClickHouse_SOURCE_DIR}/utils/extern-local_engine)
add_executable(
benchmark_local_engine
gluten_test_util.cpp
benchmark_local_engine.cpp
benchmark_parquet_read.cpp
benchmark_spark_row.cpp
benchmark_unix_timestamp_function.cpp
benchmark_spark_floor_function.cpp
benchmark_cast_float_function.cpp
benchmark_to_datetime_function.cpp
benchmark_spark_divide_function.cpp
benchmark_sum.cpp)
target_link_libraries(
benchmark_local_engine
PRIVATE gluten_clickhouse_backend_libs ch_contrib::gbenchmark_all loggers
ch_parquet)
endif()