Skip to content

Commit 076a806

Browse files
committed
tweak test script
1 parent ffef446 commit 076a806

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

localtests/test.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ master_port=
2525
replica_host=
2626
replica_port=
2727
original_sql_mode=
28-
gen_load_pid=0
28+
gen_load_pid=
2929

3030
OPTIND=1
3131
while getopts "b:s:d" OPTION; do
@@ -48,7 +48,7 @@ test_pattern="${1:-.}"
4848
verify_master_and_replica() {
4949
if [ "$(gh-ost-test-mysql-master -e "select 1" -ss)" != "1" ]; then
5050
echo "Cannot verify gh-ost-test-mysql-master"
51-
exit 1
51+
enull bitmapxit 1
5252
fi
5353
read master_host master_port <<<$(gh-ost-test-mysql-master -e "select @@hostname, @@port" -ss)
5454
[ "$master_host" == "$(hostname)" ] && master_host="127.0.0.1"
@@ -119,18 +119,18 @@ generate_load_cmd() {
119119
--mysql-user=root \
120120
--mysql-password=opensesame \
121121
--mysql-db=test \
122-
--table-size=100000 \
122+
--rand-seed=163
123123
--tables=1 \
124124
--threads=8 \
125-
--time=60 \
125+
--time=30 \
126126
--report-interval=10 \
127-
--rate=200 \
127+
--rate=800 \
128128
run"
129129
echo $cmd
130130
}
131131

132132
cleanup() {
133-
if [ $gen_load_pid -gt 0 ]; then
133+
if ! [ -z $gen_load_pid ] && ps -p $gen_load_pid >/dev/null; then
134134
kill $gen_load_pid
135135
fi
136136
}
@@ -202,16 +202,16 @@ test_single() {
202202

203203
table_name="gh_ost_test"
204204

205-
# run gh-ost with sysbench write load
205+
# run gh-ost with sysbench write load.
206+
# It does nothing if sysbench is not available.
206207
trap cleanup EXIT INT TERM
207208
if [[ "$test_name" == "sysbench" ]]; then
208209
table_name="sbtest1"
209210
load_cmd="$(generate_load_cmd $master_host $master_port)"
210-
echo $load_cmd >$generate_load_file
211-
bash $generate_load_file 1>$test_logfile 2>&1 &
211+
eval "$load_cmd" &
212212
gen_load_pid=$!
213213
echo
214-
echo "Started sysbench (PID $gen_load_pid)"
214+
echo -n "Started sysbench (PID $gen_load_pid): "
215215
echo $load_cmd
216216
fi
217217

0 commit comments

Comments
 (0)