From 00a4d1f9604040fc0bab0395410ce41a30b39300 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Mon, 26 Feb 2018 14:32:58 +0200 Subject: [PATCH] prebuilt binary for localtests --- localtests/test.sh | 24 +++++++++++++++++++++--- script/cibuild-gh-ost-replica-tests | 3 ++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/localtests/test.sh b/localtests/test.sh index 71df2c5..db34f85 100755 --- a/localtests/test.sh +++ b/localtests/test.sh @@ -9,17 +9,30 @@ tests_path=$(dirname $0) test_logfile=/tmp/gh-ost-test.log -ghost_binary=/tmp/gh-ost-test +default_ghost_binary=/tmp/gh-ost-test +ghost_binary="" exec_command_file=/tmp/gh-ost-test.bash orig_content_output_file=/tmp/gh-ost-test.orig.content.csv ghost_content_output_file=/tmp/gh-ost-test.ghost.content.csv -test_pattern="${1:-.}" master_host= master_port= replica_host= replica_port= +OPTIND=1 +while getopts "b:" OPTION +do + case $OPTION in + b) + ghost_binary="$OPTARG" + ;; + esac +done +shift $((OPTIND-1)) + +test_pattern="${1:-.}" + verify_master_and_replica() { if [ "$(gh-ost-test-mysql-master -e "select 1" -ss)" != "1" ] ; then echo "Cannot verify gh-ost-test-mysql-master" @@ -176,7 +189,12 @@ test_single() { build_binary() { echo "Building" - rm -f $ghost_binary + rm -f $default_ghost_binary + [ "$ghost_binary" == "" ] && ghost_binary="$default_ghost_binary" + if [ -f "$ghost_binary" ] ; then + echo "Using binary: $ghost_binary" + return 0 + fi go build -o $ghost_binary go/cmd/gh-ost/main.go if [ $? -ne 0 ] ; then echo "Build failure" diff --git a/script/cibuild-gh-ost-replica-tests b/script/cibuild-gh-ost-replica-tests index 51e66aa..56d7b62 100755 --- a/script/cibuild-gh-ost-replica-tests +++ b/script/cibuild-gh-ost-replica-tests @@ -27,6 +27,7 @@ export PATH="${PWD}/gh-ost-ci-env/bin/:${PATH}" gh-ost-test-mysql-master -uroot -e "grant all on *.* to 'gh-ost'@'%' identified by 'gh-ost'" echo "# Running localtests" -./localtests/test.sh +. script/build +./localtests/test.sh -b bin/gh-ost sandboxes/rsandbox_5_7_21/stop_all