OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [contrib/] [compare_tests] - Diff between revs 723 and 783

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 723 Rev 783
#!/bin/sh
#!/bin/sh
# This script automatically test the given tool with the tool's test cases,
# This script automatically test the given tool with the tool's test cases,
# reporting anything of interest.
# reporting anything of interest.
usage()
usage()
{
{
        if [ -n "$1" ] ; then
        if [ -n "$1" ] ; then
                echo "$0: Error: $1" >&2
                echo "$0: Error: $1" >&2
                echo >&2
                echo >&2
        fi
        fi
        cat >&2 <
        cat >&2 <
Usage: $0 [-strict] PREVIOUS CURRENT
Usage: $0 [-strict] PREVIOUS CURRENT
Compare the PREVIOUS and CURRENT test case .sum files, reporting anything of interest.
Compare the PREVIOUS and CURRENT test case .sum files, reporting anything of interest.
        If PREVIOUS and CURRENT are directories, find and compare any *.sum files.
        If PREVIOUS and CURRENT are directories, find and compare any *.sum files.
        Unless -strict is given, these discrepancies are not counted as errors:
        Unless -strict is given, these discrepancies are not counted as errors:
                missing/extra .sum files when comparing directories
                missing/extra .sum files when comparing directories
                tests that failed in PREVIOUS but pass in CURRENT
                tests that failed in PREVIOUS but pass in CURRENT
                tests that were not in PREVIOUS but appear in CURRENT
                tests that were not in PREVIOUS but appear in CURRENT
                tests in PREVIOUS that are missing in CURRENT
                tests in PREVIOUS that are missing in CURRENT
        Exit with the following values:
        Exit with the following values:
                0 if there is nothing of interest
                0 if there is nothing of interest
                1 if there are errors when comparing single test case files
                1 if there are errors when comparing single test case files
                N for the number of errors found when comparing directories
                N for the number of errors found when comparing directories
EOUSAGE
EOUSAGE
        exit 2
        exit 2
}
}
# Written by Mike Stump 
# Written by Mike Stump 
# Subdir comparison added by Quentin Neill 
# Subdir comparison added by Quentin Neill 
tool=gxx
tool=gxx
tmp1=/tmp/$tool-testing.$$a
tmp1=/tmp/$tool-testing.$$a
tmp2=/tmp/$tool-testing.$$b
tmp2=/tmp/$tool-testing.$$b
now_s=/tmp/$tool-testing.$$d
now_s=/tmp/$tool-testing.$$d
before_s=/tmp/$tool-testing.$$e
before_s=/tmp/$tool-testing.$$e
lst1=/tmp/$tool-lst1.$$
lst1=/tmp/$tool-lst1.$$
lst2=/tmp/$tool-lst2.$$
lst2=/tmp/$tool-lst2.$$
lst3=/tmp/$tool-lst3.$$
lst3=/tmp/$tool-lst3.$$
lst4=/tmp/$tool-lst4.$$
lst4=/tmp/$tool-lst4.$$
lst5=/tmp/$tool-lst5.$$
lst5=/tmp/$tool-lst5.$$
sum1=/tmp/$tool-sum1.$$
sum1=/tmp/$tool-sum1.$$
sum2=/tmp/$tool-sum2.$$
sum2=/tmp/$tool-sum2.$$
tmps="$tmp1 $tmp2 $now_s $before_s $lst1 $lst2 $lst3 $lst4 $lst5 $sum1 $sum2"
tmps="$tmp1 $tmp2 $now_s $before_s $lst1 $lst2 $lst3 $lst4 $lst5 $sum1 $sum2"
[ "$1" = "-strict" ] && strict=$1 && shift
[ "$1" = "-strict" ] && strict=$1 && shift
[ "$1" = "-?" ] && usage
[ "$1" = "-?" ] && usage
[ "$2" = "" ] && usage "Must specify both PREVIOUS and CURRENT"
[ "$2" = "" ] && usage "Must specify both PREVIOUS and CURRENT"
trap "rm -f $tmps" 0 1 2 3 5 9 13 15
trap "rm -f $tmps" 0 1 2 3 5 9 13 15
exit_status=0
exit_status=0
if [ -d "$1" -a -d "$2" ] ; then
if [ -d "$1" -a -d "$2" ] ; then
        find "$1" -name '*.sum' >$lst1
        find "$1" -name '*.sum' >$lst1
        find "$2" -name '*.sum' >$lst2
        find "$2" -name '*.sum' >$lst2
        echo "# Comparing directories"
        echo "# Comparing directories"
        echo "## Dir1=$1: `cat $lst1 | wc -l` sum files"
        echo "## Dir1=$1: `cat $lst1 | wc -l` sum files"
        echo "## Dir2=$2: `cat $lst2 | wc -l` sum files"
        echo "## Dir2=$2: `cat $lst2 | wc -l` sum files"
        echo
        echo
        # remove leading directory components to compare
        # remove leading directory components to compare
        sed -e "s|^$1[/]*||" $lst1 | sort >$lst3
        sed -e "s|^$1[/]*||" $lst1 | sort >$lst3
        sed -e "s|^$2[/]*||" $lst2 | sort >$lst4
        sed -e "s|^$2[/]*||" $lst2 | sort >$lst4
        comm -23 $lst3 $lst4 >$lst5
        comm -23 $lst3 $lst4 >$lst5
        if [ -s $lst5 ] ; then
        if [ -s $lst5 ] ; then
                echo "# Extra sum files in Dir1=$1"
                echo "# Extra sum files in Dir1=$1"
                sed -e "s|^|< $1/|" $lst5
                sed -e "s|^|< $1/|" $lst5
                echo
                echo
                [ -n "$strict" ] && exit_status=`expr $exit_status + 1`
                [ -n "$strict" ] && exit_status=`expr $exit_status + 1`
        fi
        fi
        comm -13 $lst3 $lst4 >$lst5
        comm -13 $lst3 $lst4 >$lst5
        if [ -s $lst5 ] ; then
        if [ -s $lst5 ] ; then
                echo "# Extra sum files in Dir2=$2"
                echo "# Extra sum files in Dir2=$2"
                sed -e "s|^|> $2/|" $lst5
                sed -e "s|^|> $2/|" $lst5
                echo
                echo
                [ -n "$strict" ] && exit_status=`expr $exit_status + 1`
                [ -n "$strict" ] && exit_status=`expr $exit_status + 1`
        fi
        fi
        comm -12 $lst3 $lst4 | sort -u >$lst5
        comm -12 $lst3 $lst4 | sort -u >$lst5
        if [ ! -s $lst5 ] ; then
        if [ ! -s $lst5 ] ; then
                echo "# No common sum files"
                echo "# No common sum files"
                exit_status=`expr $exit_status + 1`
                exit_status=`expr $exit_status + 1`
                exit $exit_status
                exit $exit_status
        fi
        fi
        cmnsums=`cat $lst5 | wc -l`
        cmnsums=`cat $lst5 | wc -l`
        echo "# Comparing $cmnsums common sum files"
        echo "# Comparing $cmnsums common sum files"
        ( for fname in `cat $lst5`; do cat $1/$fname; done ) >$sum1
        ( for fname in `cat $lst5`; do cat $1/$fname; done ) >$sum1
        ( for fname in `cat $lst5`; do cat $2/$fname; done ) >$sum2
        ( for fname in `cat $lst5`; do cat $2/$fname; done ) >$sum2
        echo "## ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2"
        echo "## ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2"
        ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2
        ${CONFIG_SHELL-/bin/sh} $0 $strict $sum1 $sum2
        ret=$?
        ret=$?
        if [ $ret -ne 0 ]; then
        if [ $ret -ne 0 ]; then
                exit_status=`expr $exit_status + 1`
                exit_status=`expr $exit_status + 1`
                echo "## Differences found: $fname"
                echo "## Differences found: $fname"
        fi
        fi
        if [ $exit_status -ne 0 ]; then
        if [ $exit_status -ne 0 ]; then
                echo "# $exit_status differences in $cmnsums common sum files found"
                echo "# $exit_status differences in $cmnsums common sum files found"
        else
        else
                echo "# No differences found in $cmnsums common sum files"
                echo "# No differences found in $cmnsums common sum files"
        fi
        fi
        exit $exit_status
        exit $exit_status
