2017-06-09 15:28:18 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-08-22 22:05:38 +08:00
|
|
|
pushd () { command pushd "$@" > /dev/null; }
|
|
|
|
popd () { command popd "$@" > /dev/null; }
|
2017-06-09 15:28:18 +08:00
|
|
|
|
2018-08-22 22:05:38 +08:00
|
|
|
function wait_for_server {
|
|
|
|
port=$1
|
|
|
|
while ! nc -z -w 1 127.0.0.1 $port; do
|
|
|
|
sleep 0.1
|
|
|
|
done
|
|
|
|
sleep 1
|
2017-06-09 15:28:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2018-08-22 22:05:38 +08:00
|
|
|
cd "$DIR"
|
|
|
|
|
|
|
|
# Create a temporary directory.
|
|
|
|
tmpdir=/tmp/memgraph_drivers
|
|
|
|
if [ -d $tmpdir ]; then
|
|
|
|
rm -rf $tmpdir
|
|
|
|
fi
|
|
|
|
mkdir -p $tmpdir
|
|
|
|
|
|
|
|
# Find memgraph binaries.
|
|
|
|
binary_dir="$DIR/../../build"
|
|
|
|
|
|
|
|
# Start memgraph.
|
|
|
|
$binary_dir/memgraph \
|
2019-12-05 20:24:30 +08:00
|
|
|
--data-directory=$tmpdir \
|
2019-11-25 22:08:16 +08:00
|
|
|
--query-execution-timeout-sec=5 \
|
2020-09-21 18:22:40 +08:00
|
|
|
--bolt-session-inactivity-timeout=10 \
|
2020-10-16 18:49:33 +08:00
|
|
|
--bolt-cert-file="" \
|
|
|
|
--bolt-server-name-for-init="Neo4j/1.1" \
|
2020-09-21 18:22:40 +08:00
|
|
|
--min-log-level 1 &
|
2018-08-22 22:05:38 +08:00
|
|
|
pid=$!
|
|
|
|
wait_for_server 7687
|
2017-06-09 15:28:18 +08:00
|
|
|
|
2018-08-22 22:05:38 +08:00
|
|
|
# Run all available tests
|
|
|
|
code_test=0
|
2017-06-09 15:28:18 +08:00
|
|
|
for i in *; do
|
|
|
|
if [ ! -d $i ]; then continue; fi
|
|
|
|
pushd $i
|
|
|
|
echo "Running: $i"
|
2020-10-16 18:49:33 +08:00
|
|
|
# run all versions
|
|
|
|
for v in *; do
|
|
|
|
if [ ! -d $v ]; then continue; fi
|
|
|
|
pushd $v
|
|
|
|
echo "Running version: $v"
|
|
|
|
./run.sh
|
|
|
|
code_test=$?
|
|
|
|
if [ $code_test -ne 0 ]; then
|
|
|
|
echo "FAILED: $i"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
done;
|
2017-06-09 15:28:18 +08:00
|
|
|
echo
|
|
|
|
popd
|
|
|
|
done
|
2018-08-22 22:05:38 +08:00
|
|
|
|
|
|
|
# Stop memgraph.
|
|
|
|
kill $pid
|
2020-09-21 18:22:40 +08:00
|
|
|
wait $pid
|
2018-08-22 22:05:38 +08:00
|
|
|
code_mg=$?
|
|
|
|
|
|
|
|
# Temporary directory cleanup.
|
|
|
|
if [ -d $tmpdir ]; then
|
|
|
|
rm -rf $tmpdir
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check memgraph exit code.
|
|
|
|
if [ $code_mg -ne 0 ]; then
|
|
|
|
echo "The memgraph process didn't terminate properly!"
|
|
|
|
exit $code_mg
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check test exit code.
|
|
|
|
if [ $code_test -ne 0 ]; then
|
|
|
|
echo "One of the tests failed!"
|
|
|
|
exit $code_test
|
|
|
|
fi
|