public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Shi Weihua <shiwh@cn.fujitsu.com>
To: ltp-list <ltp-list@lists.sourceforge.net>
Subject: [LTP] [PATCH] mail_tests.sh: fix a version problem of Heirloom Mail
Date: Mon, 25 Jan 2010 15:43:08 +0800	[thread overview]
Message-ID: <4B5D4B8C.30300@cn.fujitsu.com> (raw)

In the previous mailx version, the command "echo "d" | mail -u root" will
output like the following.
-----------------------------
Mail version 8.1 6/6/93.  Type ? for help.
"/var/mail/root": 1 message 1 new
>N  1 MAILER-DAEMON@localh  Mon Jan 25 09:11  63/2367  "Returned mail: see tr"
-----------------------------

Buy in Heirloom Mail, the command will output.
-----------------------------
Heirloom Mail version 12.4 7/29/08.  Type ? for help.
"/var/mail/root": 1 message 1 new
>N  1 Mail Delivery Subsys  Mon Jan 25 14:16  67/2195  "Returned mail: see tr"
-----------------------------

"MAILER-DAEMON@localh" is been changed to "Mail Delivery Subsys".
We should make mail_tests.sh to supporting Heirloom Mail.

Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
---
--- ltp-full-20091231/testcases/commands/mail/mail_tests.sh	2009-11-16 21:25:48.000000000 +0800
+++ ltp-full-20100119/testcases/commands/mail/mail_tests.sh	2010-01-25 15:30:21.000000000 +0800
@@ -55,6 +55,25 @@ else
     LTPBIN=$LTPROOT/testcases/bin
 fi
 
+isHeirloomMail=0
+checkHeirloomMail()
+{
+    isHeirloomMail=0
+
+    if [ $# -ne 1 ]; then
+        return
+    fi
+
+    if [ ! -f $1 ]; then
+	return
+    fi
+
+    cat $1 | grep "Heirloom"
+    if [ $? -eq 0 ]; then
+	isHeirloomMail=1
+    fi
+}
+
 RC=0
 export TCID=SETUP
 export TST_COUNT=1
@@ -170,8 +189,14 @@ else
     # but wait for the mail to arrive first, sleep 5s.
     sleep 5s
     echo "d" | mail -u root > $LTPTMP/tst_mail.res 2>&1
-    RC1=$(awk '/^>N/ {IGNORECASE=1; print match($3, "Mailer-Daemon")}' \
-	$LTPTMP/tst_mail.res)
+    checkHeirloomMail $LTPTMP/tst_mail.res
+    if [ $isHeirloomMail -eq 0 ]; then
+	RC1=$(awk '/^>N/ {IGNORECASE=1; print match($3, "Mailer-Daemon")}' \
+		$LTPTMP/tst_mail.res)
+    else
+	RC1=$(awk '/^>N/ {IGNORECASE=1; print match($3 $4 $5, "MailDeliverySubsys")}' \
+		$LTPTMP/tst_mail.res)
+    fi
 ##################################################################
 # In this testcase, mail will get "Returnedmail:", while mailx will
 # get "UndeliveredMailReturned:".
@@ -181,10 +206,17 @@ else
 # or
 # /bin/mailx -> /bin/mail
 ##################################################################
-     RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
-             $LTPTMP/tst_mail.res)
-     RC3=$(awk '/^>N/ {print match($9 $10, "UndeliveredMail")}' \
-             $LTPTMP/tst_mail.res)
+     if [ $isHeirloomMail -eq 0 ]; then
+	RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
+		$LTPTMP/tst_mail.res)
+	RC3=$(awk '/^>N/ {print match($9 $10, "UndeliveredMail")}' \
+		$LTPTMP/tst_mail.res)
+     else
+	RC2=$(awk '/^>N/ {print match($11 $12, "Returnedmail:")}' \
+		$LTPTMP/tst_mail.res)
+	RC3=$(awk '/^>N/ {print match($11 $12, "UndeliveredMail")}' \
+		$LTPTMP/tst_mail.res)
+     fi
 fi 
     if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
     then
@@ -238,8 +270,14 @@ else
     # but wait for the mail to arrive first, sleep 5s.
     sleep 5s
     echo "d" | mail -u root > $LTPTMP/tst_mail.res 2>&1
-    RC1=$(awk '/^>N/ {IGNORECASE=1; print match($3, "Mailer-Daemon")}' \
-	$LTPTMP/tst_mail.res)
+    checkHeirloomMail $LTPTMP/tst_mail.res
+    if [ $isHeirloomMail -eq 0 ]; then
+	RC1=$(awk '/^>N/ {IGNORECASE=1; print match($3, "Mailer-Daemon")}' \
+		$LTPTMP/tst_mail.res)
+    else
+	RC1=$(awk '/^>N/ {IGNORECASE=1; print match($3 $4 $5, "MailDeliverySubsys")}' \
+		$LTPTMP/tst_mail.res)
+    fi
 ##################################################################
 # In this testcase, mail will get "Returnedmail:", while mailx will
 # get "UndeliveredMailReturned:".
@@ -248,11 +286,18 @@ else
 # /bin/mail -> /bin/mailx
 # or
 # /bin/mailx -> /bin/mail
-##################################################################
-     RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
-             $LTPTMP/tst_mail.res)
-     RC3=$(awk '/^>N/ {print match($9 $10, "UndeliveredMail")}' \
-             $LTPTMP/tst_mail.res)
+#################################################################
+     if [ $isHeirloomMail -eq 0 ]; then
+	RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
+		$LTPTMP/tst_mail.res)
+	RC3=$(awk '/^>N/ {print match($9 $10, "UndeliveredMail")}' \
+		$LTPTMP/tst_mail.res)
+     else
+	RC2=$(awk '/^>N/ {print match($11 $12, "Returnedmail:")}' \
+		$LTPTMP/tst_mail.res)
+	RC3=$(awk '/^>N/ {print match($11 $12, "UndeliveredMail")}' \
+		$LTPTMP/tst_mail.res)
+     fi
 fi
     if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
     then

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

             reply	other threads:[~2010-01-25  7:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-25  7:43 Shi Weihua [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-02-17  8:09 [LTP] [PATCH] mail_tests.sh: fix a version problem of Heirloom Mail Rishikesh
2010-02-17 17:08 ` Garrett Cooper
2010-02-18  3:57   ` Rishikesh K Rajak
2010-02-22  8:28     ` Shi Weihua
2010-03-02 14:46       ` Rishikesh K Rajak
2010-03-02 16:19         ` Garrett Cooper
2010-03-04  6:58           ` Shi Weihua

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B5D4B8C.30300@cn.fujitsu.com \
    --to=shiwh@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox