tests: add outside bind mounts to 75_hooks

it may happen, that someone bind mounts manually or via an immutable setup the tomb mountdir somewhere else.
Tomb should be able to discover such mounts and close them if the tomb itself is closed.
This commit is contained in:
Narrat 2024-08-07 21:56:56 +02:00 committed by Jaromil
parent 41b899e4e1
commit 73950fe3d8

View File

@ -1,6 +1,6 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
export test_description="Testing tomb bind hooks" export test_description="Testing tomb bind hooks & mounts"
TEMPHOME=$HOME TEMPHOME=$HOME
@ -18,8 +18,8 @@ test_expect_success 'Testing bind hooks' '
tt_close && tt_close &&
touch "$TEMPHOME/$bindtest" && touch "$TEMPHOME/$bindtest" &&
tt_open --tomb-pwd $DUMMYPASS && tt_open --tomb-pwd $DUMMYPASS &&
echo "$RND" && echo "$RND" &&
cat "$TEMPHOME/$bindtest" && cat "$TEMPHOME/$bindtest" &&
tt list $testname && tt list $testname &&
tt_close tt_close
' '
@ -27,4 +27,14 @@ test_expect_success 'Testing bind hooks' '
# RND2=$(cat "$TEMPHOME/$bindtest") && # RND2=$(cat "$TEMPHOME/$bindtest") &&
# [[ "$RND" = "$RND2" ]] && # [[ "$RND" = "$RND2" ]] &&
test_expect_success 'Testing outside bind mounts' '
tt_open --tomb-pwd $DUMMYPASS &&
tt_set_ownership "$MEDIA/$testname" &&
sudo mkdir "$MEDIA/$testname-bind" &&
sudo mount --bind "$MEDIA/$testname" "$MEDIA/$testname-bind" &&
tt list $testname &&
tt_close &&
sudo rmdir "$MEDIA/$testname-bind"
'
test_done test_done