tests pass
This commit is contained in:
parent
3ecdc20ee4
commit
f99cffbc89
2
expected_test_result/append
Normal file
2
expected_test_result/append
Normal file
|
@ -0,0 +1,2 @@
|
|||
Hello
|
||||
Append
|
1
expected_test_result/overwrite
Normal file
1
expected_test_result/overwrite
Normal file
|
@ -0,0 +1 @@
|
|||
This is an overwrite
|
0
expected_test_result/touched
Normal file
0
expected_test_result/touched
Normal file
1
expected_test_result/written
Normal file
1
expected_test_result/written
Normal file
|
@ -0,0 +1 @@
|
|||
42
|
1
source/append
Normal file
1
source/append
Normal file
|
@ -0,0 +1 @@
|
|||
Hello
|
1
source/overwrite
Normal file
1
source/overwrite
Normal file
|
@ -0,0 +1 @@
|
|||
Overwritten
|
15
test.sh
15
test.sh
|
@ -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
|
Loading…
Reference in New Issue
Block a user