29a7b12e22
Summary: The main init script now calls qa init. QA CI script now runs the tests. QA run script now returns a good exit code. Explicitly bind to 127.0.0.1. localhost on some machines resolves to an IPv6 address, and Memgraph listens exclusively on IPv4. Reviewers: buda Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D583
91 lines
2.1 KiB
Bash
Executable File
91 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
function print_usage_and_exit {
|
|
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"
|
|
exit 1
|
|
}
|
|
|
|
# exit if any subcommand returns a non-zero status
|
|
set -e
|
|
|
|
# read arguments
|
|
unstable=false
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
--unstable)
|
|
unstable=true
|
|
shift
|
|
;;
|
|
--test-suite)
|
|
if [ $# -eq 1 ]; then
|
|
print_usage_and_exit
|
|
fi
|
|
test_suite=$2
|
|
shift
|
|
shift
|
|
;;
|
|
*)
|
|
# unknown option
|
|
print_usage_and_exit
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [[ "$test_suite" = "" ]]; then
|
|
print_usage_and_exit
|
|
fi
|
|
|
|
# save the path where this script is
|
|
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
memgraph_src_dir=${script_dir}/../..
|
|
memgraph_build_dir=${memgraph_src_dir}/build
|
|
|
|
# activate virtualenv
|
|
source $script_dir/ve3/bin/activate
|
|
|
|
cd ${memgraph_build_dir}
|
|
# binary is available after the build
|
|
binary_name=memgraph
|
|
|
|
# get full path to memgraph config for interpreted queries
|
|
config_path="${memgraph_src_dir}/config/testing.conf"
|
|
|
|
# run scenarios
|
|
cd ${script_dir}
|
|
tck_flags="--root tck_engine/tests/$test_suite
|
|
--no-side-effects --db memgraph"
|
|
|
|
if [[ $unstable = true ]]; then
|
|
tck_flags="$tck_flags --unstable"
|
|
fi
|
|
|
|
|
|
# the script has to be careful because memgraph process will be detached
|
|
set +e
|
|
|
|
# run memgraph
|
|
MEMGRAPH_CONFIG="$config_path" "$memgraph_build_dir/$binary_name" 1>&2 &
|
|
background_pid=$!
|
|
|
|
function cleanup_and_exit {
|
|
kill -9 $background_pid
|
|
exit $1
|
|
}
|
|
|
|
sleep 0.1
|
|
|
|
ps -p $background_pid > /dev/null
|
|
if [[ $? -ne 0 ]]; then
|
|
echo "Starting memgraph failed."
|
|
echo "Perhaps you forgot to build Memgraph before running this script, "
|
|
echo "or another program uses same port!"
|
|
cleanup_and_exit 1
|
|
fi
|
|
|
|
python3 tck_engine/test_executor.py $tck_flags
|
|
cleanup_and_exit $?
|