elif [ -d "$1" -o -d "$2" ] ; then
elif [ -d "$1" -o -d "$2" ] ; then
        usage "Must specify either two directories or two files"
        usage "Must specify either two directories or two files"
fi
fi
sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$1" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' >$tmp1
sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$1" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' >$tmp1
sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$2" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' >$tmp2
sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$2" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' >$tmp2
before=$tmp1
before=$tmp1
now=$tmp2
now=$tmp2
if sort -k 2 /dev/null 2>&1; then
if sort -k 2 /dev/null 2>&1; then
  skip1='-k 2'
  skip1='-k 2'
else
else
  skip1='+1'
  skip1='+1'
fi
fi
sort -t ':' $skip1 "$now" > "$now_s"
sort -t ':' $skip1 "$now" > "$now_s"
sort -t ':' $skip1 "$before" > "$before_s"
sort -t ':' $skip1 "$before" > "$before_s"
grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[        ]//' >$tmp1
grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[        ]//' >$tmp1
grep '^PASS' "$before_s" | sed 's/^[^:]*:[      ]//' | comm -12 $tmp1 - >$tmp2
grep '^PASS' "$before_s" | sed 's/^[^:]*:[      ]//' | comm -12 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
if [ $? = 0 ]; then
        echo "Tests that now fail, but worked before:"
        echo "Tests that now fail, but worked before:"
        echo
        echo
        cat $tmp2
        cat $tmp2
        echo
        echo
        exit_status=1
        exit_status=1
