fix tests to run also when swap present

This commit is contained in:
Jaromil 2024-05-12 22:09:46 +02:00
parent 6c383ffd64
commit 0d06c994cf
3 changed files with 20 additions and 14 deletions

View File

@ -2,6 +2,12 @@ PROG = tomb
PREFIX ?= /usr/local PREFIX ?= /usr/local
MANDIR ?= ${PREFIX}/share/man 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: all:
@echo @echo
@echo "Tomb is a script and does not need compilation, it can be simply executed." @echo "Tomb is a script and does not need compilation, it can be simply executed."

View File

@ -6,9 +6,9 @@ source ./setup
test_export "test" # Using already generated tomb test_export "test" # Using already generated tomb
test_expect_success 'Testing tomb with GnuPG keys: passwd' ' 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 && --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 --tomb-old-pwd $DUMMYPASSNEW --tomb-pwd $DUMMYPASS
' '
@ -16,7 +16,7 @@ if test_have_prereq GPGRCPT; then
test_export "recipient" # Using already generated tomb test_export "recipient" # Using already generated tomb
test_expect_success 'Testing tomb with GnuPG keys: passwd' ' 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 fi
@ -24,10 +24,10 @@ fi
if test_have_prereq SPHINX ORACLE; then if test_have_prereq SPHINX ORACLE; then
test_export "sphinx_test" # Using already generated tomb test_export "sphinx_test" # Using already generated tomb
test_expect_success 'Testing changing tomb password with sphinx' ' 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 \ --tomb-old-pwd $DUMMYPASS --tomb-pwd $DUMMYPASSNEW \
--sphx-user $DUMMYUSER --sphx-host $DUMMYHOST && --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 \ --tomb-old-pwd $DUMMYPASSNEW --tomb-pwd $DUMMYPASS \
--sphx-user $DUMMYUSER --sphx-host $DUMMYHOST --sphx-user $DUMMYUSER --sphx-host $DUMMYHOST
' '

View File

@ -6,11 +6,11 @@ source ./setup
test_export "test" # Using already generated tomb test_export "test" # Using already generated tomb
test_expect_success 'Testing set key' ' 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 && --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 && --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 && --unsafe --tomb-pwd $DUMMYPASS &&
print $DUMMYPASS \ print $DUMMYPASS \
| gpg --batch --passphrase-fd 0 --no-tty --no-options -d $tomb_key_new \ | gpg --batch --passphrase-fd 0 --no-tty --no-options -d $tomb_key_new \
@ -21,9 +21,9 @@ test_expect_success 'Testing set key' '
if test_have_prereq GPGRCPT; then if test_have_prereq GPGRCPT; then
test_export "recipient" # Using already generated tomb test_export "recipient" # Using already generated tomb
test_expect_success 'Testing tomb with GnuPG keys: setkey' ' test_expect_success 'Testing tomb with GnuPG keys: setkey' '
tt forge $tomb_key_new -g -r $KEY2 --ignore-swap --unsafe && tt forge -f $tomb_key_new -g -r $KEY2 --ignore-swap --unsafe &&
tt setkey -k $tomb_key_new $tomb_key $tomb -g -r $KEY2 && tt setkey -f -k $tomb_key_new $tomb_key $tomb -g -r $KEY2 &&
tt open -k $tomb_key_new $tomb -g && tt open -f -k $tomb_key_new $tomb -g &&
tt_close tt_close
' '
fi fi
@ -31,13 +31,13 @@ fi
if test_have_prereq SPHINX ORACLE; then if test_have_prereq SPHINX ORACLE; then
test_export "sphinx_test" # Using already generated tomb test_export "sphinx_test" # Using already generated tomb
test_expect_success 'Testing set key (sphinx)' ' 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 \ --ignore-swap --unsafe --force \
--sphx-user $DUMMYUSER --sphx-host $DUMMYHOST && --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 \ --unsafe --tomb-pwd $DUMMYPASS --tomb-old-pwd $DUMMYPASS \
--sphx-user $DUMMYUSER --sphx-host $DUMMYHOST && --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 \ --unsafe --tomb-pwd $DUMMYPASS \
--sphx-user $DUMMYUSER --sphx-host $DUMMYHOST && --sphx-user $DUMMYUSER --sphx-host $DUMMYHOST &&
print $DUMMYPASS \ print $DUMMYPASS \