1#!/usr/bin/env bash 2# 3# This file is part of PerconaFT. 4# Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. 5# 6# run a sequence of hotindexer undo tests. 7 8tests="" 9verbose=0 10valgrind="" 11exitcode=0 12 13for arg in $* ; do 14 if [[ $arg =~ --(.*)=(.*) ]] ; then 15 eval ${BASH_REMATCH[1]}=${BASH_REMATCH[2]} 16 else 17 tests="$tests $arg" 18 fi 19done 20 21for t in $tests ; do 22 testdir=`dirname $t` 23 testfile=`basename $t` 24 testname="" 25 resultfile="" 26 if [[ $testfile =~ (.*)\.test$ ]] ; then 27 testname=${BASH_REMATCH[1]} 28 resultfile=$testname.result 29 else 30 exit 1 31 fi 32 if [ $verbose != 0 ] ; then echo $testdir $testname $testfile $resultfile; fi 33 34 $valgrind ./hotindexer-undo-do-test.tdb $testdir/$testfile >$testdir/$testname.run 35 36 if [ -f $testdir/$resultfile ] ; then 37 diff -q $testdir/$testname.run $testdir/$resultfile >/dev/null 2>&1 38 exitcode=$? 39 else 40 exitcode=1 41 fi 42 if [ $verbose != 0 ] ; then 43 echo $testname $exitcode 44 else 45 rm $testdir/$testname.run 46 fi 47 if [ $exitcode != 0 ] ; then break; fi 48done 49 50exit $exitcode 51