Remove hardcoded build directory in build_examples

Reviewers: mferencevic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1323
This commit is contained in:
Teon Banek 2018-03-27 17:14:09 +02:00
parent c4a0da6054
commit b342b09b49
2 changed files with 25 additions and 12 deletions
release/examples
src

View File

@ -1,5 +1,26 @@
#!/bin/bash -e
function print_help () {
echo "Usage: $0 MEMGRAPH_BUILD_DIR"
echo "Build example snapshots using the compiled memgraph."
}
if [[ $# -ne 1 ]]; then
print_help
exit 1
fi
memgraph_exe="$1/memgraph"
if [[ ! -x ${memgraph_exe} ]]; then
echo "Expected memgraph executable at '${memgraph_exe}'"
exit 1
fi
bolt_client_exe="$1/tests/manual/bolt_client"
if [[ ! -x ${bolt_client_exe} ]]; then
echo "Expected bolt_client executable at '${bolt_client_exe}'"
exit 1
fi
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
build_dir="build"
query="populate.cyp"
@ -12,7 +33,6 @@ fi
mkdir "$build_dir"
for dir in queries/*/
do
cd $script_dir # position to script execution dir
@ -26,20 +46,13 @@ do
# run memgraph with durability_directory pointing
# to examples snapshots_dir
cd ../..
if [ ! -d build ]; then
cd build_release
else
cd build
fi
./memgraph --durability-directory "$script_dir/$snapshots_dir/" \
--snapshot-on-exit > /dev/null 2>&1 &
${memgraph_exe} --durability-directory "$script_dir/$snapshots_dir/" \
--snapshot-on-exit > /dev/null 2>&1 &
memgraph_pid=$!
sleep 2 # wait for memgraph to start
cd tests/manual
# create data using bolt-client
./bolt_client < "$script_dir/$dir/$query" > /dev/null 2>&1 || exit 1
${bolt_client_exe} < "$script_dir/$dir/$query" > /dev/null 2>&1 || exit 1
# kill memgraph
kill $memgraph_pid

View File

@ -143,6 +143,6 @@ install(FILES ${CMAKE_SOURCE_DIR}/release/memgraph.service
# Install examples
set(examples ${CMAKE_SOURCE_DIR}/release/examples)
install(CODE "execute_process(COMMAND ${examples}/build_examples
install(CODE "execute_process(COMMAND ${examples}/build_examples ${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${examples})")
install(DIRECTORY ${examples}/build/ DESTINATION share/memgraph/examples)