Explicitly list all test files in CMakeLists

Reviewers: mferencevic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1619
This commit is contained in:
Teon Banek 2018-09-27 15:11:50 +02:00
parent 53c405c699
commit d78022470c
5 changed files with 170 additions and 128 deletions

View File

@ -1,37 +1,61 @@
include_directories(${BENCHMARK_INCLUDE_DIR})
set(test_prefix memgraph__benchmark__)
# set current directory name as a test type
get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
add_custom_target(memgraph__benchmark)
# get all cpp abs file names recursively starting from current directory
file(GLOB_RECURSE test_type_cpps *.cpp)
message(STATUS "Available ${test_type} cpp files are: ${test_type_cpps}")
function(add_benchmark test_cpp)
# get exec name (remove extension from the abs path)
get_filename_component(exec_name ${test_cpp} NAME_WE)
set(target_name ${test_prefix}${exec_name})
add_executable(${target_name} ${test_cpp})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake
# requires unique logical target names
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
target_link_libraries(${target_name} benchmark)
target_include_directories(${target_name} PRIVATE ${BENCHMARK_INCLUDE_DIR})
# register test
set(output_path
${CMAKE_BINARY_DIR}/test_results/benchmark/${target_name}.json)
add_test(${target_name} ${exec_name}
--benchmark_out_format=json --benchmark_out=${output_path})
add_dependencies(memgraph__benchmark ${target_name})
endfunction(add_benchmark)
# for each cpp file build binary and register test
foreach(test_cpp ${test_type_cpps})
add_benchmark(data_structures/concurrent/map_mix_concurrent.cpp)
target_link_libraries(${test_prefix}map_mix_concurrent memgraph_lib kvstore_dummy_lib)
# get exec name (remove extension from the abs path)
get_filename_component(exec_name ${test_cpp} NAME_WE)
add_benchmark(data_structures/concurrent/skiplist_insert.cpp)
target_link_libraries(${test_prefix}skiplist_insert memgraph_lib kvstore_dummy_lib)
set(target_name memgraph__${test_type}__${exec_name})
add_benchmark(data_structures/concurrent/skiplist_reverse_iteration.cpp)
target_link_libraries(${test_prefix}skiplist_reverse_iteration memgraph_lib kvstore_dummy_lib)
# build exec file
add_executable(${target_name} ${test_cpp})
add_benchmark(data_structures/concurrent/map_concurrent.cpp)
target_link_libraries(${test_prefix}map_concurrent memgraph_lib kvstore_dummy_lib)
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake
# requires unique logical target names
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
add_benchmark(data_structures/ring_buffer.cpp)
target_link_libraries(${test_prefix}ring_buffer memgraph_lib kvstore_dummy_lib)
# Regular link of libraries we depend on.
target_link_libraries(${target_name} benchmark memgraph_lib)
# Link the appropriate kvstore library for required components.
target_link_libraries(${target_name} kvstore_dummy_lib)
add_benchmark(query/eval.cpp)
target_link_libraries(${test_prefix}eval memgraph_lib kvstore_dummy_lib)
# register test
set(output_path
${CMAKE_BINARY_DIR}/test_results/benchmark/${target_name}.json)
add_test(${target_name} ${exec_name}
--benchmark_out_format=json --benchmark_out=${output_path})
add_benchmark(query/planner.cpp)
target_link_libraries(${test_prefix}planner memgraph_lib kvstore_dummy_lib)
endforeach()
add_benchmark(query/stripped.cpp)
target_link_libraries(${test_prefix}stripped memgraph_lib kvstore_dummy_lib)
add_benchmark(edge_storage.cpp)
target_link_libraries(${test_prefix}edge_storage memgraph_lib kvstore_dummy_lib)
add_benchmark(mvcc.cpp)
target_link_libraries(${test_prefix}mvcc memgraph_lib kvstore_dummy_lib)
add_benchmark(serialization.cpp)
target_link_libraries(${test_prefix}serialization memgraph_lib kvstore_dummy_lib)
add_benchmark(tx_engine.cpp)
target_link_libraries(${test_prefix}tx_engine memgraph_lib kvstore_dummy_lib)
add_benchmark(expansion.cpp)
target_link_libraries(${test_prefix}expansion memgraph_lib kvstore_dummy_lib)

View File

@ -1,32 +1,81 @@
# set current directory name as a test type
get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(test_prefix memgraph__concurrent__)
# get all cpp abs file names recursively starting from current directory
file(GLOB_RECURSE test_type_cpps *.cpp)
message(STATUS "Available ${test_type} cpp files are: ${test_type_cpps}")
add_custom_target(memgraph__concurrent)
# for each cpp file build binary and register test
foreach(test_cpp ${test_type_cpps})
function(add_concurrent_test test_cpp)
# get exec name (remove extension from the abs path)
get_filename_component(exec_name ${test_cpp} NAME_WE)
set(target_name ${test_prefix}${exec_name})
add_executable(${target_name} ${test_cpp})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake
# requires unique logical target names
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
target_link_libraries(${target_name} gtest gmock gtest_main)
# register test
add_test(${target_name} ${exec_name})
add_dependencies(memgraph__concurrent ${target_name})
endfunction(add_concurrent_test)
# get exec name (remove extension from the abs path)
get_filename_component(exec_name ${test_cpp} NAME_WE)
add_concurrent_test(dynamic_bitset_clear_n.cpp)
target_link_libraries(${test_prefix}dynamic_bitset_clear_n memgraph_lib kvstore_dummy_lib)
set(target_name memgraph__${test_type}__${exec_name})
add_concurrent_test(dynamic_bitset.cpp)
target_link_libraries(${test_prefix}dynamic_bitset memgraph_lib kvstore_dummy_lib)
# build exec file
add_executable(${target_name} ${test_cpp})
add_concurrent_test(dynamic_bitset_set.cpp)
target_link_libraries(${test_prefix}dynamic_bitset_set memgraph_lib kvstore_dummy_lib)
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake
# requires unique logical target names
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
add_concurrent_test(dynamic_bitset_set_n.cpp)
target_link_libraries(${test_prefix}dynamic_bitset_set_n memgraph_lib kvstore_dummy_lib)
# Regular link of libraries we depend on.
target_link_libraries(${target_name} gtest gmock gtest_main memgraph_lib)
# Link the appropriate kvstore library for required components.
target_link_libraries(${target_name} kvstore_dummy_lib)
add_concurrent_test(futex.cpp)
target_link_libraries(${test_prefix}futex memgraph_lib kvstore_dummy_lib)
# register test
add_test(${target_name} ${exec_name})
add_concurrent_test(network_read_hang.cpp)
target_link_libraries(${test_prefix}network_read_hang memgraph_lib kvstore_dummy_lib)
endforeach()
add_concurrent_test(network_server.cpp)
target_link_libraries(${test_prefix}network_server memgraph_lib kvstore_dummy_lib)
add_concurrent_test(network_session_leak.cpp)
target_link_libraries(${test_prefix}network_session_leak memgraph_lib kvstore_dummy_lib)
add_concurrent_test(push_queue.cpp)
target_link_libraries(${test_prefix}push_queue memgraph_lib kvstore_dummy_lib)
add_concurrent_test(sl_hang.cpp)
target_link_libraries(${test_prefix}sl_hang memgraph_lib kvstore_dummy_lib)
add_concurrent_test(sl_insert_competetive.cpp)
target_link_libraries(${test_prefix}sl_insert_competetive memgraph_lib kvstore_dummy_lib)
add_concurrent_test(sl_insert.cpp)
target_link_libraries(${test_prefix}sl_insert memgraph_lib kvstore_dummy_lib)
add_concurrent_test(sl_map.cpp)
target_link_libraries(${test_prefix}sl_map memgraph_lib kvstore_dummy_lib)
add_concurrent_test(sl_memory.cpp)
target_link_libraries(${test_prefix}sl_memory memgraph_lib kvstore_dummy_lib)
add_concurrent_test(sl_memory_leak.cpp)
target_link_libraries(${test_prefix}sl_memory_leak memgraph_lib kvstore_dummy_lib)
add_concurrent_test(sl_remove_competetive.cpp)
target_link_libraries(${test_prefix}sl_remove_competetive memgraph_lib kvstore_dummy_lib)
add_concurrent_test(sl_remove_disjoint.cpp)
target_link_libraries(${test_prefix}sl_remove_disjoint memgraph_lib kvstore_dummy_lib)
add_concurrent_test(sl_remove_joint.cpp)
target_link_libraries(${test_prefix}sl_remove_joint memgraph_lib kvstore_dummy_lib)
add_concurrent_test(sl_set.cpp)
target_link_libraries(${test_prefix}sl_set memgraph_lib kvstore_dummy_lib)
add_concurrent_test(sl_simulation.cpp)
target_link_libraries(${test_prefix}sl_simulation memgraph_lib kvstore_dummy_lib)
add_concurrent_test(spinlock.cpp)
target_link_libraries(${test_prefix}spinlock memgraph_lib kvstore_dummy_lib)

View File

@ -1,34 +1,30 @@
# set current directory name as a test type
get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(test_prefix memgraph__macro_benchmark__)
# get all cpp abs file names recursively starting from current directory
file(GLOB_RECURSE test_type_cpps *.cpp)
message(STATUS "Available ${test_type} cpp files are: ${test_type_cpps}")
add_custom_target(memgraph__macro_benchmark)
# add target that depends on all other targets
set(all_targets_target memgraph__${test_type})
add_custom_target(${all_targets_target})
function(add_macro_benchmark test_cpp)
# get exec name (remove extension from the abs path)
get_filename_component(exec_name ${test_cpp} NAME_WE)
set(target_name ${test_prefix}${exec_name})
add_executable(${target_name} ${test_cpp})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake
# requires unique logical target names
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
add_dependencies(memgraph__macro_benchmark ${target_name})
endfunction(add_macro_benchmark)
# for each cpp file build binary and register test
foreach(test_cpp ${test_type_cpps})
add_macro_benchmark(clients/pokec_client.cpp)
target_link_libraries(${test_prefix}pokec_client memgraph_lib kvstore_dummy_lib)
# get exec name (remove extension from the abs path)
get_filename_component(exec_name ${test_cpp} NAME_WE)
add_macro_benchmark(clients/graph_500_bfs.cpp)
target_link_libraries(${test_prefix}graph_500_bfs memgraph_lib kvstore_dummy_lib)
set(target_name memgraph__${test_type}__${exec_name})
add_macro_benchmark(clients/bfs_pokec_client.cpp)
target_link_libraries(${test_prefix}bfs_pokec_client memgraph_lib kvstore_dummy_lib)
# build exec file
add_executable(${target_name} ${test_cpp})
add_macro_benchmark(clients/query_client.cpp)
target_link_libraries(${test_prefix}query_client memgraph_lib kvstore_dummy_lib)
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake
# requires unique logical target names
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
# link libraries
target_link_libraries(${target_name} memgraph_lib kvstore_dummy_lib)
# add target to dependencies
add_dependencies(${all_targets_target} ${target_name})
endforeach()
add_macro_benchmark(clients/card_fraud_client.cpp)
target_link_libraries(${test_prefix}card_fraud_client memgraph_lib kvstore_dummy_lib)

View File

@ -1,34 +1,22 @@
# set current directory name as a test type
get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(test_prefix memgraph__property_based__)
# get all cpp abs file names recursively starting from current directory
file(GLOB_RECURSE test_type_cpps *.cpp)
message(STATUS "Available ${test_type} cpp files are: ${test_type_cpps}")
# for each cpp file build binary and register test
foreach(test_cpp ${test_type_cpps})
add_custom_target(memgraph__property_based)
function(add_property_based_test test_cpp)
# get exec name (remove extension from the abs path)
get_filename_component(exec_name ${test_cpp} NAME_WE)
set(target_name memgraph__${test_type}__${exec_name})
# build exec file
set(target_name ${test_prefix}${exec_name})
add_executable(${target_name} ${test_cpp})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake
# requires unique logical target names
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
# link libraries
target_link_libraries(${target_name} memgraph_lib kvstore_dummy_lib)
# gtest
target_link_libraries(${target_name} gtest gtest_main)
target_link_libraries(${target_name} rapidcheck rapidcheck_gtest)
# register test
set(output_path ${CMAKE_BINARY_DIR}/test_results/unit/${target_name}.xml)
add_test(${target_name} ${exec_name} --gtest_output=xml:${output_path})
add_dependencies(memgraph__property_based ${target_name})
endfunction(add_property_based_test)
endforeach()
add_property_based_test(random_graph.cpp)
target_link_libraries(${test_prefix}random_graph memgraph_lib kvstore_dummy_lib)

View File

@ -1,34 +1,19 @@
# set current directory name as a test type
get_filename_component(test_type ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(test_prefix memgraph__stress__)
# get all cpp abs file names recursively starting from current directory
file(GLOB_RECURSE test_type_cpps *.cpp)
message(STATUS "Available ${test_type} cpp files are: ${test_type_cpps}")
add_custom_target(memgraph__stress)
# add target that depends on all other targets
set(all_targets_target memgraph__${test_type})
add_custom_target(${all_targets_target})
function(add_stress_test test_cpp)
# get exec name (remove extension from the abs path)
get_filename_component(exec_name ${test_cpp} NAME_WE)
set(target_name ${test_prefix}${exec_name})
add_executable(${target_name} ${test_cpp})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake
# requires unique logical target names
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
# add target to dependencies
add_dependencies(memgraph__stress ${target_name})
endfunction(add_stress_test)
# for each cpp file build binary and register test
foreach(test_cpp ${test_type_cpps})
# get exec name (remove extension from the abs path)
get_filename_component(exec_name ${test_cpp} NAME_WE)
set(target_name memgraph__${test_type}__${exec_name})
# build exec file
add_executable(${target_name} ${test_cpp})
# OUTPUT_NAME sets the real name of a target when it is built and can be
# used to help create two targets of the same name even though CMake
# requires unique logical target names
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${exec_name})
# link libraries
target_link_libraries(${target_name} memgraph_lib kvstore_dummy_lib)
# add target to dependencies
add_dependencies(${all_targets_target} ${target_name})
endforeach()
add_stress_test(long_running.cpp)
target_link_libraries(${test_prefix}long_running memgraph_lib kvstore_dummy_lib)