public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] mail: fix the bug of mail01
@ 2009-11-04  8:14 liubo
  2009-11-13  1:07 ` liubo
  0 siblings, 1 reply; 6+ messages in thread
From: liubo @ 2009-11-04  8:14 UTC (permalink / raw)
  To: ltp-list

In the testcase "mail01",

when mail is send to nosuchuser@domain
and mail is send to user@nosuchdomain,
mail program may return either "Returnedmail:"
or "UndeliveredMailReturned", regardless of
the existence of /etc/redhat-release.

So, we did a bit of changes to recongnize both of
returned values.

This patch fixes the problem.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 testcases/commands/mail/mail_tests.sh |   65 ++++++++++++++++-----------------
 1 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/testcases/commands/mail/mail_tests.sh b/testcases/commands/mail/mail_tests.sh
index 45bac93..024120f 100755
--- a/testcases/commands/mail/mail_tests.sh
+++ b/testcases/commands/mail/mail_tests.sh
@@ -172,28 +172,27 @@ else
     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)
-    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
-        $LTPTMP/tst_mail.res)
-#####
-# Some mailers (e.g., Red Hat's sendmail) print different messages 
-#####
-if [ -f /etc/redhat-release ] 
-then 
-  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
+##################################################################
+# In this testcase, mail will get "Returnedmail:", while mailx will
+# get "UndeliveredMailReturned:".
+# Either of mail and mailx may be linked to another.
+# For example,
+# /bin/mail -> /bin/mailx
+# or
+# /bin/mailx -> /bin/mail
+##################################################################
      RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
              $LTPTMP/tst_mail.res)
-else 
-  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
-     RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
+     RC3=$(awk '/^>N/ {print match($9 $10, "UndeliveredMail")}' \
              $LTPTMP/tst_mail.res)
 fi 
-    if [ -z "$RC1" -a -z "$RC2" ]
+    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
     then
         $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
         "Test #2: No new mail for root. Reason:"
         TFAILCNT=$(( $TFAILCNT+1 ))
     else
-        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
+        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
         then
             $LTPBIN/tst_resm TPASS \
                 "Test #2: Mailer-Deamon reported delivery failure"
@@ -203,7 +202,6 @@ fi
             TFAILCNT=$(( $TFAILCNT+1 ))
         fi
     fi
-fi
 else
     $LTPBIN/tst_resm TCONF "mail command not installed"
 fi    
@@ -242,29 +240,28 @@ else
     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)
-    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
-        $LTPTMP/tst_mail.res)
-#####
-# Some mailers (e.g., Red Hat's sendmail) print different messages 
-#####
-if [ -f /etc/redhat-release ] 
-then 
-   [ -z "$RC2" -o "X$RC2" = "X0" ] && \
-      RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
-              $LTPTMP/tst_mail.res)
-else 
-    [ -z "$RC2" -o "X$RC2" = "X0" ] && \
-        RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
-                $LTPTMP/tst_mail.res)
-fi 
-    if [ -z "$RC1" -a -z "$RC2" ]
+##################################################################
+# In this testcase, mail will get "Returnedmail:", while mailx will
+# get "UndeliveredMailReturned:".
+# Either of mail and mailx may be linked to another.
+# For example,
+# /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)
+fi
+    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
     then
         $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
-        "Test #3: No new mail for root. Reason:"
+        "Test #2: No new mail for root. Reason:"
         TFAILCNT=$(( $TFAILCNT+1 ))
     else
-        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
-        then
+        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
+	then
             $LTPBIN/tst_resm TPASS \
                 "Test #3: Mailer-Deamon reported delivery failure"
         else
@@ -273,7 +270,7 @@ fi
             TFAILCNT=$(( $TFAILCNT+1 ))
         fi
     fi
-fi
+
 else
     $LTPBIN/tst_resm TCONF "mail command not installed"
 fi
-- 
1.6.2.2




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] mail: fix the bug of mail01
  2009-11-04  8:14 [LTP] [PATCH] mail: fix the bug of mail01 liubo
@ 2009-11-13  1:07 ` liubo
  2009-11-16  8:13   ` Subrata Modak
  0 siblings, 1 reply; 6+ messages in thread
From: liubo @ 2009-11-13  1:07 UTC (permalink / raw)
  To: Subrata Modak; +Cc: ltp-list

Hi, Subrata,

On 11/04/2009 04:14 PM, liubo wrote:
> In the testcase "mail01",
>
> when mail is send to nosuchuser@domain
> and mail is send to user@nosuchdomain,
> mail program may return either "Returnedmail:"
> or "UndeliveredMailReturned", regardless of
> the existence of /etc/redhat-release.
>
> So, we did a bit of changes to recongnize both of
> returned values.
>
> This patch fixes the problem.
>
> Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
>   

Is there any problem about this patch?

> ---
>  testcases/commands/mail/mail_tests.sh |   65 ++++++++++++++++-----------------
>  1 files changed, 31 insertions(+), 34 deletions(-)
>
> diff --git a/testcases/commands/mail/mail_tests.sh b/testcases/commands/mail/mail_tests.sh
> index 45bac93..024120f 100755
> --- a/testcases/commands/mail/mail_tests.sh
> +++ b/testcases/commands/mail/mail_tests.sh
> @@ -172,28 +172,27 @@ else
>      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)
> -    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
> -        $LTPTMP/tst_mail.res)
> -#####
> -# Some mailers (e.g., Red Hat's sendmail) print different messages 
> -#####
> -if [ -f /etc/redhat-release ] 
> -then 
> -  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> +##################################################################
> +# In this testcase, mail will get "Returnedmail:", while mailx will
> +# get "UndeliveredMailReturned:".
> +# Either of mail and mailx may be linked to another.
> +# For example,
> +# /bin/mail -> /bin/mailx
> +# or
> +# /bin/mailx -> /bin/mail
> +##################################################################
>       RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
>               $LTPTMP/tst_mail.res)
> -else 
> -  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> -     RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
> +     RC3=$(awk '/^>N/ {print match($9 $10, "UndeliveredMail")}' \
>               $LTPTMP/tst_mail.res)
>  fi 
> -    if [ -z "$RC1" -a -z "$RC2" ]
> +    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
>      then
>          $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
>          "Test #2: No new mail for root. Reason:"
>          TFAILCNT=$(( $TFAILCNT+1 ))
>      else
> -        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
> +        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
>          then
>              $LTPBIN/tst_resm TPASS \
>                  "Test #2: Mailer-Deamon reported delivery failure"
> @@ -203,7 +202,6 @@ fi
>              TFAILCNT=$(( $TFAILCNT+1 ))
>          fi
>      fi
> -fi
>  else
>      $LTPBIN/tst_resm TCONF "mail command not installed"
>  fi    
> @@ -242,29 +240,28 @@ else
>      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)
> -    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
> -        $LTPTMP/tst_mail.res)
> -#####
> -# Some mailers (e.g., Red Hat's sendmail) print different messages 
> -#####
> -if [ -f /etc/redhat-release ] 
> -then 
> -   [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> -      RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
> -              $LTPTMP/tst_mail.res)
> -else 
> -    [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> -        RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
> -                $LTPTMP/tst_mail.res)
> -fi 
> -    if [ -z "$RC1" -a -z "$RC2" ]
> +##################################################################
> +# In this testcase, mail will get "Returnedmail:", while mailx will
> +# get "UndeliveredMailReturned:".
> +# Either of mail and mailx may be linked to another.
> +# For example,
> +# /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)
> +fi
> +    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
>      then
>          $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
> -        "Test #3: No new mail for root. Reason:"
> +        "Test #2: No new mail for root. Reason:"
>          TFAILCNT=$(( $TFAILCNT+1 ))
>      else
> -        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
> -        then
> +        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
> +	then
>              $LTPBIN/tst_resm TPASS \
>                  "Test #3: Mailer-Deamon reported delivery failure"
>          else
> @@ -273,7 +270,7 @@ fi
>              TFAILCNT=$(( $TFAILCNT+1 ))
>          fi
>      fi
> -fi
> +
>  else
>      $LTPBIN/tst_resm TCONF "mail command not installed"
>  fi
>   


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] mail: fix the bug of mail01
  2009-11-13  1:07 ` liubo
