From 649932c73cc76b26e51a5c0d420ef32dcfb4bede Mon Sep 17 00:00:00 2001 From: Heiko Reese Date: Sat, 11 Sep 2021 03:16:35 +0200 Subject: [PATCH] Changed test output to conform to the TAP protocol (https://testanything.org) --- src/meson.build | 2 +- src/test_libexim-encrypt-dlfunc.sh | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/meson.build b/src/meson.build index 5d72b45..3f8540e 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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) +test('simple test', dlfunc_test, protocol: tap) decrypt_secretbox_test = find_program('test_libexim-encrypt-dlfunc-decrypt-secretbox.sh') test('decrypt-secretbox', decrypt_secretbox_test) \ No newline at end of file diff --git a/src/test_libexim-encrypt-dlfunc.sh b/src/test_libexim-encrypt-dlfunc.sh index 87ea4d2..fe0b3cd 100755 --- a/src/test_libexim-encrypt-dlfunc.sh +++ b/src/test_libexim-encrypt-dlfunc.sh @@ -1,9 +1,11 @@ #!/bin/bash set -e - PATH=/sbin:/usr/sbin:$PATH +# this script implements the TAP protocol (https://testanything.org) +echo 1..2 + # copy to /tmp to keep call to exim under 256 chars (prevent problems on Ubuntu) install -t /tmp src/libexim-encrypt-dlfunc.so @@ -15,9 +17,9 @@ CIPHERTEXT=$(exim -be "\${dlfunc{${LIB}}{sodium_crypto_secretbox_encrypt_passwor DECRYPTED=$(exim -be "\${dlfunc{${LIB}}{sodium_crypto_secretbox_decrypt_password}{${PASSWORD}}{${CIPHERTEXT}}}") if [ "${CLEARTEXT}" == "${DECRYPTED}" ] ; then - echo "secretbox test successful" + echo "ok 1 - secretbox test successful" else - echo "secretbox test unsuccessful" + echo "not ok 1 - secretbox test unsuccessful" exit 127 fi @@ -30,8 +32,8 @@ CIPHERTEXT=$(exim -be "\${dlfunc{${LIB}}{sodium_crypto_box_seal}{${PK}}{${CLEART DECRYPTED=$(exim -be "\${dlfunc{${LIB}}{sodium_crypto_box_seal_open}{${SK}}{${PK}}{${CIPHERTEXT}}}") if [ "${CLEARTEXT}" == "${DECRYPTED}" ] ; then - echo "sealed_box test successful" + echo "ok 2 - sealed_box test successful" else - echo "sealed_box test unsuccessful" + echo "ok 2 - sealed_box test unsuccessful" exit 128 fi