ClickHouse/docker/test/sqlancer/run.sh

63 lines
1.8 KiB
Bash
Raw Normal View History

2021-01-13 09:49:52 +00:00
#!/bin/bash
2022-10-17 13:10:31 +00:00
set -exu
trap "exit" INT TERM
2021-01-13 09:49:52 +00:00
2022-10-17 14:46:50 +00:00
function wget_with_retry
{
for _ in 1 2 3 4; do
if wget -nv -nd -c "$1";then
return 0
else
sleep 0.5
fi
done
return 1
}
if [ -z ${BINARY_URL_TO_DOWNLOAD+x} ]
then
echo "No BINARY_URL_TO_DOWNLOAD provided."
else
wget_with_retry "$BINARY_URL_TO_DOWNLOAD"
chmod +x /clickhouse
fi
if [[ -f "/clickhouse" ]]; then
echo "/clickhouse exists"
else
exit 1
fi
2022-10-19 16:30:01 +00:00
cd /workspace
/clickhouse server -P /workspace/clickhouse-server.pid -L /workspace/clickhouse-server.log -E /workspace/clickhouse-server.log.err --daemon
2021-01-13 09:49:52 +00:00
2022-10-27 09:06:11 +00:00
for _ in $(seq 1 60); do if [[ $(wget -q 'localhost:8123' -O-) == 'Ok.' ]]; then break ; else sleep 1; fi ; done
2021-01-13 09:49:52 +00:00
cd /sqlancer/sqlancer-master
2022-10-27 09:06:11 +00:00
TIMEOUT=300
NUM_QUERIES=1000
NUM_THREADS=10
TESTS=( "TLPGroupBy" "TLPHaving" "TLPWhere" "TLPDistinct" "TLPAggregate" "NoREC" )
2022-10-27 13:30:35 +00:00
echo "${TESTS[@]}"
2022-10-27 09:06:11 +00:00
2022-10-27 13:30:35 +00:00
for TEST in "${TESTS[@]}"; do
echo "$TEST"
2022-10-27 09:06:11 +00:00
if [[ $(wget -q 'localhost:8123' -O-) == 'Ok.' ]]
then
echo "Server is OK"
2022-10-27 14:08:23 +00:00
( java -jar target/sqlancer-*.jar --log-each-select true --print-failed false --num-threads "$NUM_THREADS" --timeout-seconds "$TIMEOUT" --num-queries "$NUM_QUERIES" --username default --password "" clickhouse --oracle "$TEST" | tee "/workspace/$TEST.out" ) 3>&1 1>&2 2>&3 | tee "/workspace/$TEST.err"
2022-10-27 09:06:11 +00:00
else
2022-10-27 13:30:35 +00:00
touch "/workspace/$TEST.err" "/workspace/$TEST.out"
2022-10-27 09:06:11 +00:00
echo "Server is not responding" | tee /workspace/server_crashed.log
fi
done
2021-01-15 14:36:27 +00:00
2022-10-19 16:30:01 +00:00
ls /workspace
2022-10-27 09:06:11 +00:00
pkill -F /workspace/clickhouse-server.pid || true
2022-10-17 13:10:31 +00:00
2022-10-27 09:06:11 +00:00
for _ in $(seq 1 60); do if [[ $(wget -q 'localhost:8123' -O-) == 'Ok.' ]]; then sleep 1 ; else break; fi ; done
2022-10-17 13:10:31 +00:00
2022-10-19 16:30:01 +00:00
/process_sqlancer_result.py || echo -e "failure\tCannot parse results" > /workspace/check_status.tsv
ls /workspace