URL
                    https://opencores.org/ocsvn/openrisc/openrisc/trunk
                
            Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [contrib/] [compare_tests] - Rev 780
Go to most recent revision | Compare with Previous | Blame | View Log
#!/bin/sh# This script automatically test the given tool with the tool's test cases,# reporting anything of interest.usage(){if [ -n "$1" ] ; thenecho "$0: Error: $1" >&2echo >&2ficat >&2 <<EOUSAGEUsage: $0 [-strict] PREVIOUS CURRENTCompare the PREVIOUS and CURRENT test case .sum files, reporting anything of interest.If PREVIOUS and CURRENT are directories, find and compare any *.sum files.Unless -strict is given, these discrepancies are not counted as errors:missing/extra .sum files when comparing directoriestests that failed in PREVIOUS but pass in CURRENTtests that were not in PREVIOUS but appear in CURRENTtests in PREVIOUS that are missing in CURRENTExit with the following values:0 if there is nothing of interest1 if there are errors when comparing single test case filesN for the number of errors found when comparing directoriesEOUSAGEexit 2}# Written by Mike Stump <mrs@cygnus.com># Subdir comparison added by Quentin Neill <quentin.neill@amd.com>tool=gxxtmp1=/tmp/$tool-testing.$$atmp2=/tmp/$tool-testing.$$bnow_s=/tmp/$tool-testing.$$dbefore_s=/tmp/$tool-testing.$$elst1=/tmp/$tool-lst1.$$lst2=/tmp/$tool-lst2.$$lst3=/tmp/$tool-lst3.$$lst4=/tmp/$tool-lst4.$$lst5=/tmp/$tool-lst5.$$sum1=/tmp/$tool-sum1.$$sum2=/tmp/$tool-sum2.$$tmps="$tmp1 $tmp2 $now_s $before_s $lst1 $lst2 $lst3 $lst4 $lst5 $sum1 $sum2"[ "$1" = "-strict" ] && strict=$1 && shift[ "$1" = "-?" ] && usage[ "$2" = "" ] && usage "Must specify both PREVIOUS and CURRENT"trap "rm -f $tmps" 0 1 2 3 5 9 13 15exit_status=0if [ -d "$1" -a -d "$2" ] ; thenfind "$1" -name '*.sum' >$lst1find "$2" -name '*.sum' >$lst2echo "# Comparing directories"echo "## Dir1=$1: `cat $lst1 | wc -l` sum files"echo "## Dir2=$2: `cat $lst2 | wc -l` sum files"echo# remove leading directory components to comparesed -e "s|^$1[/]*||" $lst1 | sort >$lst3sed -e "s|^$2[/]*||" $lst2 | sort >$lst4comm -23 $lst3 $lst4 >$lst5if [ -s $lst5 ] ; thenecho "# Extra sum files in Dir1=$1"sed -e "s|^|< $1/|" $lst5echo[ -n "$strict" ] && exit_status=`expr $exit_status + 1`ficomm -13 $lst3 $lst4 >$lst5if [ -s $lst5 ] ; thenecho "# Extra sum files in Dir2=$2"sed -e "s|^|> $2/|" $lst5echo[ -n "$strict" ] && exit_status=`expr $exit_status + 1`ficomm -12 $lst3 $lst4 | sort -u >$lst5if [ ! -s $lst5 ] ; thenecho "# No common sum files"exit_status=`expr $exit_status + 1`exit $exit_statusficmnsums=`cat $lst5 | wc -l`echo "# Comparing $cmnsums common sum files"( for fname in `cat $lst5`; do cat $1/$fname; done ) >$sum1( for fname in `cat $lst5`; do cat $2/$fname; done ) >$sum2echo "## ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2"${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2ret=$?if [ $ret -ne 0 ]; thenexit_status=`expr $exit_status + 1`echo "## Differences found: $fname"fiif [ $exit_status -ne 0 ]; thenecho "# $exit_status differences in $cmnsums common sum files found"elseecho "# No differences found in $cmnsums common sum files"fiexit $exit_statuselif [ -d "$1" -o -d "$2" ] ; thenusage "Must specify either two directories or two files"fised 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$1" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' >$tmp1sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$2" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' >$tmp2before=$tmp1now=$tmp2if sort -k 2 </dev/null >/dev/null 2>&1; thenskip1='-k 2'elseskip1='+1'fisort -t ':' $skip1 "$now" > "$now_s"sort -t ':' $skip1 "$before" > "$before_s"grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1grep '^PASS' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -12 $tmp1 - >$tmp2grep -s . $tmp2 >/dev/nullif [ $? = 0 ]; thenecho "Tests that now fail, but worked before:"echocat $tmp2echoexit_status=1figrep '^PASS' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1grep '^FAIL' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -12 $tmp1 - >$tmp2grep -s . $tmp2 >/dev/nullif [ $? = 0 ]; thenecho "Tests that now work, but didn't before:"echocat $tmp2[ -n "$strict" ] && echo "Strict test fails" && exit_status=1echofigrep '^FAIL' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -23 $tmp1 - >$tmp2grep -s . $tmp2 >/dev/nullif [ $? = 0 ]; thenecho "New tests that FAIL:"echocat $tmp2echoexit_status=1figrep '^PASS' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -23 $tmp1 - >$tmp2grep -s . $tmp2 >/dev/nullif [ $? = 0 ]; thenecho "New tests that PASS:"echocat $tmp2[ -n "$strict" ] && echo "Strict test fails" && exit_status=1echofigrep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1grep '^PASS' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -13 $tmp1 - >$tmp2grep -s . $tmp2 >/dev/nullif [ $? = 0 ]; thenecho "Old tests that passed, that have disappeared: (Eeek!)"echocat $tmp2[ -n "$strict" ] && echo "Strict test fails" && exit_status=1echofigrep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1grep '^FAIL' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -13 $tmp1 - >$tmp2grep -s . $tmp2 >/dev/nullif [ $? = 0 ]; thenecho "Old tests that failed, that have disappeared: (Eeek!)"echocat $tmp2[ -n "$strict" ] && echo "Strict test fails" && exit_status=1echofiexit $exit_status
Go to most recent revision | Compare with Previous | Blame | View Log