fi
fi
grep '^PASS' "$now_s" | sed 's/^[^:]*:[         ]//' >$tmp1
grep '^PASS' "$now_s" | sed 's/^[^:]*:[         ]//' >$tmp1
grep '^FAIL' "$before_s" | sed 's/^[^:]*:[      ]//' | comm -12 $tmp1 - >$tmp2
grep '^FAIL' "$before_s" | sed 's/^[^:]*:[      ]//' | comm -12 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
if [ $? = 0 ]; then
        echo "Tests that now work, but didn't before:"
        echo "Tests that now work, but didn't before:"
        echo
        echo
        cat $tmp2
        cat $tmp2
        [ -n "$strict" ] && echo "Strict test fails" && exit_status=1
        [ -n "$strict" ] && echo "Strict test fails" && exit_status=1
        echo
        echo
fi
fi
grep '^FAIL' "$now_s" | sed 's/^[^:]*:[         ]//' >$tmp1
grep '^FAIL' "$now_s" | sed 's/^[^:]*:[         ]//' >$tmp1
grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[     ]//' | comm -23 $tmp1 - >$tmp2
grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[     ]//' | comm -23 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
if [ $? = 0 ]; then
        echo "New tests that FAIL:"
        echo "New tests that FAIL:"
        echo
        echo
        cat $tmp2
        cat $tmp2
        echo
        echo
        exit_status=1
        exit_status=1
fi
fi
grep '^PASS' "$now_s" | sed 's/^[^:]*:[         ]//' >$tmp1
grep '^PASS' "$now_s" | sed 's/^[^:]*:[         ]//' >$tmp1
grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[     ]//' | comm -23 $tmp1 - >$tmp2
grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[     ]//' | comm -23 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
if [ $? = 0 ]; then
        echo "New tests that PASS:"
        echo "New tests that PASS:"
        echo
        echo
        cat $tmp2
        cat $tmp2
        [ -n "$strict" ] && echo "Strict test fails" && exit_status=1
        [ -n "$strict" ] && echo "Strict test fails" && exit_status=1
        echo
        echo
fi
fi
grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[        ]//' >$tmp1
grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[        ]//' >$tmp1
grep '^PASS' "$before_s" | sed 's/^[^:]*:[      ]//' | comm -13 $tmp1 - >$tmp2
grep '^PASS' "$before_s" | sed 's/^[^:]*:[      ]//' | comm -13 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
if [ $? = 0 ]; then
        echo "Old tests that passed, that have disappeared: (Eeek!)"
        echo "Old tests that passed, that have disappeared: (Eeek!)"
        echo
        echo
        cat $tmp2
        cat $tmp2
        [ -n "$strict" ] && echo "Strict test fails" && exit_status=1
        [ -n "$strict" ] && echo "Strict test fails" && exit_status=1
        echo
        echo
fi
fi
grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[        ]//' >$tmp1
grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[        ]//' >$tmp1
grep '^FAIL' "$before_s" | sed 's/^[^:]*:[      ]//' | comm -13 $tmp1 - >$tmp2
grep '^FAIL' "$before_s" | sed 's/^[^:]*:[      ]//' | comm -13 $tmp1 - >$tmp2
grep -s . $tmp2 >/dev/null
grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
if [ $? = 0 ]; then
        echo "Old tests that failed, that have disappeared: (Eeek!)"
        echo "Old tests that failed, that have disappeared: (Eeek!)"
        echo
        echo
        cat $tmp2
        cat $tmp2
        [ -n "$strict" ] && echo "Strict test fails" && exit_status=1
        [ -n "$strict" ] && echo "Strict test fails" && exit_status=1
        echo
        echo
fi
fi
exit $exit_status
exit $exit_status
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.