diff --git a/shell/regression/Makefile.am b/shell/regression/Makefile.am index afa53cdd34..d3f63369b7 100644 --- a/shell/regression/Makefile.am +++ b/shell/regression/Makefile.am @@ -1,27 +1,27 @@ # # Author: Sun Jiang Dong # Copyright (c) 2004 International Business Machines # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MAINTAINERCLEANFILES = Makefile.in SUBDIRS = testcases testdir = $(datadir)/$(PACKAGE)/tests/shell -test_SCRIPTS = regression.sh evaltest.sh lrmregtest-lsb +test_SCRIPTS = regression.sh evaltest.sh test_DATA = README.regression defaults descriptions crm-interface empty.xml # shouldn't need this, but we do for some versions of autofoo tools EXTRA_DIST = $(test_SCRIPTS) $(test_DATA) diff --git a/shell/regression/regression.sh b/shell/regression/regression.sh index 45cc73b460..0e1922166e 100755 --- a/shell/regression/regression.sh +++ b/shell/regression/regression.sh @@ -1,184 +1,183 @@ #!/bin/sh # Copyright (C) 2007 Dejan Muhamedagic # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # rootdir=`dirname $0` TESTDIR=${TESTDIR:-$rootdir/testcases} DFLT_TESTSET=basicset OUTDIR=${OUTDIR:-crmtestout} CRM_OUTF="$OUTDIR/crm.out" CRM_LOGF="$OUTDIR/crm.log" CRM_DEBUGF="$OUTDIR/crm.debug" OUTF="$OUTDIR/regression.out" LRMD_OPTS="" DIFF_OPTS="--ignore-all-space -U 1" common_filter=$TESTDIR/common.filter common_exclf=$TESTDIR/common.excl -LSB_RA=$TESTDIR/lrmregtest export OUTDIR logmsg() { echo "`date`: $*" | tee -a $CRM_DEBUGF | tee -a $CRM_LOGF } abspath() { echo $1 | grep -qs "^/" && echo $1 || echo `pwd`/$1 } usage() { cat<$OUTF 2>&1 if [ "$SILENT" = 1 ]; then exec 3>/dev/null else exec 3>/dev/tty fi setenvironment() { filterf=$TESTDIR/$testcase.filter exclf=$TESTDIR/$testcase.excl log_filter=$TESTDIR/$testcase.log_filter expf=$TESTDIR/$testcase.exp outf=$OUTDIR/$testcase.out difff=$OUTDIR/$testcase.diff } filter_output() { { [ -x $common_filter ] && $common_filter || cat;} | { [ -f $common_exclf ] && egrep -vf $common_exclf || cat;} | { [ -x $filterf ] && $filterf || cat;} | { [ -f $exclf ] && egrep -vf $exclf || cat;} } dumpcase() { cat<&3 logmsg "BEGIN testcase $testcase" ( cd $rootdir ./evaltest.sh ) < $TESTDIR/$testcase > $outf 2>&1 filter_output < $outf | if [ "$prepare" ]; then echo " saving to expect file" >&3 cat > $expf else echo -n " checking..." >&3 if head -2 $expf | grep -qs '^ $difff if [ $? -ne 0 ]; then echo " FAIL" >&3 dumpcase return 1 else echo " PASS" >&3 rm -f $outf $difff fi fi sed -n "/BEGIN testcase $testcase/,\$p" $CRM_LOGF | { [ -x $log_filter ] && $log_filter || cat;} | egrep '(CRIT|ERROR):' logmsg "END testcase $testcase" } [ "$1" = prepare ] && { prepare=1; shift 1;} [ $# -eq 0 ] && set "set:$DFLT_TESTSET" for a; do if [ "$a" -a -f "$TESTDIR/$a" ]; then testcase=$a runtestcase else echo "$a" | grep -q "^set:" && TESTSET=$TESTDIR/`echo $a | sed 's/set://'` while read testcase; do runtestcase done < $TESTSET fi done if egrep -wv '(BEGIN|END) testcase' $OUTF >/dev/null then echo "seems like some tests failed or else something not expected" echo "check $OUTF and diff files in $OUTDIR" echo "in case you wonder what lrmd was doing, read $CRM_LOGF and $CRM_DEBUGF" exit 1 else rm -f $OUTF $CRM_OUTF fi >&3