1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
#! /bin/sh
#
# compare_gets
#
# This script compares the results of getting each SID from a list of
# SCCS files with each of two implementations of sccs-get.
#
# usage:
# compare_gets.sh dir1 dir2 file [ file ... ]
#
# example:
# compare_gets.sh /usr/ccs/bin /usr/local/libexec/cssc s.foo.c s.bar.c
#
# If you have a source tree to compare, you could use it like this:-
# find /usr/src -name s.\* -print |
# xargs compare_gets.sh /usr/ccs/bin /usr/local/libexec/cssc
tfile1="/tmp/scmp_tfile1.$$"
tfile2="/tmp/scmp_tfile2.$$"
rv=0
# get_sid_list
#
# arg1: The name of the SCCS file.
#
get_sid_list () {
# Lists the SIDs in the named file, on stdout.
"$dir1/prs" -l -r1.1 -d:I: "$1" | nl -ba | sort -rn | awk '{print $2;}'
}
# compare_sid_getting
#
# arg1: The name of the SCCS file.
#
compare_sid_getting () {
sfile="$1"
echo "$sfile:"
rm -f $tfile1 $tfile2
for sid in `get_sid_list "$sfile"`
do
echo "Comparing $sfile at SID $sid..."
"$get1" -s -p -r$sid "$sfile" > "$tfile1" 2>/dev/null
s1=$?
if test $s1 -gt 1
then
echo "Fatal error in $get1." >&2
rm -f $tfile1 $tfile2
exit $s1
fi
"$get2" -s -p -r$sid "$sfile" > "$tfile2" 2>/dev/null
s2=$?
if test $s2 -gt 1
then
echo "Fatal error in $get2." >&2
rm -f $tfile1 $tfile2
exit $s2
fi
diff "$tfile1" "$tfile2" >/dev/null
s3=$?
rm -f $tfile1 $tfile2
if test $s3 -gt 1
then
echo "Fatal error in diff." >&2
exit $s3
fi
if test $s3 -ne 0
then
echo "File $sfile differs between $get1 and $get2 at SID $sid" >&2
rv=1
return 1
fi
done
return 0
}
dir1="$1"
dir2="$2"
get1="$dir1/get"
get2="$dir2/get"
shift
shift
if test -x "$get1"
then
true
else
echo "$get1 is not exexutable." >&2
exit 2
fi
if test -x "$get2"
then
true
else
echo "$get2 is not exexutable." >&2
exit 2
fi
rv=0
for filename
do
echo SIDs in file $filename...
compare_sid_getting "$filename" || break
done
exit $rv
# The remaining arguments should be a list of files.
|