From 8e1a897b7af846ee228ca06e2142fb105b361cfe Mon Sep 17 00:00:00 2001 From: Dominik Gleich Date: Mon, 6 Mar 2017 13:54:39 +0100 Subject: [PATCH] Fix query integration test because of config. Fix hardcoded queries not working because of include bug. Summary: #1 Hardcoded query integration test was failling because the .so files couldn't be linked, because of wrong compiled directory path (missing config flag). #2 Hardcoded query not working in production because typed_value changed so some includes didn't work. Reviewers: florijan, buda Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D90 --- CMakeLists.txt | 2 +- src/query/plan_compiler.hpp | 4 ++-- src/query/plan_template_cpp | 5 +++-- src/utils/config/config.hpp | 2 +- tests/integration/query_engine.cpp | 6 ++++++ 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ec979ca4..68ffa5e34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,7 +362,7 @@ endif() # ----------------------------------------------------------------------------- execute_process( - COMMAND ./recursive_include --roots ${src_dir} ${libs_dir} --start ${src_dir}/query/plan_interface.hpp --copy ${CMAKE_BINARY_DIR}/include + COMMAND ./recursive_include --roots ${src_dir} ${libs_dir} --start ${src_dir}/query/plan_template_cpp --copy ${CMAKE_BINARY_DIR}/include WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake ) diff --git a/src/query/plan_compiler.hpp b/src/query/plan_compiler.hpp index e6b5b175c..e546da912 100644 --- a/src/query/plan_compiler.hpp +++ b/src/query/plan_compiler.hpp @@ -64,8 +64,8 @@ class PlanCompiler : public Loggable { in_file, // input file "-o", out_file, // ouput file "-I./include", "-I../include", "-I../../include", "-I../../../include", - "-I./libs/fmt", "-I../libs/fmt", "-I../../libs/fmt", "-I../../../libs/fmt", - "-L./ -L../ -L../../", "-lmemgraph_pic", + "-I./libs/fmt", "-I../libs/fmt", "-I../../libs/fmt", + "-I../../../libs/fmt", "-L./ -L../ -L../../", "-lmemgraph_pic", "-shared -fPIC" // shared library flags ); diff --git a/src/query/plan_template_cpp b/src/query/plan_template_cpp index 5319ad54b..1b39dc044 100644 --- a/src/query/plan_template_cpp +++ b/src/query/plan_template_cpp @@ -1,9 +1,10 @@ #include #include -#include "query/util.hpp" +#include "communication/bolt/v1/serialization/record_stream.hpp" +#include "io/network/socket.hpp" +#include "query/backend/cpp/typed_value.hpp" #include "query/plan_interface.hpp" -#include "storage/model/properties/all.hpp" using std::cout; using std::endl; diff --git a/src/utils/config/config.hpp b/src/utils/config/config.hpp index 6ed7f8ab7..1677bd66d 100644 --- a/src/utils/config/config.hpp +++ b/src/utils/config/config.hpp @@ -74,6 +74,6 @@ class Config { } } - std::string operator[](const char* key) { return dict[key]; } + std::string& operator[](const char* key) { return dict[key]; } }; } diff --git a/tests/integration/query_engine.cpp b/tests/integration/query_engine.cpp index df8a425f6..d6591d0dd 100644 --- a/tests/integration/query_engine.cpp +++ b/tests/integration/query_engine.cpp @@ -1,3 +1,6 @@ +#define HARDCODED_OUTPUT_STREAM + +#include "config/config.hpp" #include "dbms/dbms.hpp" #include "query_engine_common.hpp" @@ -23,6 +26,9 @@ int main(int argc, char *argv[]) { * init engine */ auto log = init_logging("IntegrationQueryEngine"); + // Manually set config compile_path to avoid loading whole config file with + // the test. + CONFIG(config::COMPILE_PATH) = "../compiled/"; Dbms dbms; StreamT stream(std::cout); QueryEngineT query_engine;