@ 2009-11-16  8:13   ` Subrata Modak
  2009-11-16  8:53     ` liubo
  0 siblings, 1 reply; 6+ messages in thread
From: Subrata Modak @ 2009-11-16  8:13 UTC (permalink / raw)
  To: liubo; +Cc: ltp-list

On Fri, 2009-11-13 at 09:07 +0800, liubo wrote: 
> Hi, Subrata,
> 
> On 11/04/2009 04:14 PM, liubo wrote:
> > In the testcase "mail01",
> >
> > when mail is send to nosuchuser@domain
> > and mail is send to user@nosuchdomain,
> > mail program may return either "Returnedmail:"
> > or "UndeliveredMailReturned", regardless of
> > the existence of /etc/redhat-release.
> >
> > So, we did a bit of changes to recongnize both of
> > returned values.
> >
> > This patch fixes the problem.
> >
> > Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
> >   
> 
> Is there any problem about this patch?

Hey, i missed this. Not able to find it in my mailbox also. Can you
please resend it ?

Regards--
Subrata

> 
> > ---
> >  testcases/commands/mail/mail_tests.sh |   65 ++++++++++++++++-----------------
> >  1 files changed, 31 insertions(+), 34 deletions(-)
> >
> > diff --git a/testcases/commands/mail/mail_tests.sh b/testcases/commands/mail/mail_tests.sh
> > index 45bac93..024120f 100755
> > --- a/testcases/commands/mail/mail_tests.sh
> > +++ b/testcases/commands/mail/mail_tests.sh
> > @@ -172,28 +172,27 @@ else
> >      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)
> > -    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
> > -        $LTPTMP/tst_mail.res)
> > -#####
> > -# Some mailers (e.g., Red Hat's sendmail) print different messages 
> > -#####
> > -if [ -f /etc/redhat-release ] 
> > -then 
> > -  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> > +##################################################################
> > +# In this testcase, mail will get "Returnedmail:", while mailx will
> > +# get "UndeliveredMailReturned:".
> > +# Either of mail and mailx may be linked to another.
> > +# For example,
> > +# /bin/mail -> /bin/mailx
> > +# or
> > +# /bin/mailx -> /bin/mail
> > +##################################################################
> >       RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
> >               $LTPTMP/tst_mail.res)
> > -else 
> > -  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> > -     RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
> > +     RC3=$(awk '/^>N/ {print match($9 $10, "UndeliveredMail")}' \
> >               $LTPTMP/tst_mail.res)
> >  fi 
> > -    if [ -z "$RC1" -a -z "$RC2" ]
> > +    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
> >      then
> >          $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
> >          "Test #2: No new mail for root. Reason:"
> >          TFAILCNT=$(( $TFAILCNT+1 ))
> >      else
> > -        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
> > +        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
> >          then
> >              $LTPBIN/tst_resm TPASS \
> >                  "Test #2: Mailer-Deamon reported delivery failure"
> > @@ -203,7 +202,6 @@ fi
> >              TFAILCNT=$(( $TFAILCNT+1 ))
> >          fi
> >      fi
> > -fi
> >  else
> >      $LTPBIN/tst_resm TCONF "mail command not installed"
> >  fi    
> > @@ -242,29 +240,28 @@ else
> >      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)
> > -    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
> > -        $LTPTMP/tst_mail.res)
> > -#####
> > -# Some mailers (e.g., Red Hat's sendmail) print different messages 
> > -#####
> > -if [ -f /etc/redhat-release ] 
> > -then 
> > -   [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> > -      RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
> > -              $LTPTMP/tst_mail.res)
> > -else 
> > -    [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> > -        RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
> > -                $LTPTMP/tst_mail.res)
> > -fi 
> > -    if [ -z "$RC1" -a -z "$RC2" ]
> > +##################################################################
> > +# In this testcase, mail will get "Returnedmail:", while mailx will
> > +# get "UndeliveredMailReturned:".
> > +# Either of mail and mailx may be linked to another.
> > +# For example,
> > +# /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)
> > +fi
> > +    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
> >      then
> >          $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
> > -        "Test #3: No new mail for root. Reason:"
> > +        "Test #2: No new mail for root. Reason:"
> >          TFAILCNT=$(( $TFAILCNT+1 ))
> >      else
> > -        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
> > -        then
> > +        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
> > +	then
> >              $LTPBIN/tst_resm TPASS \
> >                  "Test #3: Mailer-Deamon reported delivery failure"
> >          else
> > @@ -273,7 +270,7 @@ fi
> >              TFAILCNT=$(( $TFAILCNT+1 ))
> >          fi
> >      fi
> > -fi
> > +
> >  else
> >      $LTPBIN/tst_resm TCONF "mail command not installed"
> >  fi
> >   
> 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] mail: fix the bug of mail01
  2009-11-16  8:13   ` Subrata Modak
@ 2009-11-16  8:53     ` liubo
  0 siblings, 0 replies; 6+ messages in thread
