encfs/tests/test_file_expansion.sh
Jakob Unterwurzacher 8bda1c8a46 tests: Add integration tests
Add a simple cli-based test infrastructure with a few tests
to prepare future code changes.
Note that these cannot be run on Travis CI as it does not support
FUSE.

Expected output:

	$ tests/run.sh
	1 Running unit tests: OK
	*** running test_corruption.sh
	2 Reading file: OK
	3 Reading corrupted file: OK
	4 Reading file with MAC: OK
	5 Corruption with MAC returns IO error: OK
	*** running test_file_expansion.sh
	6 Creating files of different sizes: : OK
	7 Growing file: OK
	8 Internal modification: OK
	*** All tests OK
2014-10-17 19:41:21 +02:00

41 lines
823 B
Bash

fresh_mount default.xml
cd $UPPER
test_begin "Creating files of different sizes: "
for i in `seq 0 50` `seq 1000 1050`
do
OUTPUT=$(dd if=/dev/zero bs=$i count=1 2> /dev/null | tee $i | md5sum)
ARRAY=($OUTPUT)
A=${ARRAY[0]} # Remove filename
B=$(md5 $i)
test $A = $B
done
test_ok
test_begin "Growing file"
rm -f ../grow
for i in `seq 0 300`
do
echo -n "abcdefg" >> ../grow
echo -n "abcdefg" >> grow
A=$(md5 ../grow)
B=$(md5 grow)
test "$A" = "$B"
done
test_ok
test_begin "Internal modification"
dd if=/dev/urandom of=../internal bs=1M count=2 2> /dev/null
cp ../internal internal
for i in 0 30 1020 1200
do
dd if=/dev/zero of=../internal bs=1 count=1 skip=$i 2> /dev/null
dd if=/dev/zero of=internal bs=1 count=1 skip=$i 2> /dev/null
A=$(md5 ../internal)
B=$(md5 internal)
test "$A" = "$B"
done
test_ok