diff --git a/dev/easytls-unit-tests.sh b/dev/easytls-unit-tests.sh index b573e1b..b87ac98 100755 --- a/dev/easytls-unit-tests.sh +++ b/dev/easytls-unit-tests.sh @@ -25,6 +25,43 @@ usage () " } + +# Tools Version +tools_version() { + print " +OpenSSL command: ${OPENSSL_CMD}" + ${INVOKE_OPTS} "${OPENSSL_CMD}" version || \ + fail "${INVOKE_OPTS} ${OPENSSL_CMD} version ($exit_code)" + + print " +EasyRSA command: ${EASYRSA_CMD}" + ${INVOKE_OPTS} "${EASYRSA_CMD}" version || \ + fail "${INVOKE_OPTS} ${EASYRSA_CMD} version ($exit_code)" + + print " +EasyTLS command: ${EASYTLS_CMD}" + ${INVOKE_OPTS} "${EASYTLS_CMD}" -V || \ + fail "${INVOKE_OPTS} ${EASYTLS_CMD} -V ($exit_code)" + + print " +EasyTLS-cryptv2-verify command: ${TLSCV2V_CMD}" + ${INVOKE_OPTS} "${TLSCV2V_CMD}" -V || exit_code=$? + [ $exit_code -eq 9 ] || \ + fail "${INVOKE_OPTS} ${TLSCV2V_CMD} -V ($exit_code)" + + print " +EasyTLS-client-connect command: ${CLICON_CMD}" + ${INVOKE_OPTS} "${CLICON_CMD}" -V || exit_code=$? + [ $exit_code -eq 9 ] || \ + fail "${INVOKE_OPTS} ${CLICON_CMD} -V ($exit_code)" + + print " +EasyTLS-client-disconnect command: ${CLIDIS_CMD}" + ${INVOKE_OPTS} "${CLIDIS_CMD}" -V || exit_code=$? + [ $exit_code -eq 9 ] || \ + fail "${INVOKE_OPTS} ${CLIDIS_CMD} -V ($exit_code)" +} + fail () { print "$@" @@ -118,7 +155,8 @@ warn() { printf "%s\n" "$*"; } build_test_pki () { - for i in "make-safe-ssl" \ + for i in \ + "make-safe-ssl" \ "--req-cn='easytls-unit-test' build-ca nopass" \ "build-server-full s01 nopass" \ "build-server-full s02 nopass" \ @@ -309,7 +347,7 @@ WORK_DIR="$(pwd)" UTMP_DIR="${WORK_DIR}/unit-test-tmp" rm -rf "${UTMP_DIR}" -EASYRSA_CMD="./easyrsa" +EASYRSA_CMD="${EASYRSA_CMD:-./easyrsa}" EASYRSA_OPTS="--batch" EASYTLS_CMD="./easytls" @@ -385,11 +423,18 @@ else export EASYTLS_OPENVPN=openvpn export OPENVPN_CMD=openvpn fi + + export EASYRSA_OPENSSL="openssl" + export OPENSSL_CMD="openssl" + fi # Invoke with user opts: eg. EASYTLS_SILENT=1 INVOKE_OPTS="" +# Version info +tools_version + # Test help print "TEST: All --help" @@ -1216,21 +1261,8 @@ DBUG_DIR="$WORK_DIR/et-tdir1/easytls/metadata" #"$EASYTLS_CMD" $EASYTLS_OPTS version || \ # fail "Unit test error 71: version" -# Version -${INVOKE_OPTS} "${EASYTLS_CMD}" -V || \ - fail "${INVOKE_OPTS} ${EASYTLS_CMD} -V ($exit_code)" - -${INVOKE_OPTS} "${TLSCV2V_CMD}" -V || exit_code=$? -[ $exit_code -eq 9 ] || \ - fail "${INVOKE_OPTS} ${TLSCV2V_CMD} -V ($exit_code)" - -${INVOKE_OPTS} "${CLICON_CMD}" -V || exit_code=$? -[ $exit_code -eq 9 ] || \ - fail "${INVOKE_OPTS} ${CLICON_CMD} -V ($exit_code)" - -${INVOKE_OPTS} "${CLIDIS_CMD}" -V || exit_code=$? -[ $exit_code -eq 9 ] || \ - fail "${INVOKE_OPTS} ${CLIDIS_CMD} -V ($exit_code)" +# Version info +tools_version # Stats unset EASYTLS_QUIET