Allow run test under gdb

This commit is contained in:
proller 2018-03-15 18:09:44 +03:00
parent b39fa2027d
commit d9848d8904

View File

@ -28,19 +28,32 @@ mkdir -p $LOG_DIR
openssl dhparam -out `${BIN_DIR}clickhouse-extract-from-config --config=$CLICKHOUSE_CONFIG --key=openSSL.server.dhParamsFile` 256
openssl req -subj "/CN=localhost" -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout `${BIN_DIR}clickhouse-extract-from-config --config=$CLICKHOUSE_CONFIG --key=openSSL.server.privateKeyFile` -out `${BIN_DIR}clickhouse-extract-from-config --config=$CLICKHOUSE_CONFIG --key=openSSL.server.certificateFile`
if [ "$TEST_GDB" ]; then
echo -e "run \nset pagination off \nset logging file $DATA_DIR/gdb.log \nset logging on \nthread apply all backtrace \ndetach \nquit " > $DATA_DIR/gdb.cmd
GDB="gdb -x $DATA_DIR/gdb.cmd --args "
fi
# Start a local clickhouse server which will be used to run tests
#PATH=$PATH:$BIN_DIR \
${BIN_DIR}clickhouse-server --config-file=${CLICKHOUSE_CONFIG} > $LOG_DIR/stdout 2>&1 &
$GDB ${BIN_DIR}clickhouse-server --config-file=${CLICKHOUSE_CONFIG} > $LOG_DIR/stdout 2>&1 &
CH_PID=$!
sleep 3
if [ "$GDB" ]; then
# Long symbols read
sleep 40
fi
tail -n50 $LOG_DIR/*
# Define needed stuff to kill test clickhouse server after tests completion
function finish {
kill $CH_PID || true
wait
tail -n 50 $LOG_DIR/stdout
tail -n 50 $LOG_DIR/*
if [ "$GDB" ]; then
cat $DATA_DIR/gdb.log || true
fi
rm -rf $DATA_DIR
}
trap finish EXIT SIGINT SIGQUIT SIGTERM