From bd7d13835ea461f024fc036e519afd13e63f9e32 Mon Sep 17 00:00:00 2001 From: Aaron Gao Date: Fri, 31 Mar 2017 18:40:45 -0700 Subject: [PATCH] test remote instead run remote in regression test Summary: avoid exit when $? != 0 Closes https://github.com/facebook/rocksdb/pull/2076 Differential Revision: D4815655 Pulled By: lightmark fbshipit-source-id: 829299e --- tools/regression_test.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tools/regression_test.sh b/tools/regression_test.sh index 350b2548d..2165d69c8 100755 --- a/tools/regression_test.sh +++ b/tools/regression_test.sh @@ -126,9 +126,9 @@ function main { if [ $TEST_MODE -le 1 ]; then tmp=$DB_PATH DB_PATH=$ORIGIN_PATH - run_remote "test -d $DB_PATH" - if [[ $? -ne 0 ]] || [[ $(run_remote 'echo $(( $(date +"%s") - $(stat -c "%Y" '"$a"') ))') -gt "604800" ]]; then - rm -rf "$DB_PATH" + test_remote "test -d $DB_PATH" + if [[ $? -ne 0 ]] || [[ $(run_remote 'echo $(( $(date +"%s") - $(stat -c "%Y" '"$DB_PATH"') ))') -gt "604800" ]]; then + run_remote "rm -rf $DB_PATH" echo "Building DB..." run_db_bench "fillseqdeterministic" $NUM_KEYS 1 0 fi @@ -355,14 +355,17 @@ function build_db_bench_and_ldb { } function run_remote { - if ! [ -z "$REMOTE_USER_AT_HOST" ]; then - cmd="$SSH $REMOTE_USER_AT_HOST $1" - else - cmd="$1" - fi + test_remote "$1" + exit_on_error $? "$1" +} +function test_remote { + if ! [ -z "$REMOTE_USER_AT_HOST" ]; then + cmd="$SSH $REMOTE_USER_AT_HOST $1" + else + cmd="$1" + fi eval "$cmd" - exit_on_error $? "$cmd" } function run_local {