tests pass

This commit is contained in:
Suzanne Soy 2023-09-11 23:46:36 +01:00
parent 3ecdc20ee4
commit f99cffbc89
7 changed files with 15 additions and 6 deletions

View File

@ -0,0 +1,2 @@
Hello
Append

View File

@ -0,0 +1 @@
This is an overwrite

View File

View File

@ -0,0 +1 @@
42

1
source/append Normal file
View File

@ -0,0 +1 @@
Hello

1
source/overwrite Normal file
View File

@ -0,0 +1 @@
Overwritten

15
test.sh
View File

@ -2,24 +2,27 @@
set -euET -o pipefail
fusermount -u test/mnt || true
rm test -fr
mkdir test test/cache test/mnt
cp -ai source test/source
./fs.py test/source test/cache test/mnt & pid=$!
run_tests() {
sleep 2 # TODO: use foreground=False instead of & pid=$!
touch test/mnt/touched
echo 42 > test/mnt/written
echo 'Append' >> test/mnt/append
echo 'This is an overwrite' > test/mnt/overwrite
cp -ai test/mnt test/actual_result
fusermount -u test/mnt
diff -r test/actual_result expected_test_result
}
if run_tests; then
echo success
kill -KILL $pid
fusermount -u test_mnt
printf '\033[1;32mSuccess\033[m\n'
else
echo failed
kill -KILL $pid
fusermount -u test_mnt
printf '\033[1;31mFailure\033[m\n'
fusermount -u test/mnt || kill -KILL $pid
exit 1
fi