mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-22 04:25:12 +00:00
Add bind hooks tests and minors test setup changes
This commit is contained in:
parent
4688820b68
commit
593747d619
@ -7,7 +7,7 @@ source ./setup
|
||||
test_export "test" # Using already generated tomb
|
||||
test_expect_success 'Testing contents integrity' '
|
||||
tt_open --tomb-pwd $DUMMYPASS &&
|
||||
tomb_set_ownership "$MEDIA/$testname" &&
|
||||
tt_set_ownership "$MEDIA/$testname" &&
|
||||
tt dig -s 10 "$MEDIA/$testname/datacheck.raw" &&
|
||||
CRC1=$(sha256sum "$MEDIA/$testname/datacheck.raw") &&
|
||||
tt_close --unsafe &&
|
||||
|
25
extras/test/75_hooks.sh
Normal file
25
extras/test/75_hooks.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
export test_description="Testing tomb bind hooks"
|
||||
|
||||
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 &&
|
||||
touch "/home/$USER/$bindtest" &&
|
||||
tt_open --tomb-pwd $DUMMYPASS &&
|
||||
RND2=$(cat "/home/$USER/$bindtest") &&
|
||||
[[ "$RND" = "$RND2" ]] &&
|
||||
tt list $testname &&
|
||||
tt_close
|
||||
'
|
||||
|
||||
test_done
|
@ -44,7 +44,7 @@ if [[ ! -e "${T}" ]]; then
|
||||
fi
|
||||
|
||||
MEDIA="/media"
|
||||
[[ -d /media ]] || MEDIA="/run/media/$USER/"
|
||||
[[ -d "/media" ]] || MEDIA="/run/media/$USER"
|
||||
|
||||
# Check for auxiliary programs
|
||||
command -v steghide > /dev/null && test_set_prereq STEGHIDE
|
||||
@ -71,6 +71,7 @@ export DUMMYPASSNEW=changetest
|
||||
|
||||
test_cleanup() {
|
||||
"${T}" slam all &> /dev/null
|
||||
rm -f "/home/$USER/dyne-tomb-bind-test-"*
|
||||
sudo rm -rf "$TMP"
|
||||
mkdir -p "$TMP"
|
||||
}
|
||||
@ -106,7 +107,7 @@ tt_lock() { tt lock "$tomb" -k "$tomb_key" --ignore-swap --unsafe "${@}"; }
|
||||
tt_open() { tt open "$tomb" -k "$tomb_key" --ignore-swap --unsafe "${@}"; }
|
||||
tt_close() { tt close "$testname" "${@}"; }
|
||||
|
||||
tomb_set_ownership() {
|
||||
tt_set_ownership() {
|
||||
local dir="$1"
|
||||
local uid=$(id -u $USERNAME)
|
||||
local gid=$(id -g $USERNAME)
|
||||
|
Loading…
Reference in New Issue
Block a user