mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-12 07:46:28 +00:00
Add integrity tests
This commit is contained in:
parent
045c55436f
commit
92a670efd8
20
extras/test/50_integrity.sh
Normal file
20
extras/test/50_integrity.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
export test_description="Testing file integrity"
|
||||
|
||||
source ./setup
|
||||
|
||||
test_export "test" # Using already generated tomb
|
||||
test_expect_success 'Testing contents integrity' '
|
||||
tt_open --tomb-pwd $DUMMYPASS &&
|
||||
tomb_set_ownership "$MEDIA/$USER/$testname" &&
|
||||
tt dig -s 10 "$MEDIA/$USER/$testname/datacheck.raw" &&
|
||||
CRC1=$(sha256sum "$MEDIA/$USER/$testname/datacheck.raw") &&
|
||||
tt_close --unsafe &&
|
||||
tt_open --tomb-pwd $DUMMYPASS &&
|
||||
CRC2=$(sha256sum "$MEDIA/$USER/$testname/datacheck.raw") &&
|
||||
[[ "$CRC1" == "$CRC2" ]] &&
|
||||
tt_close
|
||||
'
|
||||
|
||||
test_done
|
@ -103,3 +103,11 @@ tt_forge() { tt forge "$tomb_key" --ignore-swap --unsafe --use-urandom "${@}"; }
|
||||
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() {
|
||||
local dir="$1"
|
||||
local uid=$(id -u $USERNAME)
|
||||
local gid=$(id -g $USERNAME)
|
||||
sudo chown -R "$uid:$gid" "$dir"
|
||||
sudo chmod 0711 "$dir"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user