Skip to content

Commit

Permalink
fix tests to run also when swap present
Browse files Browse the repository at this point in the history
  • Loading branch information
jaromil committed May 12, 2024
1 parent 6c383ff commit 0d06c99
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ PROG = tomb
PREFIX ?= /usr/local
MANDIR ?= ${PREFIX}/share/man

deps:
@[ -r /etc/debian_version ] && { \
apt-get install -qy zsh cryptsetup file gnupg pinentry-curses; }
@[ -r /etc/fedora-release ] ^^ { \
yum install -y zsh cryptsetup file gnupg pinentry-curses; }

all:
@echo
@echo "Tomb is a script and does not need compilation, it can be simply executed."
Expand Down
10 changes: 5 additions & 5 deletions extras/test/65_passwd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ source ./setup

test_export "test" # Using already generated tomb
test_expect_success 'Testing tomb with GnuPG keys: passwd' '
tt passwd -k $tomb_key --unsafe \
tt passwd -f -k $tomb_key --unsafe \
--tomb-old-pwd $DUMMYPASS --tomb-pwd $DUMMYPASSNEW &&
tt passwd -k $tomb_key --unsafe \
tt passwd -f -k $tomb_key --unsafe \
--tomb-old-pwd $DUMMYPASSNEW --tomb-pwd $DUMMYPASS
'

if test_have_prereq GPGRCPT; then

test_export "recipient" # Using already generated tomb
test_expect_success 'Testing tomb with GnuPG keys: passwd' '
tt passwd -k $tomb_key -g -r $KEY2
tt passwd -f -k $tomb_key -g -r $KEY2
'

fi

if test_have_prereq SPHINX ORACLE; then
test_export "sphinx_test" # Using already generated tomb
test_expect_success 'Testing changing tomb password with sphinx' '
tt passwd -k $tomb_key --unsafe \
tt passwd -f -k $tomb_key --unsafe \
--tomb-old-pwd $DUMMYPASS --tomb-pwd $DUMMYPASSNEW \
--sphx-user $DUMMYUSER --sphx-host $DUMMYHOST &&
tt passwd -k $tomb_key --unsafe \
tt passwd -f -k $tomb_key --unsafe \
--tomb-old-pwd $DUMMYPASSNEW --tomb-pwd $DUMMYPASS \
--sphx-user $DUMMYUSER --sphx-host $DUMMYHOST
'
Expand Down
18 changes: 9 additions & 9 deletions extras/test/90_setkey.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ source ./setup

test_export "test" # Using already generated tomb
test_expect_success 'Testing set key' '
tt forge -k $tomb_key_new --tomb-pwd $DUMMYPASS \
tt forge -f -k $tomb_key_new --tomb-pwd $DUMMYPASS \
--ignore-swap --unsafe --force &&
tt setkey -k $tomb_key_new $tomb_key $tomb \
tt setkey -f -k $tomb_key_new $tomb_key $tomb \
--unsafe --tomb-pwd $DUMMYPASS --tomb-old-pwd $DUMMYPASS &&
tt open -k $tomb_key_new $tomb \
tt open -f -k $tomb_key_new $tomb \
--unsafe --tomb-pwd $DUMMYPASS &&
print $DUMMYPASS \
| gpg --batch --passphrase-fd 0 --no-tty --no-options -d $tomb_key_new \
Expand All @@ -21,23 +21,23 @@ test_expect_success 'Testing set key' '
if test_have_prereq GPGRCPT; then
test_export "recipient" # Using already generated tomb
test_expect_success 'Testing tomb with GnuPG keys: setkey' '
tt forge $tomb_key_new -g -r $KEY2 --ignore-swap --unsafe &&
tt setkey -k $tomb_key_new $tomb_key $tomb -g -r $KEY2 &&
tt open -k $tomb_key_new $tomb -g &&
tt forge -f $tomb_key_new -g -r $KEY2 --ignore-swap --unsafe &&
tt setkey -f -k $tomb_key_new $tomb_key $tomb -g -r $KEY2 &&
tt open -f -k $tomb_key_new $tomb -g &&
tt_close
'
fi

if test_have_prereq SPHINX ORACLE; then
test_export "sphinx_test" # Using already generated tomb
test_expect_success 'Testing set key (sphinx)' '
tt forge -k $tomb_key_new --tomb-pwd $DUMMYPASS \
tt forge -f -k $tomb_key_new --tomb-pwd $DUMMYPASS \
--ignore-swap --unsafe --force \
--sphx-user $DUMMYUSER --sphx-host $DUMMYHOST &&
tt setkey -k $tomb_key_new $tomb_key $tomb \
tt setkey -f -k $tomb_key_new $tomb_key $tomb \
--unsafe --tomb-pwd $DUMMYPASS --tomb-old-pwd $DUMMYPASS \
--sphx-user $DUMMYUSER --sphx-host $DUMMYHOST &&
tt open -k $tomb_key_new $tomb \
tt open -f -k $tomb_key_new $tomb \
--unsafe --tomb-pwd $DUMMYPASS \
--sphx-user $DUMMYUSER --sphx-host $DUMMYHOST &&
print $DUMMYPASS \
Expand Down

0 comments on commit 0d06c99

Please sign in to comment.