From 0d06c994cf09cd89c1a5eefd027b8bc421fa5e4e Mon Sep 17 00:00:00 2001 From: Jaromil Date: Sun, 12 May 2024 22:09:46 +0200 Subject: [PATCH] fix tests to run also when swap present --- Makefile | 6 ++++++ extras/test/65_passwd.sh | 10 +++++----- extras/test/90_setkey.sh | 18 +++++++++--------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 6a523ee..6fb506d 100644 --- a/Makefile +++ b/Makefile @@ -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." diff --git a/extras/test/65_passwd.sh b/extras/test/65_passwd.sh index b3114a1..dca1ce3 100644 --- a/extras/test/65_passwd.sh +++ b/extras/test/65_passwd.sh @@ -6,9 +6,9 @@ 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 ' @@ -16,7 +16,7 @@ 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 @@ -24,10 +24,10 @@ 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 ' diff --git a/extras/test/90_setkey.sh b/extras/test/90_setkey.sh index 3ec7ae5..b91d628 100755 --- a/extras/test/90_setkey.sh +++ b/extras/test/90_setkey.sh @@ -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 \ @@ -21,9 +21,9 @@ 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 @@ -31,13 +31,13 @@ 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 \