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
|
#!/bin/sh
execdir="$PWD"
# valgrind tests memory usage.
# wine allow for windows testing on linux
if [ -n "${PARVALGRINDOPTS+set}" ]
then
PARBINARY="valgrind $PARVALGRINDOPTS $execdir/par2"
elif [ "`which wine`" != "" ] && [ -f "$execdir/par2.exe" ]
then
PARBINARY="wine $execdir/par2.exe"
else
PARBINARY="$execdir/par2"
fi
if [ -z "$srcdir" ] || [ "." = "$srcdir" ]; then
srcdir="$PWD"
TESTDATA="$srcdir/tests"
else
srcdir="$PWD/$srcdir"
TESTDATA="$srcdir/tests"
fi
TESTROOT="$PWD"
testname=$(basename $0)
rm -f "$testname.log"
rm -rf "run$testname"
mkdir "run$testname" && cd "run$testname" || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2
tar --no-same-owner -xzf "$TESTDATA/subdirdata.tar.gz" || { echo "ERROR: Could not extract data test files" ; exit 1; } >&2
tar --no-same-owner -xzf "$TESTDATA/subdirdata-par2files-unix.tar.gz" || { echo "ERROR: Could not extract par test files" ; exit 1; } >&2
banner="Repairing two files in subdirs using PAR 2.0 data"
dashes=`echo "$banner" | sed s/./-/g`
echo $dashes
echo $banner
echo $dashes
cp subdir1/test-2.data subdir1/test-2.data.orig
cp subdir2/test-7.data subdir2/test-7.data.orig
rm -f subdir1/test-2.data subdir2/test-7.data
$PARBINARY r testdata.par2 || { echo "ERROR: Reconstruction of two files using PAR 2.0 failed" ; exit 1; } >&2
cmp -s subdir1/test-2.data subdir1/test-2.data.orig && cmp -s subdir2/test-7.data subdir2/test-7.data.orig || { echo "ERROR: Repaired files do not match originals" ; exit 1; } >&2
cd "$TESTROOT"
rm -rf "run$testname"
exit 0;
|