Blame tests/p_exim/20_exim_mta_helo-test.sh

e0746c
#!/bin/bash
Christoph Galuschka 36781f
# Author: Christoph Galuschka <tigalch@tigalch.org>
Christoph Galuschka d05160
Christoph Galuschka d05160
t_Log "Running $0 - exim can accept and deliver local email."
Christoph Galuschka d05160
Christoph Galuschka d05160
if [ $centos_ver == '5' ]
18c0db
  then
Christoph Galuschka d05160
  ret_val=1
Christoph Galuschka d05160
a02188
  # create user for local delivery
a02188
  useradd eximtest
a02188
Christoph Galuschka d05160
  # send mail to localhost
a02188
  mail=$(./tests/p_exim/_helper_exim_helo.expect | grep "250 OK")
bb927b
  MTA_ACCEPT=$?
bb927b
  if [ $MTA_ACCEPT == 0 ]
Christoph Galuschka d05160
    then
Christoph Galuschka d05160
    t_Log 'Mail has been queued successfully'
Christoph Galuschka d05160
  fi
Christoph Galuschka d05160
bb927b
  regex='250\ OK\ id\=([0-9A-Za-z-]*)'
bb927b
  if [[ $mail =~ $regex ]]
Christoph Galuschka d05160
    then
5a9020
    sleep 1
a02188
    grep -q "${BASH_REMATCH[1]} Completed" /var/log/exim/main.log
bb927b
    DELIVERED=$?
Christoph Galuschka d05160
  fi
Christoph Galuschka d05160
a02188
  if ([ $MTA_ACCEPT == 0  ] && [ $DELIVERED == 0 ])
Christoph Galuschka d05160
    then
Christoph Galuschka d05160
    ret_val=0
Christoph Galuschka d05160
  fi
Christoph Galuschka d05160
else
18c0db
  t_Log "This is not a C5 system - skipping"
Christoph Galuschka d05160
  ret_val=0
Christoph Galuschka d05160
fi
Christoph Galuschka d05160
Christoph Galuschka d05160
t_CheckExitStatus $ret_val