From: liubo @ 2009-11-16  8:53 UTC (permalink / raw)
  To: subrata; +Cc: ltp-list


[-- Attachment #1.1: Type: text/plain, Size: 5461 bytes --]

Hi, Subrata,
On 11/16/2009 04:13 PM, Subrata Modak wrote:
> On Fri, 2009-11-13 at 09:07 +0800, liubo wrote: 
>   
>> Hi, Subrata,
>>
>> On 11/04/2009 04:14 PM, liubo wrote:
>>     
>>> In the testcase "mail01",
>>>
>>> when mail is send to nosuchuser@domain
>>> and mail is send to user@nosuchdomain,
>>> mail program may return either "Returnedmail:"
>>> or "UndeliveredMailReturned", regardless of
>>> the existence of /etc/redhat-release.
>>>
>>> So, we did a bit of changes to recongnize both of
>>> returned values.
>>>
>>> This patch fixes the problem.
>>>
>>> Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
>>>   
>>>       
>> Is there any problem about this patch?
>>     
>
> Hey, i missed this. Not able to find it in my mailbox also. Can you
> please resend it ?
>
>   

Ok, I will.

> Regards--
> Subrata
>
>   
>>> ---
>>>  testcases/commands/mail/mail_tests.sh |   65 ++++++++++++++++-----------------
>>>  1 files changed, 31 insertions(+), 34 deletions(-)
>>>
>>> diff --git a/testcases/commands/mail/mail_tests.sh b/testcases/commands/mail/mail_tests.sh
>>> index 45bac93..024120f 100755
>>> --- a/testcases/commands/mail/mail_tests.sh
>>> +++ b/testcases/commands/mail/mail_tests.sh
>>> @@ -172,28 +172,27 @@ else
>>>      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)
>>> -    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
>>> -        $LTPTMP/tst_mail.res)
>>> -#####
>>> -# Some mailers (e.g., Red Hat's sendmail) print different messages 
>>> -#####
>>> -if [ -f /etc/redhat-release ] 
>>> -then 
>>> -  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
>>> +##################################################################
>>> +# In this testcase, mail will get "Returnedmail:", while mailx will
>>> +# get "UndeliveredMailReturned:".
>>> +# Either of mail and mailx may be linked to another.
>>> +# For example,
>>> +# /bin/mail -> /bin/mailx
>>> +# or
>>> +# /bin/mailx -> /bin/mail
>>> +##################################################################
>>>       RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
>>>               $LTPTMP/tst_mail.res)
>>> -else 
>>> -  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
>>> -     RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
>>> +     RC3=$(awk '/^>N/ {print match($9 $10, "UndeliveredMail")}' \
>>>               $LTPTMP/tst_mail.res)
>>>  fi 
>>> -    if [ -z "$RC1" -a -z "$RC2" ]
>>> +    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
>>>      then
>>>          $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
>>>          "Test #2: No new mail for root. Reason:"
>>>          TFAILCNT=$(( $TFAILCNT+1 ))
>>>      else
>>> -        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
>>> +        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
>>>          then
>>>              $LTPBIN/tst_resm TPASS \
>>>                  "Test #2: Mailer-Deamon reported delivery failure"
>>> @@ -203,7 +202,6 @@ fi
>>>              TFAILCNT=$(( $TFAILCNT+1 ))
>>>          fi
>>>      fi
>>> -fi
>>>  else
>>>      $LTPBIN/tst_resm TCONF "mail command not installed"
>>>  fi    
>>> @@ -242,29 +240,28 @@ else
>>>      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)
>>> -    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
>>> -        $LTPTMP/tst_mail.res)
>>> -#####
>>> -# Some mailers (e.g., Red Hat's sendmail) print different messages 
>>> -#####
>>> -if [ -f /etc/redhat-release ] 
>>> -then 
>>> -   [ -z "$RC2" -o "X$RC2" = "X0" ] && \
>>> -      RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
>>> -              $LTPTMP/tst_mail.res)
>>> -else 
>>> -    [ -z "$RC2" -o "X$RC2" = "X0" ] && \
>>> -        RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
>>> -                $LTPTMP/tst_mail.res)
>>> -fi 
>>> -    if [ -z "$RC1" -a -z "$RC2" ]
>>> +##################################################################
>>> +# In this testcase, mail will get "Returnedmail:", while mailx will
>>> +# get "UndeliveredMailReturned:".
>>> +# Either of mail and mailx may be linked to another.
>>> +# For example,
>>> +# /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)
>>> +fi
>>> +    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
>>>      then
>>>          $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
>>> -        "Test #3: No new mail for root. Reason:"
>>> +        "Test #2: No new mail for root. Reason:"
>>>          TFAILCNT=$(( $TFAILCNT+1 ))
>>>      else
>>> -        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
>>> -        then
>>> +        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
>>> +	then
>>>              $LTPBIN/tst_resm TPASS \
>>>                  "Test #3: Mailer-Deamon reported delivery failure"
>>>          else
>>> @@ -273,7 +270,7 @@ fi
>>>              TFAILCNT=$(( $TFAILCNT+1 ))
>>>          fi
>>>      fi
>>> -fi
>>> +
>>>  else
>>>      $LTPBIN/tst_resm TCONF "mail command not installed"
>>>  fi
>>>   
>>>       
>
>
>
>   


