mirror of
https://github.com/vgough/encfs.git
synced 2025-01-29 09:08:35 +01:00
8bda1c8a46
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
32 lines
571 B
Bash
32 lines
571 B
Bash
fresh_mount default.xml
|
|
cd $SCRATCH
|
|
dd if=/dev/urandom of=foo bs=1M count=1 2> /dev/null
|
|
A=$(md5 foo)
|
|
cp foo $UPPER
|
|
cd $UPPER
|
|
test_begin "Reading file"
|
|
B=$(md5 foo)
|
|
test $A = $B
|
|
test_ok
|
|
|
|
test_begin "Reading corrupted file"
|
|
echo DEADBEEF >> $LOWER/$(ls $LOWER)
|
|
B=$(md5 foo)
|
|
test $A != $B
|
|
test_ok
|
|
|
|
fresh_mount mac.xml
|
|
cd $SCRATCH
|
|
cp foo $UPPER
|
|
cd $UPPER
|
|
test_begin "Reading file with MAC"
|
|
B=$(md5 foo)
|
|
test $A = $B
|
|
test_ok
|
|
|
|
test_begin "Corruption with MAC returns IO error"
|
|
echo DEADBEEF >> $LOWER/$(ls $LOWER)
|
|
md5 foo 2>&1 | grep "Input/output error" > /dev/null
|
|
test_ok
|
|
|