From 1dfe804a175e48172d393127b7e22e8467d74b01 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Oct 03 2014 20:20:11 +0000 Subject: fixed sendmail test - different syntax then postfix --- diff --git a/tests/p_sendmail/20_sendmail_mta.sh b/tests/p_sendmail/20_sendmail_mta.sh index 437a054..2141f6b 100755 --- a/tests/p_sendmail/20_sendmail_mta.sh +++ b/tests/p_sendmail/20_sendmail_mta.sh @@ -4,26 +4,25 @@ t_Log "Running $0 - sendmail can accept and deliver local email." # send mail to localhost -mail=$(echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep queued) -if [ $? = 0 ] +mail=$(echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep accepted) +if [ $? == 0 ] then t_Log 'Mail has been queued successfully' MTA_ACCEPT=0 fi sleep 1 -regex='250\ 2\.0\.0\ Ok\:\ queued\ as\ ([0-9A-Z]*).*' +regex='250\ 2\.0\.0\ ([0-9A-Za-z]*)\ Message\ accepted\ for\ delivery' if [[ $mail =~ $regex ]] then - grep -q "${BASH_REMATCH[1]}: removed" /var/log/maillog + egrep -q "${BASH_REMATCH[1]}\:.*stat\=Sent" /var/log/maillog DELIVERED=$? fi -if ([ $MTA_ACCEPT = 0 ] && [ $DELIVERED = 0 ]) +if ([ $MTA_ACCEPT == 0 ] && [ $DELIVERED == 0 ]) then ret_val=0 t_Log 'Mail has been delivered and removed from queue.' fi t_CheckExitStatus $ret_val - diff --git a/tests/p_sendmail/30_sendmail_mta_ehlo.sh b/tests/p_sendmail/30_sendmail_mta_ehlo.sh index fda5581..ff0f082 100755 --- a/tests/p_sendmail/30_sendmail_mta_ehlo.sh +++ b/tests/p_sendmail/30_sendmail_mta_ehlo.sh @@ -1,30 +1,28 @@ -#!/bin/bash +#!/bin/sh # Author: Christoph Galuschka -t_Log "Running $0 - sendmail can accept and deliver local email using ESMTP." +t_Log "Running $0 - sendmail can accept and deliver local email." # send mail to localhost -mail=$(echo -e "ehlo localhost\nmail from: root@localhost\nrcpt to: root@localho -st\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep queued) -if [ $? = 0 ] +mail=$(echo -e "ehlo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep accepted) +if [ $? == 0 ] then t_Log 'Mail has been queued successfully' MTA_ACCEPT=0 fi sleep 1 -regex='250\ 2\.0\.0\ Ok\:\ queued\ as\ ([0-9A-Z]*).*' +regex='250\ 2\.0\.0\ ([0-9A-Za-z]*)\ Message\ accepted\ for\ delivery' if [[ $mail =~ $regex ]] then - grep -q "${BASH_REMATCH[1]}: removed" /var/log/maillog + egrep -q "${BASH_REMATCH[1]}\:.*stat\=Sent" /var/log/maillog DELIVERED=$? fi -if ([ $MTA_ACCEPT = 0 ] && [ $DELIVERED = 0 ]) +if ([ $MTA_ACCEPT == 0 ] && [ $DELIVERED == 0 ]) then ret_val=0 t_Log 'Mail has been delivered and removed from queue.' fi t_CheckExitStatus $ret_val -