[-- Attachment #1.2: Type: text/html, Size: 5896 bytes --]

[-- Attachment #2: Type: text/plain, Size: 354 bytes --]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] mail: fix the bug of mail01
@ 2009-11-16  8:55 liubo
  2009-11-16 13:39 ` Subrata Modak
  0 siblings, 1 reply; 6+ messages in thread
From: liubo @ 2009-11-16  8:55 UTC (permalink / raw)
  To: ltp-list

In the testcase "mail01",

when mail is send to nosuchuser@domain
and mail is send to user@nosuchdomain,
mail program may return either "Returnedmail:"
or "UndeliveredMailReturned", regardless of
the existence of /etc/redhat-release.

So, we did a bit of changes to recognize both of
returned values.

This patch fixes the problem.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 testcases/commands/mail/mail_tests.sh |   65 ++++++++++++++++-----------------
 1 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/testcases/commands/mail/mail_tests.sh b/testcases/commands/mail/mail_tests.sh
index 45bac93..024120f 100755
--- a/testcases/commands/mail/mail_tests.sh
+++ b/testcases/commands/mail/mail_tests.sh
@@ -172,28 +172,27 @@ else
     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)
-    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
-        $LTPTMP/tst_mail.res)
-#####
-# Some mailers (e.g., Red Hat's sendmail) print different messages 
-#####
-if [ -f /etc/redhat-release ] 
-then 
-  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
+##################################################################
+# In this testcase, mail will get "Returnedmail:", while mailx will
+# get "UndeliveredMailReturned:".
+# Either of mail and mailx may be linked to another.
+# For example,
+# /bin/mail -> /bin/mailx
+# or
+# /bin/mailx -> /bin/mail
+##################################################################
      RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
              $LTPTMP/tst_mail.res)
-else 
-  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
-     RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
+     RC3=$(awk '/^>N/ {print match($9 $10, "UndeliveredMail")}' \
              $LTPTMP/tst_mail.res)
 fi 
-    if [ -z "$RC1" -a -z "$RC2" ]
+    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
     then
         $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
         "Test #2: No new mail for root. Reason:"
         TFAILCNT=$(( $TFAILCNT+1 ))
     else
-        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
+        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
         then
             $LTPBIN/tst_resm TPASS \
                 "Test #2: Mailer-Deamon reported delivery failure"
@@ -203,7 +202,6 @@ fi
             TFAILCNT=$(( $TFAILCNT+1 ))
         fi
     fi
-fi
 else
     $LTPBIN/tst_resm TCONF "mail command not installed"
 fi    
@@ -242,29 +240,28 @@ else
     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)
-    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
-        $LTPTMP/tst_mail.res)
-#####
-# Some mailers (e.g., Red Hat's sendmail) print different messages 
-#####
-if [ -f /etc/redhat-release ] 
-then 
-   [ -z "$RC2" -o "X$RC2" = "X0" ] && \
-      RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
-              $LTPTMP/tst_mail.res)
-else 
-    [ -z "$RC2" -o "X$RC2" = "X0" ] && \
-        RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
-                $LTPTMP/tst_mail.res)
-fi 
-    if [ -z "$RC1" -a -z "$RC2" ]
+##################################################################
+# In this testcase, mail will get "Returnedmail:", while mailx will
+# get "UndeliveredMailReturned:".
+# Either of mail and mailx may be linked to another.
+# For example,
+# /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)
+fi
+    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
     then
         $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
-        "Test #3: No new mail for root. Reason:"
+        "Test #2: No new mail for root. Reason:"
         TFAILCNT=$(( $TFAILCNT+1 ))
     else
-        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
-        then
+        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
+	then
             $LTPBIN/tst_resm TPASS \
                 "Test #3: Mailer-Deamon reported delivery failure"
         else
@@ -273,7 +270,7 @@ fi
             TFAILCNT=$(( $TFAILCNT+1 ))
         fi
     fi
-fi
+
 else
     $LTPBIN/tst_resm TCONF "mail command not installed"
 fi
-- 
1.6.2.2




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] mail: fix the bug of mail01
  2009-11-16  8:55 liubo
@ 2009-11-16 13:39 ` Subrata Modak
  0 siblings, 0 replies; 6+ messages in thread
From: Subrata Modak @ 2009-11-16 13:39 UTC (permalink / raw)
  To: liubo; +Cc: ltp-list

On Mon, 2009-11-16 at 16:55 +0800, liubo wrote: 
> In the testcase "mail01",
> 
> when mail is send to nosuchuser@domain
> and mail is send to user@nosuchdomain,
> mail program may return either "Returnedmail:"
> or "UndeliveredMailReturned", regardless of
> the existence of /etc/redhat-release.
> 
> So, we did a bit of changes to recognize both of
> returned values.
> 
> This patch fixes the problem.
> 
> Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>

Thanks. Done.

Regards--
Subrata

> ---
>  testcases/commands/mail/mail_tests.sh |   65 ++++++++++++++++-----------------
>  1 files changed, 31 insertions(+), 34 deletions(-)
> 
> diff --git a/testcases/commands/mail/mail_tests.sh b/testcases/commands/mail/mail_tests.sh
> index 45bac93..024120f 100755
> --- a/testcases/commands/mail/mail_tests.sh
> +++ b/testcases/commands/mail/mail_tests.sh
> @@ -172,28 +172,27 @@ else
>      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)
> -    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
> -        $LTPTMP/tst_mail.res)
> -#####
> -# Some mailers (e.g., Red Hat's sendmail) print different messages 
> -#####
> -if [ -f /etc/redhat-release ] 
> -then 
> -  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> +##################################################################
> +# In this testcase, mail will get "Returnedmail:", while mailx will
> +# get "UndeliveredMailReturned:".
> +# Either of mail and mailx may be linked to another.
> +# For example,
> +# /bin/mail -> /bin/mailx
> +# or
> +# /bin/mailx -> /bin/mail
> +##################################################################
>       RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
>               $LTPTMP/tst_mail.res)
> -else 
> -  [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> -     RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
> +     RC3=$(awk '/^>N/ {print match($9 $10, "UndeliveredMail")}' \
>               $LTPTMP/tst_mail.res)
>  fi 
> -    if [ -z "$RC1" -a -z "$RC2" ]
> +    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
>      then
>          $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
>          "Test #2: No new mail for root. Reason:"
>          TFAILCNT=$(( $TFAILCNT+1 ))
>      else
> -        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
> +        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
>          then
>              $LTPBIN/tst_resm TPASS \
>                  "Test #2: Mailer-Deamon reported delivery failure"
> @@ -203,7 +202,6 @@ fi
>              TFAILCNT=$(( $TFAILCNT+1 ))
>          fi
>      fi
> -fi
>  else
>      $LTPBIN/tst_resm TCONF "mail command not installed"
>  fi    
> @@ -242,29 +240,28 @@ else
>      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)
> -    RC2=$(awk '/^>N/ {print match($9 $10 $11, "Maildeliveryfailed:")}' \
> -        $LTPTMP/tst_mail.res)
> -#####
> -# Some mailers (e.g., Red Hat's sendmail) print different messages 
> -#####
> -if [ -f /etc/redhat-release ] 
> -then 
> -   [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> -      RC2=$(awk '/^>N/ {print match($9 $10, "Returnedmail:")}' \
> -              $LTPTMP/tst_mail.res)
> -else 
> -    [ -z "$RC2" -o "X$RC2" = "X0" ] && \
> -        RC2=$(awk '/^>N/ {print match($9 $10 $11, "UndeliveredMailReturned")}' \
> -                $LTPTMP/tst_mail.res)
> -fi 
> -    if [ -z "$RC1" -a -z "$RC2" ]
> +##################################################################
> +# In this testcase, mail will get "Returnedmail:", while mailx will
> +# get "UndeliveredMailReturned:".
> +# Either of mail and mailx may be linked to another.
> +# For example,
> +# /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)
> +fi
> +    if [ -z "$RC1" -a -z "$RC2" -a -z "$RC3" ]
>      then
>          $LTPBIN/tst_res TFAIL $LTPTMP/tst_mail.res \
> -        "Test #3: No new mail for root. Reason:"
> +        "Test #2: No new mail for root. Reason:"
>          TFAILCNT=$(( $TFAILCNT+1 ))
>      else
> -        if [ $RC1 -ne 0 -a $RC2 -ne 0 ]
> -        then
> +        if [ $RC1 -ne 0 -a $RC2 -ne 0 ] || [ $RC1 -ne 0 -a $RC3 -ne 0 ]
> +	then
>              $LTPBIN/tst_resm TPASS \
>                  "Test #3: Mailer-Deamon reported delivery failure"
>          else
> @@ -273,7 +270,7 @@ fi
>              TFAILCNT=$(( $TFAILCNT+1 ))
>          fi
>      fi
> -fi
> +
>  else
>      $LTPBIN/tst_resm TCONF "mail command not installed"
>  fi


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-11-16 13:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04  8:14 [LTP] [PATCH] mail: fix the bug of mail01 liubo
2009-11-13  1:07 ` liubo
2009-11-16  8:13   ` Subrata Modak
2009-11-16  8:53     ` liubo
  -- strict thread matches above, loose matches on Subject: below --
2009-11-16  8:55 liubo
2009-11-16 13:39 ` Subrata Modak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox