Change FILE COPY to configure_file COPYONLY
Summary: FILE COPY copies files only in configuration stage, configure_file copies files in make stage if file has changed. Reviewers: buda, teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D531
This commit is contained in:
parent
b19f18c558
commit
99fffc23f7
@ -114,24 +114,32 @@ set(fmt_static_lib ${fmt_source_dir}/fmt/libfmt.a)
|
||||
# and memgraph server binary
|
||||
# copy query_engine template file
|
||||
set(query_engine_template_file ${src_dir}/query/plan_template_cpp)
|
||||
FILE(COPY ${query_engine_template_file}
|
||||
DESTINATION ${CMAKE_BINARY_DIR}/tests/template)
|
||||
FILE(COPY ${query_engine_template_file}
|
||||
DESTINATION ${CMAKE_BINARY_DIR}/tests/integration/template)
|
||||
FILE(COPY ${query_engine_template_file}
|
||||
DESTINATION ${CMAKE_BINARY_DIR}/tests/manual/template)
|
||||
FILE(COPY ${query_engine_template_file}
|
||||
DESTINATION ${CMAKE_BINARY_DIR}/template)
|
||||
configure_file(${query_engine_template_file}
|
||||
${CMAKE_BINARY_DIR}/tests/template/plan_template_cpp COPYONLY)
|
||||
configure_file(${query_engine_template_file}
|
||||
${CMAKE_BINARY_DIR}/tests/integration/template/plan_template_cpp COPYONLY)
|
||||
configure_file(${query_engine_template_file}
|
||||
${CMAKE_BINARY_DIR}/tests/manual/template/plan_template_cpp COPYONLY)
|
||||
configure_file(${query_engine_template_file}
|
||||
${CMAKE_BINARY_DIR}/template/plan_template_cpp COPYONLY)
|
||||
# create destination folder for compiled queries
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tests/integration/compiled)
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tests/manual/compiled)
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tests/compiled)
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/compiled)
|
||||
# copy hardcoded queries
|
||||
FILE(COPY ${tests_dir}/integration/hardcoded_query
|
||||
DESTINATION ${CMAKE_BINARY_DIR}/tests/integration)
|
||||
FILE(COPY ${tests_dir}/integration/stream
|
||||
DESTINATION ${CMAKE_BINARY_DIR}/tests/integration)
|
||||
file(GLOB __HARDCODED_FILES
|
||||
${CMAKE_SOURCE_DIR}/tests/integration/hardcoded_query/*)
|
||||
foreach(file_path ${__HARDCODED_FILES})
|
||||
get_filename_component(file_name ${file_path} NAME)
|
||||
configure_file(${file_path} ${CMAKE_BINARY_DIR}/tests/integration/hardcoded_query/${file_name} COPYONLY)
|
||||
endforeach()
|
||||
file(GLOB __STREAM
|
||||
${CMAKE_SOURCE_DIR}/tests/integration/stream/*)
|
||||
foreach(file_path ${__STREAM})
|
||||
get_filename_component(file_name ${file_path} NAME)
|
||||
configure_file(${file_path} ${CMAKE_BINARY_DIR}/tests/integration/stream/${file_name} COPYONLY)
|
||||
endforeach()
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# linter setup (clang-tidy)
|
||||
@ -206,20 +214,6 @@ message(STATUS "MEMGRAPH binary: ${MEMGRAPH}")
|
||||
option(POC "Build proof of concept binaries" ON)
|
||||
message(STATUS "POC binaries: ${POC}")
|
||||
# tests
|
||||
option(ALL_TESTS "Add all test binaries" ON)
|
||||
message(STATUS "Add all test binaries: ${ALL_TESTS}")
|
||||
option(BENCHMARK_TESTS "Add benchmark test binaries" OFF)
|
||||
message(STATUS "Add benchmark test binaries: ${BENCHMARK_TESTS}")
|
||||
option(CONCURRENT_TESTS "Add concurrent test binaries" OFF)
|
||||
message(STATUS "Add concurrent test binaries: ${CONCURRENT_TESTS}")
|
||||
option(INTEGRATION_TESTS "Add integration test binaries" OFF)
|
||||
message(STATUS "Add integration test binaries: ${INTEGRATION_TESTS}")
|
||||
option(MANUAL_TESTS "Add manual test binaries" OFF)
|
||||
message(STATUS "Add manual test binaries: ${MANUAL_TESTS}")
|
||||
option(UNIT_TESTS "Add unit test binaries" OFF)
|
||||
message(STATUS "Add unit test binaries: ${UNIT_TESTS}")
|
||||
option(PROPERTY_BASED_TESTS "Add property based test binaries" OFF)
|
||||
message(STATUS "Add property based test binaries: ${PROPERTY_BASED_TESTS}")
|
||||
option(HARDCODED_TARGETS "Make hardcoded query targets" ON)
|
||||
message(STATUS "Make hardcoded query targets: ${HARDCODED_TARGETS}")
|
||||
option(TEST_COVERAGE "Generate coverage reports from unit tests" OFF)
|
||||
@ -334,10 +328,7 @@ endif()
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# tests
|
||||
if (ALL_TESTS OR BENCHMARK_TESTS OR CONCURRENT_TEST OR INTEGRATION_TEST
|
||||
OR MANUAL_TESTS OR UNIT_TESTS OR PROPERTY_BASED_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
add_subdirectory(tests)
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
add_custom_target(recursive_include_plan_template
|
||||
@ -403,19 +394,19 @@ set_target_properties(__refactor_target PROPERTIES EXCLUDE_FROM_ALL 1)
|
||||
# 3. integration tests for all pilot/clients written in cucumber
|
||||
# the following targets address only the first phase
|
||||
if(HARDCODED_TARGETS)
|
||||
file(GLOB __HARDCODED_SOURCES
|
||||
${CMAKE_SOURCE_DIR}/tests/integration/hardcoded_query/*.cpp)
|
||||
foreach(file_path ${__HARDCODED_SOURCES})
|
||||
get_filename_component(file_name ${file_path} NAME_WE)
|
||||
set(target_name __${file_name}_hardcoded_target)
|
||||
add_executable(${target_name} ${CMAKE_SOURCE_DIR}/libs/__main.cpp
|
||||
${file_path})
|
||||
target_link_libraries(${target_name} memgraph_lib)
|
||||
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
|
||||
set_target_properties(${target_name}
|
||||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
"${CMAKE_BINARY_DIR}/__hardcoded_targets")
|
||||
endforeach()
|
||||
file(GLOB __HARDCODED_SOURCES
|
||||
${CMAKE_SOURCE_DIR}/tests/integration/hardcoded_query/*.cpp)
|
||||
foreach(file_path ${__HARDCODED_SOURCES})
|
||||
get_filename_component(file_name ${file_path} NAME_WE)
|
||||
set(target_name __${file_name}_hardcoded_target)
|
||||
add_executable(${target_name} ${CMAKE_SOURCE_DIR}/libs/__main.cpp
|
||||
${file_path})
|
||||
target_link_libraries(${target_name} memgraph_lib)
|
||||
set_property(TARGET ${target_name} PROPERTY CXX_STANDARD ${cxx_standard})
|
||||
set_target_properties(${target_name}
|
||||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY
|
||||
"${CMAKE_BINARY_DIR}/__hardcoded_targets")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
get_target_cxx_flags(memgraph_lib compile_flags)
|
||||
|
@ -25,32 +25,20 @@ endif (UNIX)
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# benchmark test binaries
|
||||
if (ALL_TESTS OR BENCHMARK_TESTS)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/benchmark)
|
||||
endif()
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/benchmark)
|
||||
|
||||
# concurrent test binaries
|
||||
if (ALL_TESTS OR CONCURRENT_TESTS)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/concurrent)
|
||||
endif()
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/concurrent)
|
||||
|
||||
# integration test binaries
|
||||
if (ALL_TESTS OR INTEGRATION_TESTS)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/integration)
|
||||
endif()
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/integration)
|
||||
|
||||
# manual test binaries
|
||||
if (ALL_TESTS OR MANUAL_TESTS)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/manual)
|
||||
endif()
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/manual)
|
||||
|
||||
# unit test binaries
|
||||
if (ALL_TESTS OR UNIT_TESTS)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/unit)
|
||||
endif()
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/unit)
|
||||
|
||||
# property based test binaries
|
||||
if (ALL_TESTS OR PROPERTY_BASED_TESTS)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/libs/rapidcheck/extras/gtest/include)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/property_based)
|
||||
endif()
|
||||
include_directories(${CMAKE_SOURCE_DIR}/libs/rapidcheck/extras/gtest/include)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/property_based)
|
||||
|
@ -51,10 +51,3 @@ TCK Engine problems:
|
||||
| -properties | 1 |
|
||||
|
||||
Database is returning properties_set, not properties_created and properties_deleted.
|
||||
|
||||
## KPI Service
|
||||
|
||||
Flask application used to get results from executing tests with TCK Engine.
|
||||
Application can be ran executing:
|
||||
|
||||
1. python3 kpi_service/kpi_service.py
|
||||
|
@ -1,16 +0,0 @@
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y python3 python3-pip \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
COPY kpi_service /kpi_service
|
||||
COPY requirements.txt /kpi_service/requirements.txt
|
||||
|
||||
WORKDIR /kpi_service
|
||||
RUN pip3 install --upgrade pip
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
EXPOSE 5000
|
||||
CMD python3 kpi_service.py --results /results
|
||||
|
@ -1,166 +0,0 @@
|
||||
from flask import Flask, jsonify, request
|
||||
import os
|
||||
import json
|
||||
from argparse import ArgumentParser
|
||||
|
||||
app = Flask(__name__)
|
||||
"""
|
||||
Script runs web application used for getting test results.
|
||||
Default file with results is "../tck_engine/results".
|
||||
Application lists files with results or returnes result
|
||||
file as json.
|
||||
Default host is 0.0.0.0, and default port is 5000.
|
||||
Host, port and result file can be passed as arguments of a script.
|
||||
"""
|
||||
|
||||
|
||||
def parse_args():
|
||||
argp = ArgumentParser(description=__doc__)
|
||||
argp.add_argument("--host", default="0.0.0.0",
|
||||
help="Application host ip, default is 0.0.0.0.")
|
||||
argp.add_argument("--port", default="5000",
|
||||
help="Application host ip, default is 5000.")
|
||||
argp.add_argument("--results", default="tck_engine/results",
|
||||
help="Path where the results are stored.")
|
||||
return argp.parse_args()
|
||||
|
||||
|
||||
@app.route("/results")
|
||||
def results():
|
||||
"""
|
||||
Function accessed with route /result. Function lists
|
||||
last tail result files added. Tail is a parameter given
|
||||
in the route. If the tail is not given, function lists
|
||||
last ten added files. If parameter last is true, only last
|
||||
test result is returned.
|
||||
|
||||
@return:
|
||||
json list of test results
|
||||
"""
|
||||
l = [f for f in os.listdir(app.config["RESULTS_PATH"])
|
||||
if f != ".gitignore"]
|
||||
return get_ret_list(l)
|
||||
|
||||
|
||||
@app.route("/results/<dbname>")
|
||||
def results_for_db(dbname):
|
||||
"""
|
||||
Function accessed with route /result/<dbname>. Function
|
||||
lists last tail result files added of database <dbname.
|
||||
Tail is a parameter given in the route. If tail is not
|
||||
given, function lists last ten added files of database
|
||||
<dbname>. If param last is true, only last test result
|
||||
is returned.
|
||||
|
||||
@param dbname:
|
||||
string, database name
|
||||
@return:
|
||||
json list of test results
|
||||
"""
|
||||
print(os.listdir(app.config["RESULTS_PATH"]))
|
||||
l = [f for f in os.listdir(app.config["RESULTS_PATH"])
|
||||
if f != ".gitignore" and f.split('-')[1] == dbname]
|
||||
return get_ret_list(l)
|
||||
|
||||
|
||||
@app.route("/results/<dbname>/<test_suite>")
|
||||
def result(dbname, test_suite):
|
||||
"""
|
||||
Function accessed with route /results/<dbname>/<test_suite>
|
||||
Function lists last tail result files added of database <dbname>
|
||||
tested on <test_suite>. Tail is a parameter given in the
|
||||
route. If tail is not given, function lists last ten results.
|
||||
If param last is true, only last test result is returned.
|
||||
|
||||
@param dbname:
|
||||
string, database name
|
||||
@param test_suite:
|
||||
string, test suite of result file
|
||||
@return:
|
||||
json list of test results
|
||||
"""
|
||||
fname = dbname + "-" + test_suite + ".json"
|
||||
l = [f for f in os.listdir(app.config["RESULTS_PATH"])
|
||||
if f.endswith(fname)]
|
||||
return get_ret_list(l)
|
||||
|
||||
|
||||
def get_ret_list(l):
|
||||
"""
|
||||
Function returns json list of test results of files given in
|
||||
list l.
|
||||
|
||||
@param l:
|
||||
list of file names
|
||||
@return:
|
||||
json list of test results
|
||||
"""
|
||||
l.sort()
|
||||
ret_list = []
|
||||
for f in l:
|
||||
ret_list.append(get_content(f))
|
||||
return list_to_json(
|
||||
ret_list,
|
||||
request.args.get("last"),
|
||||
request.args.get("tail")
|
||||
)
|
||||
|
||||
|
||||
def get_content(fname):
|
||||
"""
|
||||
Function returns data of the json file fname located in
|
||||
results directory in json format.
|
||||
|
||||
@param fname:
|
||||
string, name of the file
|
||||
@return:
|
||||
json of a file
|
||||
"""
|
||||
with open(app.config["RESULTS_PATH"] + "/" + fname) as f:
|
||||
json_data = json.load(f)
|
||||
return json_data
|
||||
|
||||
|
||||
def list_to_json(l, last, tail):
|
||||
"""
|
||||
Function converts list to json format. If last is true,
|
||||
only the first item in list is returned list, else last
|
||||
tail results are returned in json list. If tail is not
|
||||
given, last ten results are returned in json list.
|
||||
|
||||
@param l:
|
||||
list to convert to json format
|
||||
@param last:
|
||||
string from description
|
||||
@param tail:
|
||||
string from description
|
||||
"""
|
||||
l.reverse()
|
||||
if len(l) == 0:
|
||||
return jsonify(results=[])
|
||||
|
||||
if last == "true":
|
||||
return jsonify(results=[l[0]])
|
||||
|
||||
if tail is None:
|
||||
tail = 10
|
||||
else:
|
||||
tail = int(tail)
|
||||
if tail > len(l):
|
||||
tail = len(l)
|
||||
return jsonify(results=l[0:tail])
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
app.config.update(dict(
|
||||
RESULTS_PATH=os.path.abspath(args.results)
|
||||
))
|
||||
app.run(
|
||||
host=args.host,
|
||||
port=int(args.port)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -19,10 +19,10 @@ def main():
|
||||
argp.add_argument('--neo4j-latency',
|
||||
help='Path to the json of neo4j latency')
|
||||
args = argp.parse_args()
|
||||
|
||||
|
||||
fig = plt.gcf()
|
||||
fig.set_size_inches(10, 16)
|
||||
|
||||
|
||||
with open(args.neo4j_latency) as json_file:
|
||||
json_neo = json.load(json_file)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user