Removed hardcoded queries and modified run and init script

Reviewers: buda, mislav.bradac

Reviewed By: buda, mislav.bradac

Differential Revision: https://phabricator.memgraph.io/D332
This commit is contained in:
Matej Gradiček 2017-05-08 08:03:52 +00:00
parent fb18866aed
commit d29c38f6fd
2 changed files with 30 additions and 49 deletions

11
init
View File

@ -82,16 +82,6 @@ pip3 install -r requirements.txt
# TODO: use pullbot and read a password from program arg or env var
# (in order to use this script inside CI infrastructure)
# create tests folder
tests_folder=${script_dir}/tests
mkdir -p ${tests_folder}
# clone dressipi's tests
cd ${tests_folder}
if [[ $clone_dependencies = true ]]; then
rm -rf ${tests_folder}/*
git clone https://phabricator.memgraph.io/source/pilot_dressipi.git
fi
# clean dbms folder
dbms_folder=${script_dir}/dbms
@ -121,4 +111,3 @@ memgraph_build_dir=${script_dir}/dbms/memgraph/build
cd ${memgraph_build_dir}
cmake ..
make -j8
make copy_hardcoded_queries

68
run
View File

@ -1,24 +1,31 @@
#!/bin/bash
function print_usage_and_exit {
echo "./run [--unstable] [--no-test-hardcoded]"
echo "./run --test-suite test_suite [--unstable]"
echo "Required arguments:"
echo -e " --test-suite test_suite\trun test_suite scenarios, test_suite must be test folder in tck_engine/tests."
echo "Optional arguments:"
echo -e " --unstable\trun unstable scenarios"
echo -e " --no-test-hardcoded\tdon't run dressipi tests"
echo -e " --unstable\trun unstable scenarios"
exit 1
}
# exit if any subcommand returns a non-zero status
set -e
# read arguments
unstable=false
test_hardcoded=true
while [[ $# -gt 0 ]]; do
case $1 in
--unstable)
unstable=true
shift
;;
--no-test-hardcoded)
test_hardcoded=false
--test-suite)
if [ $# -eq 1 ]; then
print_usage_and_exit
fi
test_suite=$2
shift
shift
;;
*)
@ -28,8 +35,9 @@ while [[ $# -gt 0 ]]; do
esac
done
# exit if any subcommand returns a non-zero status
set -e
if [[ "$test_suite" = "" ]]; then
print_usage_and_exit
fi
## build memgraph
@ -50,41 +58,25 @@ cd ${memgraph_build_dir}
# binary is available after the build
binary_name=$(find ${memgraph_build_dir}/ -maxdepth 1 -executable -name "memgraph*")
# the script has to be careful because memgraph process will be detached
set +e
# run dressipi tests
if [[ $test_hardcoded = true ]]; then
# get full path to memgraph config for hardcoded queries
hardcoded_queries_config_path="${memgraph_src_dir}/config/hardcoded_queries_memgraph.yaml"
# run memgraph
MEMGRAPH_CONFIG=${hardcoded_queries_config_path} ${binary_name} 1>&2 &
# run Dressipi test
cd ${script_dir}/tests/pilot_dressipi
python run.py
exit_code=$?
if [[ ${exit_code} != 0 ]]; then
cleanup_and_exit ${exit_code}
fi
# kill memgraph for hardcoded queries
pkill -9 -f "${binary_name}"
fi
# get full path to memgraph config for interpreted queries
config_path="${memgraph_src_dir}/config/memgraph.yaml"
# run memgraph
MEMGRAPH_CONFIG=${config_path} ${binary_name} 1>&2 &
# run custom scenarios
# run scenarios
cd ${script_dir}
tck_flags="--root tck_engine/tests/memgraph_V1/features
--graphs-root tck_engine/tests/memgraph_V1/graphs
--no-side-effects
--db memgraph"
tck_flags="--root tck_engine/tests/$test_suite
--graphs-root tck_engine/tests/$test_suite
--no-side-effects --db memgraph"
if [[ $unstable = true ]]; then
tck_flags="$tck_flags --unstable"
fi
python tck_engine/test_executor.py $tck_flags
# the script has to be careful because memgraph process will be detached
set +e
# run memgraph
MEMGRAPH_CONFIG=${config_path} ${binary_name} 1>&2 &
python3 tck_engine/test_executor.py $tck_flags
cleanup_and_exit ${exit_code}