From: Paul Larson <paul.larson@canonical.com>
To: LTP Mailing List <ltp-list@lists.sourceforge.net>
Subject: [LTP] fix mail_tests for systems without mail installed
Date: Wed, 19 Aug 2009 13:20:45 -0500 [thread overview]
Message-ID: <4A8C427D.5040203@canonical.com> (raw)
[-- 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
next reply other threads:[~2009-08-19 18:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-19 18:20 Paul Larson [this message]
2009-08-23 7:28 ` [LTP] fix mail_tests for systems without mail installed 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
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=4A8C427D.5040203@canonical.com \
--to=paul.larson@canonical.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