* [LTP] fix mail_tests for systems without mail installed
@ 2009-08-12 21:14 Paul Larson
2009-08-13 7:04 ` Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: Paul Larson @ 2009-08-12 21:14 UTC (permalink / raw)
To: LTP Mailing List
[-- Attachment #1: Type: text/plain, Size: 135 bytes --]
mail_tests should return tconf instead of tfail if mail is not installed.
Signed-off-by: Paul Larson <paul.larson@canonical.com>
---
[-- Attachment #2: mail_tests.patch --]
[-- Type: text/x-patch, Size: 2954 bytes --]
diff --git a/testcases/commands/mail/mail_tests.sh b/testcases/commands/mail/mail_tests.sh
index 7458944..a2c6487 100755
--- a/testcases/commands/mail/mail_tests.sh
+++ b/testcases/commands/mail/mail_tests.sh
@@ -59,6 +59,11 @@ RC=0
export TCID=SETUP
export TST_COUNT=1
+`which mail`
+if [ $? != 0 ]; then
+ MAIL_NOT_INSTALLED=1
+fi
+
# check if the user mail_test exists on this system.
# if not add that user mail_test, will removed before exiting test.
RC=$(awk '/^mail_test/ {print 1}' /etc/passwd)
@@ -97,6 +102,7 @@ $LTPBIN/tst_resm TINFO "Test #1: mail root@localhost will send mail to root"
$LTPBIN/tst_resm TINFO "Test #1: user on local machine."
+if [ -z $MAIL_NOT_INSTALLED ]; then
cat > $LTPTMP/tst_mail.in <<EOF
This is a test email.
EOF
@@ -125,6 +131,9 @@ else
TFAILCNT=$(( $TFAILCNT+1 ))
fi
fi
+else
+ $LTPBIN/tst_resm TCONF "mail command not installed"
+fi
# Test #2
@@ -142,6 +151,7 @@ $LTPBIN/tst_resm TINFO \
$LTPBIN/tst_resm TINFO "Test #2: to deliver the mail. Mailer daemon should"
$LTPBIN/tst_resm TINFO "Test #2: report this failure."
+if [ -z $MAIL_NOT_INSTALLED ]; then
cat > $LTPTMP/tst_mail.in <<EOF
This is a test email.
EOF
@@ -193,7 +203,9 @@ fi
fi
fi
fi
-
+else
+ $LTPBIN/tst_resm TCONF "mail command not installed"
+fi
# Test #3
# Test that mail non_existant_user@localhost will result in delivery failure.
@@ -210,6 +222,7 @@ $LTPBIN/tst_resm TINFO \
$LTPBIN/tst_resm TINFO "Test #3: to deliver the mail. Mailer daemon should"
$LTPBIN/tst_resm TINFO "Test #3: report this failure."
+if [ -z $MAIL_NOT_INSTALLED ]; then
cat > $LTPTMP/tst_mail.in <<EOF
This is a test email.
EOF
@@ -260,6 +273,9 @@ fi
fi
fi
fi
+else
+ $LTPBIN/tst_resm TCONF "mail command not installed"
+fi
# Test #4
# Test that mail -c user@domain option will carbon copy that user.
@@ -270,6 +286,7 @@ RC=0
$LTPBIN/tst_resm TINFO "Test #4: Test that mail -c user@domain will"
$LTPBIN/tst_resm TINFO "Test #4: carbon copy user@domain"
+if [ -z $MAIL_NOT_INSTALLED ]; then
# send mail to root and carbon copy mail_test
mail -s "Test" root@localhost -c mail_test@localhost < \
@@ -297,7 +314,9 @@ else
TFAILCNT=$(( $TFAILCNT+1 ))
fi
fi
-
+else
+ $LTPBIN/tst_resm TCONF "mail command not installed"
+fi
# Test #5
# Test that mail -b user@domain option will blind carbon copy that user.
@@ -308,6 +327,7 @@ RC=0
$LTPBIN/tst_resm TINFO "Test #5: Test that mail -b user@domain will"
$LTPBIN/tst_resm TINFO "Test #5: blind carbon copy user@domain"
+if [ -z $MAIL_NOT_INSTALLED ]; then
# send mail to root and carbon copy mail_test
mail -s "Test" root@localhost -c mail_test@localhost < \
@@ -335,7 +355,9 @@ else
TFAILCNT=$(( $TFAILCNT+1 ))
fi
fi
-
+else
+ $LTPBIN/tst_resm TCONF "mail command not installed"
+fi
#CLEANUP & EXIT
# remove all the temporary files created by this test.
[-- Attachment #3: Type: text/plain, Size: 355 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 #4: 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 related [flat|nested] 6+ messages in thread
* Re: [LTP] fix mail_tests for systems without mail installed
2009-08-12 21:14 Paul Larson
@ 2009-08-13 7:04 ` Mike Frysinger
2009-08-27 12:19 ` Geert Uytterhoeven
0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2009-08-13 7:04 UTC (permalink / raw)
To: ltp-list
[-- Attachment #1.1: Type: text/plain, Size: 484 bytes --]
On Wednesday 12 August 2009 17:14:09 Paul Larson wrote:
> +`which mail`
> +if [ $? != 0 ]; then
this results in pretty ugly output, and the return value/output of `which` is
not portable. use the type builtin instead.
> + MAIL_NOT_INSTALLED=1
you should make sure this is always set/unset at the top of the script so
parent environment poisoning wont screw things up.
> +if [ -z $MAIL_NOT_INSTALLED ]; then
tests must always be quoted:
[ -z "$foo" ]
-mike
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 355 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] fix mail_tests for systems without mail installed
@ 2009-08-19 18:20 Paul Larson
2009-08-23 7:28 ` Subrata Modak
0 siblings, 1 reply; 6+ messages in thread
From: Paul Larson @ 2009-08-19 18:20 UTC (permalink / raw)
To: LTP Mailing List
[-- Attachment #1: Type: text/plain, Size: 134 bytes --]
mail_tests should return tconf instead of tfail if mail is not installed.
Signed-off-by: Paul Larson <paul.larson@canonical.com>
---
[-- Attachment #2: mail_tests-2.patch --]
[-- Type: text/x-patch, Size: 2990 bytes --]
diff --git a/testcases/commands/mail/mail_tests.sh b/testcases/commands/mail/mail_tests.sh
index 7458944..0959a0c 100755
--- a/testcases/commands/mail/mail_tests.sh
+++ b/testcases/commands/mail/mail_tests.sh
@@ -59,6 +59,12 @@ RC=0
export TCID=SETUP
export TST_COUNT=1
+MAIL_NOT_INSTALLED=0
+`type mail &> /dev/null`
+if [ $? != 0 ]; then
+ MAIL_NOT_INSTALLED=1
+fi
+
# check if the user mail_test exists on this system.
# if not add that user mail_test, will removed before exiting test.
RC=$(awk '/^mail_test/ {print 1}' /etc/passwd)
@@ -97,6 +103,7 @@ $LTPBIN/tst_resm TINFO "Test #1: mail root@localhost will send mail to root"
$LTPBIN/tst_resm TINFO "Test #1: user on local machine."
+if [ -z "$MAIL_NOT_INSTALLED" ]; then
cat > $LTPTMP/tst_mail.in <<EOF
This is a test email.
EOF
@@ -125,6 +132,9 @@ else
TFAILCNT=$(( $TFAILCNT+1 ))
fi
fi
+else
+ $LTPBIN/tst_resm TCONF "mail command not installed"
+fi
# Test #2
@@ -142,6 +152,7 @@ $LTPBIN/tst_resm TINFO \
$LTPBIN/tst_resm TINFO "Test #2: to deliver the mail. Mailer daemon should"
$LTPBIN/tst_resm TINFO "Test #2: report this failure."
+if [ -z $MAIL_NOT_INSTALLED ]; then
cat > $LTPTMP/tst_mail.in <<EOF
This is a test email.
EOF
@@ -193,7 +204,9 @@ fi
fi
fi
fi
-
+else
+ $LTPBIN/tst_resm TCONF "mail command not installed"
+fi
# Test #3
# Test that mail non_existant_user@localhost will result in delivery failure.
@@ -210,6 +223,7 @@ $LTPBIN/tst_resm TINFO \
$LTPBIN/tst_resm TINFO "Test #3: to deliver the mail. Mailer daemon should"
$LTPBIN/tst_resm TINFO "Test #3: report this failure."
+if [ -z $MAIL_NOT_INSTALLED ]; then
cat > $LTPTMP/tst_mail.in <<EOF
This is a test email.
EOF
@@ -260,6 +274,9 @@ fi
fi
fi
fi
+else
+ $LTPBIN/tst_resm TCONF "mail command not installed"
+fi
# Test #4
# Test that mail -c user@domain option will carbon copy that user.
@@ -270,6 +287,7 @@ RC=0
$LTPBIN/tst_resm TINFO "Test #4: Test that mail -c user@domain will"
$LTPBIN/tst_resm TINFO "Test #4: carbon copy user@domain"
+if [ -z $MAIL_NOT_INSTALLED ]; then
# send mail to root and carbon copy mail_test
mail -s "Test" root@localhost -c mail_test@localhost < \
@@ -297,7 +315,9 @@ else
TFAILCNT=$(( $TFAILCNT+1 ))
fi
fi
-
+else
+ $LTPBIN/tst_resm TCONF "mail command not installed"
+fi
# Test #5
# Test that mail -b user@domain option will blind carbon copy that user.
@@ -308,6 +328,7 @@ RC=0
$LTPBIN/tst_resm TINFO "Test #5: Test that mail -b user@domain will"
$LTPBIN/tst_resm TINFO "Test #5: blind carbon copy user@domain"
+if [ -z $MAIL_NOT_INSTALLED ]; then
# send mail to root and carbon copy mail_test
mail -s "Test" root@localhost -c mail_test@localhost < \
@@ -335,7 +356,9 @@ else
TFAILCNT=$(( $TFAILCNT+1 ))
fi
fi
-
+else
+ $LTPBIN/tst_resm TCONF "mail command not installed"
+fi
#CLEANUP & EXIT
# remove all the temporary files created by this test.
[-- Attachment #3: Type: text/plain, Size: 355 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 #4: 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 related [flat|nested] 6+ messages in thread
* Re: [LTP] fix mail_tests for systems without mail installed
2009-08-19 18:20 [LTP] fix mail_tests for systems without mail installed Paul Larson
@ 2009-08-23 7:28 ` Subrata Modak
0 siblings, 0 replies; 6+ messages in thread
From: Subrata Modak @ 2009-08-23 7:28 UTC (permalink / raw)
To: Paul Larson; +Cc: LTP Mailing List
On Wed, 2009-08-19 at 13:20 -0500, Paul Larson wrote:
> mail_tests should return tconf instead of tfail if mail is not installed.
>
> Signed-off-by: Paul Larson <paul.larson@canonical.com>
Thanks Paul.
Regards--
Subrata
> ---
> ------------------------------------------------------------------------------
> 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
------------------------------------------------------------------------------
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] fix mail_tests for systems without mail installed
2009-08-13 7:04 ` Mike Frysinger
@ 2009-08-27 12:19 ` Geert Uytterhoeven
2009-08-28 6:09 ` Subrata Modak
0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2009-08-27 12:19 UTC (permalink / raw)
To: Mike Frysinger, Paul Larson; +Cc: Linux Test Project
On Thu, 13 Aug 2009, Mike Frysinger wrote:
> On Wednesday 12 August 2009 17:14:09 Paul Larson wrote:
> > +`which mail`
> > +if [ $? != 0 ]; then
>
> this results in pretty ugly output, and the return value/output of `which` is
> not portable. use the type builtin instead.
>
> > + MAIL_NOT_INSTALLED=1
>
> you should make sure this is always set/unset at the top of the script so
> parent environment poisoning wont screw things up.
>
> > +if [ -z $MAIL_NOT_INSTALLED ]; then
>
> tests must always be quoted:
> [ -z "$foo" ]
Worse, as $MAIL_NOT_INSTALLED is always "0" or "1", -z always return false...
From 8035091c4232e8d6c7b3a75d612bc82c1ad84365 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Date: Thu, 27 Aug 2009 14:11:58 +0200
Subject: [PATCH] Fix mail_tests for systems with mail installed
`-z' tests for a string length of zero, not for a zero value, causing the
test always to return false.
Initialize $MAIL_NOT_INSTALLED to an empty string instead of a numerical
zero to fix this.
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
---
testcases/commands/mail/mail_tests.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/testcases/commands/mail/mail_tests.sh b/testcases/commands/mail/mail_tests.sh
index 0959a0c..45bac93 100755
--- a/testcases/commands/mail/mail_tests.sh
+++ b/testcases/commands/mail/mail_tests.sh
@@ -59,7 +59,7 @@ RC=0
export TCID=SETUP
export TST_COUNT=1
-MAIL_NOT_INSTALLED=0
+MAIL_NOT_INSTALLED=
`type mail &> /dev/null`
if [ $? != 0 ]; then
MAIL_NOT_INSTALLED=1
--
1.6.2.4
With kind regards,
Geert Uytterhoeven
Software Architect
Techsoft Centre
Technology and Software Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/
A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010
------------------------------------------------------------------------------
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] fix mail_tests for systems without mail installed
2009-08-27 12:19 ` Geert Uytterhoeven
@ 2009-08-28 6:09 ` Subrata Modak
0 siblings, 0 replies; 6+ messages in thread
From: Subrata Modak @ 2009-08-28 6:09 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Linux Test Project, Mike Frysinger
On Thu, 2009-08-27 at 14:19 +0200, Geert Uytterhoeven wrote:
> On Thu, 13 Aug 2009, Mike Frysinger wrote:
> > On Wednesday 12 August 2009 17:14:09 Paul Larson wrote:
> > > +`which mail`
> > > +if [ $? != 0 ]; then
> >
> > this results in pretty ugly output, and the return value/output of `which` is
> > not portable. use the type builtin instead.
> >
> > > + MAIL_NOT_INSTALLED=1
> >
> > you should make sure this is always set/unset at the top of the script so
> > parent environment poisoning wont screw things up.
> >
> > > +if [ -z $MAIL_NOT_INSTALLED ]; then
> >
> > tests must always be quoted:
> > [ -z "$foo" ]
>
> Worse, as $MAIL_NOT_INSTALLED is always "0" or "1", -z always return false...
>
> From 8035091c4232e8d6c7b3a75d612bc82c1ad84365 Mon Sep 17 00:00:00 2001
> From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
> Date: Thu, 27 Aug 2009 14:11:58 +0200
> Subject: [PATCH] Fix mail_tests for systems with mail installed
>
> `-z' tests for a string length of zero, not for a zero value, causing the
> test always to return false.
> Initialize $MAIL_NOT_INSTALLED to an empty string instead of a numerical
> zero to fix this.
>
> Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Ok. Thanks.
Regards--
Subrata
> ---
> testcases/commands/mail/mail_tests.sh | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/testcases/commands/mail/mail_tests.sh b/testcases/commands/mail/mail_tests.sh
> index 0959a0c..45bac93 100755
> --- a/testcases/commands/mail/mail_tests.sh
> +++ b/testcases/commands/mail/mail_tests.sh
> @@ -59,7 +59,7 @@ RC=0
> export TCID=SETUP
> export TST_COUNT=1
>
> -MAIL_NOT_INSTALLED=0
> +MAIL_NOT_INSTALLED=
> `type mail &> /dev/null`
> if [ $? != 0 ]; then
> MAIL_NOT_INSTALLED=1
------------------------------------------------------------------------------
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-08-28 6:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-19 18:20 [LTP] fix mail_tests for systems without mail installed Paul Larson
2009-08-23 7:28 ` Subrata Modak
-- strict thread matches above, loose matches on Subject: below --
2009-08-12 21:14 Paul Larson
2009-08-13 7:04 ` Mike Frysinger
2009-08-27 12:19 ` Geert Uytterhoeven
2009-08-28 6:09 ` Subrata Modak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox