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
|
#! /bin/sh
# binbasic.sh: Testing for the basic operation of "delta", for binary files.
# Import common functions & definitions.
. ../common/test-common
. ../common/real-thing
. ../common/config-data
if $binary_support
then
true
else
echo "Skipping these tests -- no binary file support."
exit 0
fi
g=passwd
p=test/p.$g
s=test/s.$g
x=test/x.$g
z=test/z.$g
adminflags="-b"
cleanup() {
remove command.log log log.stdout log.stderr
remove test/passwd.[123456]
remove $p $x $s $z
remove passwd command.log last.command
remove got.stdout expected.stdout got.stderr expected.stderr
rm -rf test
}
do_delta() {
n=$1
shift
docommand d${n}a "${vg_get} -e $s" 0 IGNORE IGNORE
cp test/passwd.${n} passwd
docommand d${n}b "${vg_delta} -y\"\" $s" 0 IGNORE IGNORE
remove gotten
rev=-r1.`expr $n + 1`
docommand d${n}c "${get} ${rev} -Ggotten $s" 0 IGNORE IGNORE
# Find any differences between the file we used as the
# source for that delta, and the version we just extracted.
docommand d${n}d "${DIFF} gotten test/passwd.$n" 0 "" IGNORE
remove gotten
}
cleanup
echo_nonl prepare1...
mkdir test 2>/dev/null
# Create the input files.
cat > base <<EOF
This is a test file containing nothing interesting.
EOF
for i in 1 2 3 4 5 6
do
cat base > test/$g.$i
echo "This is file number" $i >> test/$g.$i
done
remove base $g test/[xzps].passwd
echo passed
## Find a binary file
BINARY_FILE=../prt/all.expected.Z
# Make sure we have some real binary input!
echo_nonl prepare2...
if test -r ${DIFF}; then cat ${DIFF} >> test/$g.4; fi
if test -r ${BINARY_FILE}; then cat ${BINARY_FILE} >> test/$g.5; fi
for f in /bin/sh*
do
if test -r $f; then cat $f >> test/$g.6; fi
done
echo passed
#
# Create an SCCS file with several branches to work on.
# We generally ignore stderr output since we produce "Warning: no id keywords"
# more often than "real" SCCS.
#
docommand B1 "${admin} ${adminflags} -itest/passwd.1 $s" 0 "" IGNORE
for n in 1 2 3
do
do_delta $n
done
# Binary support not fully working yet.
for n in 4 5 6
do
do_delta $n
done
cleanup
success
|