#!/bin/sh

cd tests || { echo "ERROR: Could not change to tests directory" ; exit 1; } >&2
tests=../../$srcdir/tests

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 -xf $tests/flatdata.tar.gz || { echo "ERROR: Could not extract data test files" ; exit 1; } >&2

banner="don't allow files outside par2 basedir, (issue #34, #36)"
dashes=`echo "$banner" | sed s/./-/g`

echo $dashes
echo $banner
echo $dashes

../../par2 c -r2 subdir/test.par2 *.data > ../$testname.log && { echo "ERROR: repair files using PAR 2.0 failed" ; exit 1; } >&2

cd ..
rm -rf run$testname

exit 0;

