#!/bin/sh # This script automatically test the given tool with the tool's test cases, # reporting anything of interest. # Written by Mike Stump # Subdir comparison added by Quentin Neill # Modified by Yvan Roux and # Christophe Lyon usage() { if [ -n "$1" ] ; then echo "$0: Error: $1" >&2 echo >&2 fi cat >&2 <$lst1 find "$2/" \( -name '*.sum.xz' ! -name '*go.sum.xz' ! -name 'libgo-all.sum.xz' \)>$lst2 echo "# Comparing directories" echo "# REFERENCE: $1" echo "# CURRENT: $2" echo # remove leading directory components to compare sed -e "s|^$1[/]*||" $lst1 | sort >$lst3 sed -e "s|^$2[/]*||" $lst2 | sort >$lst4 comm -23 $lst3 $lst4 >$lst5 if [ -s $lst5 ] ; then echo "# Extra sum files in Dir1=$1" sed -e "s|^|< $1/|" $lst5 echo [ -n "$strict" ] && exit_status=`expr $exit_status + 1` fi comm -13 $lst3 $lst4 >$lst5 if [ -s $lst5 ] ; then echo "# Extra sum files in Dir2=$2" sed -e "s|^|> $2/|" $lst5 echo [ -n "$strict" ] && exit_status=`expr $exit_status + 1` fi comm -12 $lst3 $lst4 | sort -u >$lst5 if [ ! -s $lst5 ] ; then echo "# No common sum files" exit_status=`expr $exit_status + 1` exit $exit_status fi cmnsums=`cat $lst5 | wc -l` echo "# Comparing $cmnsums common sum files:" cat $lst5 ( for fname in `cat $lst5`; do xzcat $1/$fname | sed -r 's:of file /home.*/gcc/:of file :;s:==[0-9]+==:==X==:;s/output pattern test,.*$/output pattern XXX/'; done ) >$sum1 ( for fname in `cat $lst5`; do xzcat $2/$fname | sed -r 's:of file /home.*/gcc/:of file :;s:==[0-9]+==:==X==:;s/output pattern test,.*$/output pattern XXX/'; done ) >$sum2 # At some point, we'll add --no-unstable --unstable-test=${my_path}/unstable-tests.txt if [ "x${target}" != "x" ] ; then target="--target ${target}" fi ${CONFIG_SHELL-/usr/bin/perl} ${my_path}/compare_dg_tests.pl -l --unstable-test=${my_path}/unstable-tests.txt ${target} $sum1 $sum2 ret=$? if [ $ret -eq 2 ]; then exit_status=`expr $exit_status + 1` echo "# Regressions found" else if [ $ret -eq 1 ]; then echo "# Improvements found" fi fi if [ $exit_status -ne 0 ]; then echo "# Regressions in $cmnsums common sum files found" else echo "# No regression found in $cmnsums common sum files" fi exit $exit_status elif [ -d "$1" -o -d "$2" ] ; then usage "Must specify either two directories or two files" fi