Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter B Clements committed May 26, 2003
1 parent ff0186f commit d9da006
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 0 deletions.
6 changes: 6 additions & 0 deletions posttest
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

rm -rf testdir

exit 77;

20 changes: 20 additions & 0 deletions pretest
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

rm -f test*.log
rm -rf testdir
mkdir testdir && cd testdir || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2

gunzip -c ../$srcdir/testdata.tar.gz | tar xf - || { echo "ERROR: Could not extra test files" ; exit 1; } >&2

cp test-0.data test-0.data.orig
cp test-1.data test-1.data.orig
cp test-2.data test-2.data.orig
cp test-3.data test-3.data.orig
cp test-4.data test-4.data.orig
cp test-5.data test-5.data.orig
cp test-6.data test-6.data.orig
cp test-7.data test-7.data.orig
cp test-8.data test-8.data.orig
cp test-9.data test-9.data.orig

exit 77;
17 changes: 17 additions & 0 deletions test1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

cd testdir || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2

banner="Verifying using PAR 1.0 data"
dashes=`echo "$banner" | sed s/./-/g`

echo $dashes
echo $banner
echo $dashes

../par2 v testdata.par > ../test1.log || { echo "ERROR: Initial PAR 1.0 verification failed" ; exit 1; } >&2

rm -f ../test1.log

exit 0;

17 changes: 17 additions & 0 deletions test2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

cd testdir || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2

banner="Verifying using PAR 2.0 data"
dashes=`echo "$banner" | sed s/./-/g`

echo $dashes
echo $banner
echo $dashes

../par2 v testdata.par2 > ../test2.log || { echo "ERROR: Initial PAR 2.0 verification failed" ; exit 1; } >&2

rm -f ../test2.log

exit 0;

19 changes: 19 additions & 0 deletions test3
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

cd testdir || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2

banner="Repairing two files using PAR 1.0 data"
dashes=`echo "$banner" | sed s/./-/g`

echo $dashes
echo $banner
echo $dashes

rm -f test-1.data test-3.data
../par2 r testdata.par > ../test3.log || { echo "ERROR: Reconstruction of two files using PAR 1.0 failed" ; exit 1; } >&2
cmp -s test-1.data test-1.data.orig && cmp -s test-3.data test-3.data.orig || { echo "ERROR: Repaired files do not match originals" ; exit 1; } >&2

rm -f ../test3.log

exit 0;

19 changes: 19 additions & 0 deletions test4
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

cd testdir || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2

banner="Repairing two files using PAR 2.0 data"
dashes=`echo "$banner" | sed s/./-/g`

echo $dashes
echo $banner
echo $dashes

rm -f test-1.data test-3.data
../par2 r testdata.par2 > ../test4.log || { echo "ERROR: Reconstruction of two files using PAR 2.0 failed" ; exit 1; } >&2
cmp -s test-1.data test-1.data.orig && cmp -s test-3.data test-3.data.orig || { echo "ERROR: Repaired files do not match originals" ; exit 1; } >&2

rm -f ../test4.log

exit 0;

17 changes: 17 additions & 0 deletions test5
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

cd testdir || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2

banner="Creating 100% PAR 2.0 recovery data"
dashes=`echo "$banner" | sed s/./-/g`

echo $dashes
echo $banner
echo $dashes

../par2 c -r100 -b190 newtest test-*.data > ../test5.log || { echo "ERROR: Creating PAR 2.0 data failed" ; exit 1; } >&2

rm -f ../test5.log

exit 0;

21 changes: 21 additions & 0 deletions test6
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

cd testdir || { echo "ERROR: Could not change to test directory" ; exit 1; } >&2

banner="Repairing 100% loss using PAR 2.0 data"
dashes=`echo "$banner" | sed s/./-/g`

echo $dashes
echo $banner
echo $dashes

rm -f test-*.data

../par2 r newtest > ../test6.log || { echo "ERROR: Full Repair using PAR 2.0 failed" ; exit 1; } >&2

cmp -s test-0.data test-0.data.orig && cmp -s test-1.data test-1.data.orig && cmp -s test-2.data test-2.data.orig && cmp -s test-3.data test-3.data.orig && cmp -s test-4.data test-4.data.orig && cmp -s test-5.data test-5.data.orig && cmp -s test-6.data test-6.data.orig && cmp -s test-7.data test-7.data.orig && cmp -s test-8.data test-8.data.orig && cmp -s test-9.data test-9.data.orig || { echo "ERROR: Repaired files do not match originals" ; exit 1 ; } >&2

rm -f ../test6.log

exit 0;

0 comments on commit d9da006

Please sign in to comment.