#!/bin/bash
echo massive ddl test start
rm -rf ./massive-ddl-server
rm -rf ./tidb*.log

go build
go build -o massiveddl_tidb-server github.com/pingcap/tidb/tidb-server

if [ "${TIDB_TEST_STORE_NAME}" = "tikv" ]; then
    ./massiveddl_tidb-server -config config.toml -store tikv -path "${TIKV_PATH}" &>tidb.log &
else
    ./massiveddl_tidb-server -config config.toml &>tidb.log &
fi
SERVER_PID=$!

sleep 3

./massive_ddl_test 

EXIT_CODE=$?

kill -9 $SERVER_PID

echo massive ddl test end
exit $EXIT_CODE
