2017-05-03 18:51:36 +00:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
|
2024-08-07 19:56:56 +00:00
|
|
|
export test_description="Testing tomb bind hooks & mounts"
|
2017-05-03 18:51:36 +00:00
|
|
|
|
2019-03-03 16:56:26 +00:00
|
|
|
TEMPHOME=$HOME
|
|
|
|
|
2017-05-03 18:51:36 +00:00
|
|
|
source ./setup
|
|
|
|
|
|
|
|
test_export "test" # Using already generated tomb
|
|
|
|
test_expect_success 'Testing bind hooks' '
|
|
|
|
tt_open --tomb-pwd $DUMMYPASS &&
|
|
|
|
tt_set_ownership "$MEDIA/$testname" &&
|
|
|
|
RND="$RANDOM" &&
|
|
|
|
bindtest="dyne-tomb-bind-test-$RND" &&
|
|
|
|
echo "$RND" > "$MEDIA/$testname/$bindtest" &&
|
|
|
|
rm -f "$MEDIA/$testname/bind-hooks" &&
|
|
|
|
echo "$bindtest $bindtest" > "$MEDIA/$testname/bind-hooks" &&
|
|
|
|
tt_close &&
|
2019-03-03 16:56:26 +00:00
|
|
|
touch "$TEMPHOME/$bindtest" &&
|
2017-05-03 18:51:36 +00:00
|
|
|
tt_open --tomb-pwd $DUMMYPASS &&
|
2024-08-07 19:56:56 +00:00
|
|
|
echo "$RND" &&
|
|
|
|
cat "$TEMPHOME/$bindtest" &&
|
2017-05-03 18:51:36 +00:00
|
|
|
tt list $testname &&
|
|
|
|
tt_close
|
|
|
|
'
|
|
|
|
|
2022-11-13 21:24:47 +00:00
|
|
|
# RND2=$(cat "$TEMPHOME/$bindtest") &&
|
|
|
|
# [[ "$RND" = "$RND2" ]] &&
|
|
|
|
|
2024-08-07 19:56:56 +00:00
|
|
|
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"
|
|
|
|
'
|
|
|
|
|
2017-05-03 18:51:36 +00:00
|
|
|
test_done
|