Fixed test numbering

This commit is contained in:
Heiko Reese
2021-09-11 11:41:12 +02:00
parent 649932c73c
commit 8845aaa653
3 changed files with 29 additions and 17 deletions

View File

@ -17,7 +17,7 @@ shared_library('exim-encrypt-dlfunc', 'libexim-encrypt-dlfunc.c',
install: true)
dlfunc_test = find_program('test_libexim-encrypt-dlfunc.sh')
test('simple test', dlfunc_test, protocol: tap)
test('libexim-encrypt-dlfunc', dlfunc_test, protocol: 'tap')
decrypt_secretbox_test = find_program('test_libexim-encrypt-dlfunc-decrypt-secretbox.sh')
test('decrypt-secretbox', decrypt_secretbox_test)
test('decrypt-secretbox', decrypt_secretbox_test, protocol: 'tap')

View File

@ -1,30 +1,45 @@
#!/bin/bash
# shellcheck disable=SC2034
set -e
PATH=/sbin:/usr/sbin:$PATH
# this script implements the TAP protocol (https://testanything.org)
echo 1..4
TEST_PASSWORD='ThisIsAPassword'
TEST_CLEARTEXT='This is my cleartext'
TEST_CIPHERTEXT01='RCHI+VukmWIsVE3eixbWIAtPPBW63nmV1ITpSBEDYXC9Y5QMBd1zmGLLhE+S9yg0sHfOF/1+wmfF7YXv'
TEST_CIPHERTEXT02='sEG09WnEKIN2nyJYGNNVo14o7wV6X9HQxW+zxAxMLX9jVdashdaoHqLXQGM8lzpJhG6629lccjzAfrq8'
CIPHERTEXT_FILE01="$(mktemp)"
CIPHERTEXT_FILE02="$(mktemp)"
echo "${TEST_CIPHERTEXT01}" > "${CIPHERTEXT_FILE01}"
echo "${TEST_CIPHERTEXT02}" > "${CIPHERTEXT_FILE02}"
DECRYPTED01="$(LIBEXIM_PASSWORD="${TEST_PASSWORD}" src/libexim-encrypt-dlfunc-decrypt-secretbox ${TEST_CIPHERTEXT01})"
if [ "${DECRYPTED01}" == "${TEST_CLEARTEXT}" ] ; then
echo "decryption with password from environment successful"
echo "ok 1 - decrypt commandline argument with password from environment successful"
else
echo "decryption with password from environment unsuccessful"
exit 127
echo "not ok 1 - decrypt commandline argument with password from environment unsuccessful"
fi
unset LIBEXIM_PASSWORD
DECRYPTED02="$(src/libexim-encrypt-dlfunc-decrypt-secretbox -p ${TEST_PASSWORD} ${TEST_CIPHERTEXT02})"
DECRYPTED02="$(LIBEXIM_PASSWORD="${TEST_PASSWORD}" src/libexim-encrypt-dlfunc-decrypt-secretbox --infile ${CIPHERTEXT_FILE01})"
if [ "${DECRYPTED02}" == "${TEST_CLEARTEXT}" ] ; then
echo "decryption with password from commandline successful"
echo "ok 2 - decrypt file contents with password from environment successful"
else
echo "decryption with password from commandline unsuccessful"
exit 128
echo "not ok 2 - decrypt file contents with password from environment unsuccessful"
fi
unset LIBEXIM_PASSWORD
DECRYPTED03="$(src/libexim-encrypt-dlfunc-decrypt-secretbox -p ${TEST_PASSWORD} ${TEST_CIPHERTEXT02})"
if [ "${DECRYPTED03}" == "${TEST_CLEARTEXT}" ] ; then
echo "ok 3 - decrypt commandline argument with password from commandline successful"
else
echo "not ok 3 - decrypt commandline argument with password from commandline unsuccessful"
fi
DECRYPTED04="$(src/libexim-encrypt-dlfunc-decrypt-secretbox -p ${TEST_PASSWORD} --infile ${CIPHERTEXT_FILE02})"
if [ "${DECRYPTED04}" == "${TEST_CLEARTEXT}" ] ; then
echo "ok 4 - decrypt commandline argument with password from commandline successful"
else
echo "not ok 4 - decrypt commandline argument with password from commandline unsuccessful"
fi

View File

@ -1,6 +1,5 @@
#!/bin/bash
set -e
PATH=/sbin:/usr/sbin:$PATH
# this script implements the TAP protocol (https://testanything.org)
@ -20,7 +19,6 @@ if [ "${CLEARTEXT}" == "${DECRYPTED}" ] ; then
echo "ok 1 - secretbox test successful"
else
echo "not ok 1 - secretbox test unsuccessful"
exit 127
fi
# { 0xb6, 0x01, 0x45, 0x20, 0x9f, 0x55, 0x06, 0x74, 0x29, 0x71, 0x7b, 0x5e, 0xa9, 0x68, 0x60, 0x5e, 0x81, 0x1a, 0x54, 0x6b, 0xc9, 0x80, 0x97, 0x78, 0x41, 0xc6, 0x20, 0xae, 0x66, 0x9f, 0xd9, 0x53 };
@ -35,5 +33,4 @@ if [ "${CLEARTEXT}" == "${DECRYPTED}" ] ; then
echo "ok 2 - sealed_box test successful"
else
echo "ok 2 - sealed_box test unsuccessful"
exit 128
fi