ClickHouse/docker/test/stateless_with_coverage/run.sh

65 lines
1.9 KiB
Bash
Raw Normal View History

#!/bin/bash
kill_clickhouse () {
2020-09-30 17:06:14 +00:00
echo "clickhouse pids $(pgrep -u clickhouse)" | ts '%Y-%m-%d %H:%M:%S'
kill "$(pgrep -u clickhouse)" 2>/dev/null
2019-12-11 13:42:08 +00:00
2020-09-30 17:06:14 +00:00
for _ in {1..10}
do
2020-09-30 17:06:14 +00:00
if ! kill -0 "$(pgrep -u clickhouse)"; then
echo "No clickhouse process" | ts '%Y-%m-%d %H:%M:%S'
2019-12-11 13:42:08 +00:00
break
else
2020-09-30 17:06:14 +00:00
echo "Process $(pgrep -u clickhouse) still alive" | ts '%Y-%m-%d %H:%M:%S'
2019-12-11 13:42:08 +00:00
sleep 10
fi
done
2020-04-16 12:26:57 +00:00
echo "Will try to send second kill signal for sure"
2020-09-30 17:06:14 +00:00
kill "$(pgrep -u clickhouse)" 2>/dev/null
2020-04-16 12:26:57 +00:00
sleep 5
2020-09-30 17:06:14 +00:00
echo "clickhouse pids $(pgrep -u clickhouse)" | ts '%Y-%m-%d %H:%M:%S'
}
start_clickhouse () {
LLVM_PROFILE_FILE='server_%h_%p_%m.profraw' sudo -Eu clickhouse /usr/bin/clickhouse-server --config /etc/clickhouse-server/config.xml &
}
chmod 777 /
2019-07-08 15:41:15 +00:00
dpkg -i package_folder/clickhouse-common-static_*.deb; \
dpkg -i package_folder/clickhouse-common-static-dbg_*.deb; \
dpkg -i package_folder/clickhouse-server_*.deb; \
dpkg -i package_folder/clickhouse-client_*.deb; \
dpkg -i package_folder/clickhouse-test_*.deb
2019-07-08 15:41:15 +00:00
mkdir -p /var/lib/clickhouse
mkdir -p /var/log/clickhouse-server
chmod 777 -R /var/lib/clickhouse
chmod 777 -R /var/log/clickhouse-server/
2020-09-24 08:18:36 +00:00
# install test configs
/usr/share/clickhouse-test/config/install.sh
start_clickhouse
sleep 10
2020-07-08 09:47:14 +00:00
2020-09-30 17:06:14 +00:00
if grep -q -- "--use-skip-list" /usr/bin/clickhouse-test; then
2020-07-08 08:41:39 +00:00
SKIP_LIST_OPT="--use-skip-list"
fi
# We can have several additional options so we path them as array because it's
# more idiologically correct.
read -ra ADDITIONAL_OPTIONS <<< "${ADDITIONAL_OPTIONS:-}"
LLVM_PROFILE_FILE='client_coverage.profraw' clickhouse-test --testname --shard --zookeeper --hung-check --print-time "$SKIP_LIST_OPT" "${ADDITIONAL_OPTIONS[@]}" "$SKIP_TESTS_OPTION" 2>&1 | ts '%Y-%m-%d %H:%M:%S' | tee test_output/test_result.txt
kill_clickhouse
2019-07-08 17:23:10 +00:00
sleep 3
cp /*.profraw /profraw ||: