2019-07-08 10:46:04 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
kill_clickhouse () {
|
2019-12-18 10:43:40 +00:00
|
|
|
echo "clickhouse pids" `ps aux | grep clickhouse` | ts '%Y-%m-%d %H:%M:%S'
|
2019-12-11 13:42:08 +00:00
|
|
|
kill `pgrep -u clickhouse` 2>/dev/null
|
|
|
|
|
|
|
|
for i in {1..10}
|
2019-07-08 10:46:04 +00:00
|
|
|
do
|
2019-12-11 13:42:08 +00:00
|
|
|
if ! kill -0 `pgrep -u clickhouse`; then
|
2019-12-18 10:43:40 +00:00
|
|
|
echo "No clickhouse process" | ts '%Y-%m-%d %H:%M:%S'
|
2019-12-11 13:42:08 +00:00
|
|
|
break
|
|
|
|
else
|
2019-12-18 10:43:40 +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
|
2019-07-08 10:46:04 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2019-07-08 17:23:10 +00:00
|
|
|
wait_llvm_profdata () {
|
|
|
|
while kill -0 `pgrep llvm-profdata-9`;
|
|
|
|
do
|
2019-12-18 10:43:40 +00:00
|
|
|
echo "Waiting for profdata" `pgrep llvm-profdata-9` "still alive" | ts '%Y-%m-%d %H:%M:%S'
|
2019-07-08 17:23:10 +00:00
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2019-07-08 10:46:04 +00:00
|
|
|
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
|
|
|
merge_client_files_in_background () {
|
|
|
|
client_files=`ls /client_*profraw 2>/dev/null`
|
|
|
|
if [ ! -z "$client_files" ]
|
|
|
|
then
|
|
|
|
llvm-profdata-9 merge -sparse $client_files -o merged_client_`date +%s`.profraw
|
|
|
|
rm $client_files
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-07-08 10:46:04 +00:00
|
|
|
chmod 777 /
|
2019-07-08 15:41:15 +00:00
|
|
|
|
2019-07-08 10:46:04 +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/
|
|
|
|
|
2019-07-08 10:46:04 +00:00
|
|
|
ln -s /usr/share/clickhouse-test/config/zookeeper.xml /etc/clickhouse-server/config.d/; \
|
|
|
|
ln -s /usr/share/clickhouse-test/config/listen.xml /etc/clickhouse-server/config.d/; \
|
|
|
|
ln -s /usr/share/clickhouse-test/config/part_log.xml /etc/clickhouse-server/config.d/; \
|
2019-07-23 08:22:38 +00:00
|
|
|
ln -s /usr/share/clickhouse-test/config/text_log.xml /etc/clickhouse-server/config.d/; \
|
2019-08-13 14:31:46 +00:00
|
|
|
ln -s /usr/share/clickhouse-test/config/metric_log.xml /etc/clickhouse-server/config.d/; \
|
2019-09-05 10:10:01 +00:00
|
|
|
ln -s /usr/share/clickhouse-test/config/query_masking_rules.xml /etc/clickhouse-server/config.d/; \
|
2019-07-08 10:46:04 +00:00
|
|
|
ln -s /usr/share/clickhouse-test/config/log_queries.xml /etc/clickhouse-server/users.d/; \
|
|
|
|
ln -s /usr/share/clickhouse-test/config/readonly.xml /etc/clickhouse-server/users.d/; \
|
|
|
|
ln -s /usr/share/clickhouse-test/config/ints_dictionary.xml /etc/clickhouse-server/; \
|
|
|
|
ln -s /usr/share/clickhouse-test/config/strings_dictionary.xml /etc/clickhouse-server/; \
|
|
|
|
ln -s /usr/share/clickhouse-test/config/decimals_dictionary.xml /etc/clickhouse-server/; \
|
2019-10-10 10:26:57 +00:00
|
|
|
ln -s /usr/share/clickhouse-test/config/macros.xml /etc/clickhouse-server/config.d/; \
|
2020-02-19 10:07:35 +00:00
|
|
|
ln -s /usr/share/clickhouse-test/config/disks.xml /etc/clickhouse-server/config.d/; \
|
2020-02-21 19:00:32 +00:00
|
|
|
ln -s /usr/share/clickhouse-test/config/secure_ports.xml /etc/clickhouse-server/config.d/; \
|
|
|
|
ln -s /usr/share/clickhouse-test/config/server.key /etc/clickhouse-server/; \
|
|
|
|
ln -s /usr/share/clickhouse-test/config/server.crt /etc/clickhouse-server/; \
|
|
|
|
ln -s /usr/share/clickhouse-test/config/dhparam.pem /etc/clickhouse-server/; \
|
2020-02-22 01:35:28 +00:00
|
|
|
ln -sf /usr/share/clickhouse-test/config/client_config.xml /etc/clickhouse-client/config.xml; \
|
2019-07-08 10:46:04 +00:00
|
|
|
ln -s /usr/lib/llvm-8/bin/llvm-symbolizer /usr/bin/llvm-symbolizer
|
|
|
|
|
|
|
|
service zookeeper start
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
start_clickhouse
|
|
|
|
|
|
|
|
sleep 10
|
|
|
|
|
2019-07-08 17:23:10 +00:00
|
|
|
while /bin/true; do
|
|
|
|
merge_client_files_in_background
|
|
|
|
sleep 2
|
|
|
|
done &
|
|
|
|
|
2019-09-16 11:13:22 +00:00
|
|
|
LLVM_PROFILE_FILE='client_%h_%p_%m.profraw' clickhouse-test --testname --shard --zookeeper $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 ||:
|