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
|
#!/bin/sh
files="
*
"
src_file="test-file-002.1.tar"
dst_file="test-file-002.2.tar"
if [ -f ${src_file} ]; then
rm -f ${src_file}
fi
tar -cf ${src_file} ${files}
if [ "$?" -ne 0 ]; then
echo "*** ERROR: Could not create test file"
echo " Test inconclusive"
exit 1
fi
cp ${src_file} ${dst_file}
if [ "$?" -ne 0 ]; then
echo "*** ERROR: Unable to copy test file"
echo " Test inconclusive"
exit 1
fi
./bar -if ${src_file} -of ${dst_file} 2> /dev/null
if [ "$?" -ne 0 ]; then
echo "*** ERROR: ./bar failed"
exit 1
fi
cmp ${src_file} ${dst_file} > /dev/null 2>&1
if [ "$?" -ne 0 ]; then
echo "*** ERROR: Files differ"
exit 1
fi
cat ${src_file} | ./bar 2> /dev/null > ${dst_file}
if [ "$?" -ne 0 ]; then
echo "*** ERROR: ./bar failed"
exit 1
fi
cmp ${src_file} ${dst_file} > /dev/null 2>&1
if [ "$?" -ne 0 ]; then
echo "*** ERROR: Files differ"
exit 1
fi
rm -f ${src_file} ${dst_file}
exit 0
|