diff --git a/pengine/regression.core.sh.in b/pengine/regression.core.sh.in index 87a8aafd82..69a0e2ef99 100644 --- a/pengine/regression.core.sh.in +++ b/pengine/regression.core.sh.in @@ -1,203 +1,203 @@ # Copyright (C) 2004 Andrew Beekhof # # 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 # verbose=$1 num_failed=0 force_local=0 VALGRIND_CMD="" diff_opts="--ignore-all-space -u -N" -test_home=@abs_top_builddir@/pengine +test_home=`dirname $0` test_binary=@abs_top_builddir@/tools/crm_simulate failed=$test_home/.regression.failed.diff echo $0 # zero out the error log > $failed while true ; do case "$1" in -l|--local) force_local=1; echo "Ignoring valgrind"; shift;; -b|--binary) test_binary=$2; shift; shift;; -?|--help) echo "$0 [--binary name] [--force-local]"; shift; exit 0;; --) shift ; break ;; "") break;; *) echo "unknown option: $1"; exit 1;; esac done if [ -x /usr/bin/valgrind -a $force_local = 0 ]; then export G_SLICE=always-malloc VALGRIND_CMD="valgrind -q --show-reachable=no --leak-check=full --trace-children=no --time-stamp=yes --num-callers=20 --suppressions=./ptest.supp" test_binary=`which crm_simulate` elif [ ! -x $test_binary ]; then test_binary=`which crm_simulate` fi if [ "x$test_binary" = "x" ]; then echo "crm_simulate not installed. Aborting." exit 1 fi test_cmd="$VALGRIND_CMD $test_binary" #echo $test_cmd if [ $USER != root ]; then declare -x CIB_shadow_dir=/tmp fi function do_test { expected_rc=0 base=$1; shift name=$1; shift input=$io_dir/${base}.xml output=$io_dir/${base}.pe.out expected=$io_dir/${base}.exp te_output=$io_dir/${base}.te.out te_expected=$io_dir/${base}.te.exp dot_output=$io_dir/${base}.pe.dot dot_expected=$io_dir/${base}.dot dot_png=$io_dir/${base}.png scores=$io_dir/${base}.scores score_output=$io_dir/${base}.pe.scores if [ "x$1" = "x--rc" ]; then expected_rc=$2 shift; shift; fi if [ ! -f $input ]; then echo "Test $name ($base)... Error (PE : input)"; num_failed=`expr $num_failed + 1` return; fi echo "Test $base : $name"; if [ "$create_mode" != "true" -a ! -f $expected ]; then echo " Error (PE : expected)"; # return; fi # ../admin/crm_verify -X $input $test_binary -x $input -D $dot_output -G $output -SQ -s $* > $score_output rc=$? if [ $rc != $expected_rc ]; then echo " * Failed (PE : rc=$rc)"; num_failed=`expr $num_failed + 1` fi if [ -s core ]; then echo " Moved core to core.${base}"; num_failed=`expr $num_failed + 1` rm -f $test_home/core.$base mv core $test_home/core.$base fi if [ ! -s $output ]; then echo " Error (PE : no graph)"; num_failed=`expr $num_failed + 1` rm $output return; # else # mv $output $output.sed # cat $output.sed | sed 's/id=.[0-9]*.\ //g' >> $output fi if [ ! -s $dot_output ]; then echo " Error (PE : no dot-file)"; num_failed=`expr $num_failed + 1` rm $output return; else echo "digraph \"g\" {" > $dot_output.sort LC_ALL=POSIX sort -u $dot_output | grep -v -e ^}$ -e digraph >> $dot_output.sort echo "}" >> $dot_output.sort mv -f $dot_output.sort $dot_output fi if [ ! -s $score_output ]; then echo " Error (PE : no scores)"; num_failed=`expr $num_failed + 1` rm $output return; fi if [ "$create_mode" = "true" ]; then cp "$output" "$expected" cp "$dot_output" "$dot_expected" cp "$score_output" "$scores" echo " Created expected output (PE)" fi diff $diff_opts $dot_expected $dot_output >/dev/null rc=$? if [ $rc != 0 ]; then echo " * Failed (PE : dot)"; diff $diff_opts $dot_expected $dot_output 2>/dev/null >> $failed echo "" >> $failed num_failed=`expr $num_failed + 1` else rm $dot_output fi diff $diff_opts $expected $output >/dev/null rc2=$? if [ $rc2 != 0 ]; then echo " * Failed (PE : raw)"; diff $diff_opts $expected $output 2>/dev/null >> $failed echo "" >> $failed num_failed=`expr $num_failed + 1` else rm $output fi diff $diff_opts $scores $score_output >/dev/null rc=$? if [ $rc != 0 ]; then echo " * Failed (PE : scores)"; diff $diff_opts $scores $score_output 2>/dev/null >> $failed echo "" >> $failed num_failed=`expr $num_failed + 1` else rm $score_output fi rm -f $output } function test_results { if [ $num_failed != 0 ]; then if [ -s $failed ]; then if [ "$verbose" = "-v" ]; then echo "Results of $num_failed failed tests...." less $failed else echo "Results of $num_failed failed tests are in $failed...." echo "Use $0 -v to display them automatically." fi else echo "$num_failed tests failed (no diff results)" rm $failed fi fi exit $num_failed }