diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-12-31 00:37:46 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-12-31 00:37:46 +0200 |
commit | 356c07542f39f1ff159e2646bd97e1791f493aad (patch) | |
tree | c98460ada2aacecaa24a5e56d02e2c697faa9c06 /testsuite | |
parent | d4dd5a8a5777be7ba655b87b483659206ea0cf54 (diff) | |
download | mailutils-356c07542f39f1ff159e2646bd97e1791f493aad.tar.gz mailutils-356c07542f39f1ff159e2646bd97e1791f493aad.tar.bz2 |
Add SMTP test.
* examples/mta.c: Handle -bD option. Detach from the controlling
terminal if -bd is given. Print pid and port number in this case.
* testsuite/smtpsend.c: Fix handling of the trace= option.
* testsuite/Makefile.am: Add new tests.
* testsuite/smtp-msg.at: New test case.
* testsuite/smtp-str.at: New test case.
* testsuite/testsuite.at: Include new test cases.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/Makefile.am | 2 | ||||
-rw-r--r-- | testsuite/smtp-msg.at | 61 | ||||
-rw-r--r-- | testsuite/smtp-str.at | 62 | ||||
-rw-r--r-- | testsuite/smtpsend.c | 14 | ||||
-rw-r--r-- | testsuite/testsuite.at | 4 |
5 files changed, 139 insertions, 4 deletions
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index f115a8655..377131d52 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -87,6 +87,8 @@ TESTSUITE_AT = \ lstuid02.at\ mbdel.at\ mime.at\ + smtp-msg.at\ + smtp-str.at\ ufms.at\ testsuite.at diff --git a/testsuite/smtp-msg.at b/testsuite/smtp-msg.at new file mode 100644 index 000000000..5e1a11575 --- /dev/null +++ b/testsuite/smtp-msg.at @@ -0,0 +1,61 @@ +# This file is part of GNU Mailutils. -*- Autotest -*- +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# GNU Mailutils is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3, or (at +# your option) any later version. +# +# GNU Mailutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. + +AT_SETUP([smtp send from message]) +AT_KEYWORDS([smtp-msg]) + +AT_DATA([msg],[dnl +From: mailutils@localhost +To: gray@example.org +Subject: SMTP test + +Omnis enim res, quae dando non deficit, +dum habetur et non datur, nondum habetur, +quomodo habenda est. +]) + +AT_CHECK([ +MTA_DIAG=`pwd`/mta.diag +export MTA_DIAG +p=`$abs_top_builddir/examples/mta -bd` +test $? -eq 0 || AT_SKIP_TEST +set -- $p +# $1 - pid, $2 - port +smtpsend localhost port=$2 \ + from=mailutils@mailutils.org\ + rcpt=gray@example.org\ + domain=mailutils.org\ + input=msg +kill $1 +cat mta.diag +], +[0], +[ENVELOPE FROM: <mailutils@mailutils.org> +ENVELOPE TO: <gray@example.org> + 0: From: mailutils@localhost + 1: To: gray@example.org + 2: Subject: SMTP test + 3: + 4: Omnis enim res, quae dando non deficit, + 5: dum habetur et non datur, nondum habetur, + 6: quomodo habenda est. + 7: +END OF MESSAGE +]) + +AT_CLEANUP + +
\ No newline at end of file diff --git a/testsuite/smtp-str.at b/testsuite/smtp-str.at new file mode 100644 index 000000000..4568e5f46 --- /dev/null +++ b/testsuite/smtp-str.at @@ -0,0 +1,62 @@ +# This file is part of GNU Mailutils. -*- Autotest -*- +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# GNU Mailutils is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3, or (at +# your option) any later version. +# +# GNU Mailutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. + +AT_SETUP([smtp send from stream]) +AT_KEYWORDS([smtp-stream smtp-str]) + +AT_DATA([msg],[dnl +From: mailutils@localhost +To: gray@example.org +Subject: SMTP test + +Omnis enim res, quae dando non deficit, +dum habetur et non datur, nondum habetur, +quomodo habenda est. +]) + +AT_CHECK([ +MTA_DIAG=`pwd`/mta.diag +export MTA_DIAG +p=`$abs_top_builddir/examples/mta -bd` +test $? -eq 0 || AT_SKIP_TEST +set -- $p +# $1 - pid, $2 - port +smtpsend localhost port=$2 \ + from=mailutils@mailutils.org\ + rcpt=gray@example.org\ + domain=mailutils.org\ + raw=1\ + input=msg +kill $1 +cat mta.diag +], +[0], +[ENVELOPE FROM: <mailutils@mailutils.org> +ENVELOPE TO: <gray@example.org> + 0: From: mailutils@localhost + 1: To: gray@example.org + 2: Subject: SMTP test + 3: + 4: Omnis enim res, quae dando non deficit, + 5: dum habetur et non datur, nondum habetur, + 6: quomodo habenda est. + 7: +END OF MESSAGE +]) + +AT_CLEANUP + +
\ No newline at end of file diff --git a/testsuite/smtpsend.c b/testsuite/smtpsend.c index 9dcc4e78c..7e721eac1 100644 --- a/testsuite/smtpsend.c +++ b/testsuite/smtpsend.c @@ -120,10 +120,16 @@ main (int argc, char **argv) if (mu_isdigit (arg[0])) mu_smtp_trace (smtp, atoi (argv[i] + 6) ? MU_SMTP_TRACE_SET : MU_SMTP_TRACE_CLR); - else if (strcmp (arg, "secure") == 0) - mu_smtp_trace_mask (smtp, MU_SMTP_TRACE_SET, MU_XSCRIPT_SECURE); - else if (strcmp (arg, "payload") == 0) - mu_smtp_trace_mask (smtp, MU_SMTP_TRACE_SET, MU_XSCRIPT_PAYLOAD); + else + { + mu_smtp_trace (smtp, MU_SMTP_TRACE_SET); + if (strcmp (arg, "secure") == 0) + mu_smtp_trace_mask (smtp, MU_SMTP_TRACE_SET, + MU_XSCRIPT_SECURE); + else if (strcmp (arg, "payload") == 0) + mu_smtp_trace_mask (smtp, MU_SMTP_TRACE_SET, + MU_XSCRIPT_PAYLOAD); + } } else if (strncmp (argv[i], "tls=", 4) == 0) tls = atoi (argv[i] + 4); diff --git a/testsuite/testsuite.at b/testsuite/testsuite.at index 87f80dc2e..476751dfe 100644 --- a/testsuite/testsuite.at +++ b/testsuite/testsuite.at @@ -32,5 +32,9 @@ m4_include([mbdel.at]) AT_BANNER(Folder mailbox removal) m4_include([fldel.at]) +AT_BANNER(SMTP) +m4_include([smtp-msg.at]) +m4_include([smtp-str.at]) + AT_BANNER(Various) m4_include([ufms.at]) |