2019-07-08 10:46:04 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
kill_clickhouse () {
|
2020-09-30 17:06:14 +00:00
|
|
|
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}
|
2019-07-08 10:46:04 +00:00
|
|
|
do
|
2020-09-30 17:06:14 +00:00
|
|
|
if ! kill -0 "$(pgrep -u clickhouse)"; then
|
2019-12-11 13:42:08 +00:00
|
|
|
echo "No clickhouse process"
|
|
|
|
break
|
|
|
|
else
|
2020-09-30 17:06:14 +00:00
|
|
|
echo "Process $(pgrep -u clickhouse) still alive"
|
2019-12-11 13:42:08 +00:00
|
|
|
sleep 10
|
|
|
|
fi
|
2019-07-08 10:46:04 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
start_clickhouse () {
|
|
|
|
LLVM_PROFILE_FILE='server_%h_%p_%m.profraw' sudo -Eu clickhouse /usr/bin/clickhouse-server --config /etc/clickhouse-server/config.xml &
|
|
|
|
}
|
|
|
|
|
2019-07-08 17:23:10 +00:00
|
|
|
wait_llvm_profdata () {
|
2020-09-30 17:06:14 +00:00
|
|
|
while kill -0 "$(pgrep llvm-profdata-10)"
|
2019-07-08 17:23:10 +00:00
|
|
|
do
|
2020-09-30 17:06:14 +00:00
|
|
|
echo "Waiting for profdata $(pgrep llvm-profdata-10) still alive"
|
2019-07-08 17:23:10 +00:00
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
merge_client_files_in_background () {
|
2020-09-30 17:06:14 +00:00
|
|
|
client_files=$(ls /client_*profraw 2>/dev/null)
|
|
|
|
if [ -n "$client_files" ]
|
2019-07-08 17:23:10 +00:00
|
|
|
then
|
2020-09-30 17:06:14 +00:00
|
|
|
llvm-profdata-10 merge -sparse "$client_files" -o "merged_client_$(date +%s).profraw"
|
|
|
|
rm "$client_files"
|
2019-07-08 17:23:10 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-07-08 10:46:04 +00:00
|
|
|
chmod 777 /
|
|
|
|
|
|
|
|
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/log/clickhouse-server/
|
|
|
|
|
2020-09-24 08:18:36 +00:00
|
|
|
# install test configs
|
|
|
|
/usr/share/clickhouse-test/config/install.sh
|
2019-07-08 10:46:04 +00:00
|
|
|
|
2020-09-03 01:54:50 +00:00
|
|
|
function start()
|
|
|
|
{
|
|
|
|
counter=0
|
|
|
|
until clickhouse-client --query "SELECT 1"
|
|
|
|
do
|
|
|
|
if [ "$counter" -gt 120 ]
|
|
|
|
then
|
|
|
|
echo "Cannot start clickhouse-server"
|
|
|
|
cat /var/log/clickhouse-server/stdout.log
|
|
|
|
tail -n1000 /var/log/clickhouse-server/stderr.log
|
|
|
|
tail -n1000 /var/log/clickhouse-server/clickhouse-server.log
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
timeout 120 service clickhouse-server start
|
|
|
|
sleep 0.5
|
2020-09-30 17:06:14 +00:00
|
|
|
counter=$((counter + 1))
|
2020-09-03 01:54:50 +00:00
|
|
|
done
|
|
|
|
}
|
2019-07-08 17:23:10 +00:00
|
|
|
|
2020-09-03 01:54:50 +00:00
|
|
|
start
|
2019-07-08 10:46:04 +00:00
|
|
|
|
2020-10-01 09:27:05 +00:00
|
|
|
# shellcheck disable=SC2086 # No quotes because I want to split it into words.
|
|
|
|
if ! /s3downloader --dataset-names $DATASETS; then
|
2020-03-08 15:21:48 +00:00
|
|
|
echo "Cannot download datatsets"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-07-08 15:41:15 +00:00
|
|
|
|
2019-07-08 10:46:04 +00:00
|
|
|
chmod 777 -R /var/lib/clickhouse
|
|
|
|
|
2019-07-08 17:23:10 +00:00
|
|
|
while /bin/true; do
|
|
|
|
merge_client_files_in_background
|
|
|
|
sleep 2
|
|
|
|
done &
|
|
|
|
|
|
|
|
LLVM_PROFILE_FILE='client_%h_%p_%m.profraw' clickhouse-client --query "SHOW DATABASES"
|
2019-12-16 18:29:18 +00:00
|
|
|
LLVM_PROFILE_FILE='client_%h_%p_%m.profraw' clickhouse-client --query "ATTACH DATABASE datasets ENGINE = Ordinary"
|
2019-07-08 17:23:10 +00:00
|
|
|
LLVM_PROFILE_FILE='client_%h_%p_%m.profraw' clickhouse-client --query "CREATE DATABASE test"
|
2019-07-08 10:46:04 +00:00
|
|
|
|
|
|
|
kill_clickhouse
|
|
|
|
start_clickhouse
|
|
|
|
|
|
|
|
sleep 10
|
|
|
|
|
2019-07-08 17:23:10 +00:00
|
|
|
LLVM_PROFILE_FILE='client_%h_%p_%m.profraw' clickhouse-client --query "SHOW TABLES FROM datasets"
|
|
|
|
LLVM_PROFILE_FILE='client_%h_%p_%m.profraw' clickhouse-client --query "SHOW TABLES FROM test"
|
|
|
|
LLVM_PROFILE_FILE='client_%h_%p_%m.profraw' clickhouse-client --query "RENAME TABLE datasets.hits_v1 TO test.hits"
|
|
|
|
LLVM_PROFILE_FILE='client_%h_%p_%m.profraw' clickhouse-client --query "RENAME TABLE datasets.visits_v1 TO test.visits"
|
|
|
|
LLVM_PROFILE_FILE='client_%h_%p_%m.profraw' clickhouse-client --query "SHOW TABLES FROM test"
|
2020-07-08 08:41:39 +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
|
|
|
|
|
2020-10-15 11:56:12 +00:00
|
|
|
# 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_%h_%p_%m.profraw' clickhouse-test --testname --shard --zookeeper --no-stateless --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
|
2019-07-08 10:46:04 +00:00
|
|
|
|
|
|
|
kill_clickhouse
|
|
|
|
|
2019-07-08 17:23:10 +00:00
|
|
|
wait_llvm_profdata
|
|
|
|
|
|
|
|
sleep 3
|
|
|
|
|
|
|
|
wait_llvm_profdata # 100% merged all parts
|
|
|
|
|
|
|
|
|
2019-07-08 10:46:04 +00:00
|
|
|
cp /*.profraw /profraw ||:
|