Skip to content

Commit

Permalink
separate benchmark and test
Browse files Browse the repository at this point in the history
  • Loading branch information
ray6080 committed Jan 15, 2023
1 parent 0010d7a commit c69a498
Show file tree
Hide file tree
Showing 42 changed files with 71 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- run: pip3 install --user -r tools/python_api/requirements_dev.txt

- name: build
run: make release NUM_THREADS=30
run: make benchmark NUM_THREADS=30

- name: benchmark
run: python3 benchmark/benchmark_runner.py --dataset ldbc-sf100 --thread 1
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ endif()
if(${ENABLE_UBSAN})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-common -fpermissive")
endif()
option(BUILD_TESTS "Build C++ and Python tests and benchmark." FALSE)
option(BUILD_TESTS "Build C++ and Python tests." FALSE)
option(BUILD_BENCHMARK "Build benchmarks." FALSE)

function(link_threads LIBRARY)
if (CMAKE_VERSION VERSION_LESS "3.1")
Expand All @@ -56,7 +57,7 @@ endfunction()
function(add_kuzu_test TEST_NAME)
set(SRCS ${ARGN})
add_executable(${TEST_NAME} ${SRCS})
target_link_libraries(${TEST_NAME} PRIVATE test_helper)
target_link_libraries(${TEST_NAME} PRIVATE test_helper graph_test)
target_include_directories(${TEST_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/test/include)
include(GoogleTest)
gtest_discover_tests(${TEST_NAME})
Expand Down Expand Up @@ -85,5 +86,7 @@ add_subdirectory(third_party)
add_subdirectory(src)
if (${BUILD_TESTS})
add_subdirectory(test)
elseif (${BUILD_BENCHMARK})
add_subdirectory(test/test_helper)
endif()
add_subdirectory(tools)
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,26 @@ debug: arrow
all: arrow
mkdir -p build/release && \
cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=TRUE ../.. && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=TRUE -DBUILD_BENCHMARK=TRUE ../.. && \
cmake --build . --config Release -- -j $(NUM_THREADS)

alldebug: arrow
mkdir -p build/debug && \
cd build/debug && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=TRUE ../.. && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=TRUE -DBUILD_BENCHMARK=TRUE ../.. && \
cmake --build . --config Debug -- -j $(NUM_THREADS)

test: all
benchmark: arrow
mkdir -p build/release && \
cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release -DBUILD_BENCHMARK=TRUE ../.. && \
cmake --build . --config Release -- -j $(NUM_THREADS)

test: arrow
mkdir -p build/release && \
cd build/release && \
cmake $(GENERATOR) $(FORCE_COLOR) $(SANITIZER_FLAG) -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=TRUE ../.. && \
cmake --build . --config Release -- -j $(NUM_THREADS)
cd $(ROOT_DIR)/build/release/test && \
ctest

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ Kùzu is being actively developed at University of Waterloo as a feature-rich an
To build from source code, Kùzu requires Cmake(>=3.11), Python 3, and a compiler that supports `C++20`.
- Perform a full clean build without tests and benchmark:
- `make clean && make`
- Perform a full clean build with tests and benchmark:
- Perform a full clean build with tests and benchmark (optional):
- `make clean && make all`
- Run tests (optional):
- `make test`

For development, use `make debug` or `make alldebug` to build a non-optimized debug version.
For development, use `make debug` to build a non-optimized debug version.
To build in parallel, pass `NUM_THREADS` as parameter, e.g., `make NUM_THREADS=8`.

After build, our CLI binary `kuzu_shell` is available under the directory `build/release/tools/shell/`.
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ target_link_libraries(GTest::GTest INTERFACE gmock_main)

enable_testing()
add_subdirectory(test_helper)
add_subdirectory(graph_test)
add_subdirectory(binder)
add_subdirectory(catalog)
add_subdirectory(common)
Expand Down
2 changes: 1 addition & 1 deletion test/binder/binder_error_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/binder/binder_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/catalog/catalog_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "catalog/catalog.h"
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::catalog;

Expand Down
2 changes: 1 addition & 1 deletion test/copy/arrow_node_copy_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::common;
using namespace kuzu::storage;
Expand Down
2 changes: 1 addition & 1 deletion test/copy/copy_dates_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::common;
using namespace kuzu::storage;
Expand Down
2 changes: 1 addition & 1 deletion test/copy/copy_dos_style_newline_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::common;
using namespace kuzu::storage;
Expand Down
2 changes: 1 addition & 1 deletion test/copy/copy_fault_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "common/exception.h"
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/copy/copy_interval_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <string>

#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::common;
using namespace kuzu::storage;
Expand Down
2 changes: 1 addition & 1 deletion test/copy/copy_lists_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "common/type_utils.h"
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::common;
using namespace kuzu::storage;
Expand Down
2 changes: 1 addition & 1 deletion test/copy/copy_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "common/csv_reader/csv_reader.h"
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::common;
using namespace kuzu::catalog;
Expand Down
2 changes: 1 addition & 1 deletion test/copy/copy_timestamp_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::common;
using namespace kuzu::storage;
Expand Down
2 changes: 1 addition & 1 deletion test/demo_db/demo_db_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using ::testing::Test;
using namespace kuzu::testing;
Expand Down
13 changes: 13 additions & 0 deletions test/graph_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
add_library(
graph_test
OBJECT
graph_test.cpp)

target_include_directories(
graph_test
PUBLIC
../include/
../../src/include
)

target_link_libraries(graph_test PUBLIC GTest::GTest kuzu)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using ::testing::Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "parser/parser.h"
#include "planner/logical_plan/logical_plan_util.h"
#include "planner/planner.h"
#include "test_helper.h"
#include "test_helper/test_helper.h"

using namespace kuzu::main;
using ::testing::Test;
Expand Down
2 changes: 1 addition & 1 deletion test/include/main_test_helper/main_test_helper.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

namespace kuzu {
namespace testing {
Expand Down
2 changes: 1 addition & 1 deletion test/runner/e2e_copy_transaction_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <set>

#include "graph_test/graph_test.h"
#include "processor/mapper/plan_mapper.h"
#include "test_helper/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/runner/e2e_ddl_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "graph_test/graph_test.h"
#include "processor/mapper/plan_mapper.h"
#include "test_helper/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/runner/e2e_delete_create_transaction_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/runner/e2e_delete_rel_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/runner/e2e_exception_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using ::testing::Test;
using namespace kuzu::testing;
Expand Down
2 changes: 1 addition & 1 deletion test/runner/e2e_order_by_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/runner/e2e_read_list_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <filesystem>

#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using ::testing::Test;
using namespace kuzu::testing;
Expand Down
2 changes: 1 addition & 1 deletion test/runner/e2e_read_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using ::testing::Test;
using namespace kuzu::testing;
Expand Down
2 changes: 1 addition & 1 deletion test/runner/e2e_set_transaction_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/runner/e2e_update_node_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/runner/e2e_update_rel_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/storage/buffer_manager_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "graph_test/graph_test.h"
#include "storage/buffer_manager/buffer_manager.h"
#include "test_helper/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/storage/disk_array_update_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "common/in_mem_overflow_buffer_utils.h"
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::storage;
using namespace kuzu::testing;
Expand Down
2 changes: 1 addition & 1 deletion test/storage/node_insertion_deletion_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "graph_test/graph_test.h"
#include "storage/wal_replayer.h"
#include "test_helper/graph_test.h"

using namespace kuzu::storage;
using namespace kuzu::testing;
Expand Down
2 changes: 1 addition & 1 deletion test/storage/rel_insertion_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion test/storage/wal_replayer_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "graph_test/graph_test.h"
#include "storage/wal_replayer.h"
#include "test_helper/graph_test.h"

using namespace kuzu::storage;
using namespace kuzu::testing;
Expand Down
2 changes: 1 addition & 1 deletion test/storage/wal_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;
using namespace kuzu::storage;
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ add_library(
test_helper
OBJECT
test_helper.cpp
graph_test.cpp)
)

target_include_directories(
test_helper
Expand Down
2 changes: 1 addition & 1 deletion test/transaction/transaction_manager_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "common/exception.h"
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"
#include "transaction/transaction_manager.h"

using namespace kuzu::common;
Expand Down
2 changes: 1 addition & 1 deletion test/transaction/transaction_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "common/configs.h"
#include "test_helper/graph_test.h"
#include "graph_test/graph_test.h"

using namespace kuzu::testing;

Expand Down
2 changes: 1 addition & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_subdirectory(shell)
add_subdirectory(python_api)
if (${BUILD_TESTS})
if(${BUILD_BENCHMARK})
add_subdirectory(join_order_pick)
add_subdirectory(benchmark)
endif()

0 comments on commit c69a498

Please sign in to comment.