Skip to content

Commit

Permalink
test btrfs tomb
Browse files Browse the repository at this point in the history
  • Loading branch information
jaromil committed Aug 31, 2024
1 parent 450de1c commit 34187e2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
22 changes: 22 additions & 0 deletions extras/test/00_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,26 @@ if test_have_prereq DOAS; then
'
fi

if test_have_prereq BTRFS; then
test_export "create_btrfs"
test_expect_success 'Testing tomb creation using BTRFS filesystem' '
tt_dig -s 50 &&
tt_forge --tomb-pwd $DUMMYPASS &&
print $DUMMYPASS \
| gpg --batch --passphrase-fd 0 --no-tty --no-options -d $tomb_key \
| xxd &&
tt_lock --tomb-pwd $DUMMYPASS --filesystem btrfs
'

test_export "create_btrfsmixed"
test_expect_success 'Testing tomb creation using BTRFS mixedmode filesystem' '
tt_dig -s 20 &&
tt_forge --tomb-pwd $DUMMYPASS &&
print $DUMMYPASS \
| gpg --batch --passphrase-fd 0 --no-tty --no-options -d $tomb_key \
| xxd &&
tt_lock --tomb-pwd $DUMMYPASS --filesystem btrfsmixedmode
'
fi

test_done
1 change: 1 addition & 0 deletions extras/test/setup
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ command -v cloakify > /dev/null && test_set_prereq CLOAKIFY
command -v decloakify > /dev/null && test_set_prereq DECLOAKIFY
command -v doas > /dev/null && test_set_prereq DOAS
command -v argon2 > /dev/null && test_set_prereq ARGON2
command -v mkfs.btrfs > /dev/null && test_set_prereq BTRFS


# GnuPG config
Expand Down
6 changes: 3 additions & 3 deletions tomb
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@ lock_tomb_with_key() {
_verbose "Tomb found: ::1 tomb path::" $TOMBPATH

local filesystem=ext4
option_is_set --filesystem && {
option_is_set --filesystem && {
filesystem=`option_value --filesystem`
local tombsize=`stat --format '%s' $tombpath`
case $filesystem in
Expand All @@ -2091,13 +2091,13 @@ lock_tomb_with_key() {
btrfs)
if [[ $tombsize -lt 49283072 ]]; then
_failure "Filesystem ::1 filesystem:: not supported on tombs smaller than 47MB." \
$filesystem
$filesystem
fi
;;
btrfsmixedmode)
if [[ $tombsize -lt 18874368 ]]; then
_failure "Filesystem ::1 filesystem:: not supported on tombs smaller than 18MB." \
$filesystem
$filesystem
fi
;;
*)
Expand Down

0 comments on commit 34187e2

Please sign in to comment.