summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-07-20 09:45:08 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-07-20 09:50:57 +0300
commit5c69f2148d7aee85140403fa9346ffaf9532a3fe (patch)
tree499cff0775f305a771cbe508a394441af1b6115a
parent5f89d649de52c5318ffbd147b6fff74001ef1356 (diff)
downloadmailutils-5c69f2148d7aee85140403fa9346ffaf9532a3fe.tar.gz
mailutils-5c69f2148d7aee85140403fa9346ffaf9532a3fe.tar.bz2
Provide tests for auxiliary test utilities
* configure.ac: Initialize testsuite in libproto/mbox * libproto/mbox/Makefile.am (SUBDIRS): Declare. * libproto/mbox/tests/Makefile.am: New file. * libproto/mbox/tests/atlocal.in: New file. * libproto/mbox/tests/testsuite.at: New file. * testsuite/ufms.at: Rename to libproto/mbox/tests/ufms.at * testsuite/ufms.c: Rename to libproto/mbox/tests/ufms.c * testsuite/.gitignore: Update. * testsuite/mockmail.at: New file. * testsuite/mockmail.c (main): Fix the state machine. * testsuite/mockmta.at: New file. * testsuite/mockmta.c: Fix typo in the comment. * testsuite/testsuite.at: Add new tests * testsuite/Makefile.am: Add new tests
-rw-r--r--configure.ac1
-rw-r--r--libmailutils/tests/.gitignore1
-rw-r--r--libproto/mbox/Makefile.am1
-rw-r--r--libproto/mbox/tests/Makefile.am23
-rw-r--r--libproto/mbox/tests/atlocal.in5
-rw-r--r--libproto/mbox/tests/testsuite.at18
-rw-r--r--libproto/mbox/tests/ufms.at (renamed from testsuite/ufms.at)0
-rw-r--r--libproto/mbox/tests/ufms.c (renamed from testsuite/ufms.c)0
-rw-r--r--testsuite/.gitignore1
-rw-r--r--testsuite/Makefile.am6
-rw-r--r--testsuite/mockmail.at110
-rw-r--r--testsuite/mockmail.c2
-rw-r--r--testsuite/mockmta.at69
-rw-r--r--testsuite/mockmta.c2
-rw-r--r--testsuite/testsuite.at8
15 files changed, 239 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 117c888a9..b58610f5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1374,6 +1374,7 @@ MU_CONFIG_TESTSUITE(comsat)
MU_CONFIG_TESTSUITE(imap4d)
MU_CONFIG_TESTSUITE(mimeview)
MU_CONFIG_TESTSUITE(libmu_scm)
+MU_CONFIG_TESTSUITE(libproto/mbox)
MU_CONFIG_TESTSUITE(libproto/mailer)
AM_MISSING_PROG([AUTOM4TE], [autom4te])
diff --git a/libmailutils/tests/.gitignore b/libmailutils/tests/.gitignore
index ede57b50c..990fe0f9f 100644
--- a/libmailutils/tests/.gitignore
+++ b/libmailutils/tests/.gitignore
@@ -27,6 +27,7 @@ logstr
mailcap
mcf
mimehdr
+mimeitr
modmesg
modtofsaf
msgset
diff --git a/libproto/mbox/Makefile.am b/libproto/mbox/Makefile.am
index 97f04e21a..7d50c1634 100644
--- a/libproto/mbox/Makefile.am
+++ b/libproto/mbox/Makefile.am
@@ -25,3 +25,4 @@ libmu_mbox_la_SOURCES = \
mboxscan.c\
mbox0.h
+SUBDIRS = . tests
diff --git a/libproto/mbox/tests/Makefile.am b/libproto/mbox/tests/Makefile.am
new file mode 100644
index 000000000..7d8117085
--- /dev/null
+++ b/libproto/mbox/tests/Makefile.am
@@ -0,0 +1,23 @@
+# This file is part of GNU Mailutils.
+# Copyright (C) 2019-2020 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/>.
+
+include $(top_srcdir)/testsuite/testsuite.am
+
+noinst_PROGRAMS = ufms
+AM_CPPFLAGS = $(MU_LIB_COMMON_INCLUDES)
+LDADD = $(MU_LIB_MBOX) $(MU_LIB_MAILUTILS)
+
+TESTSUITE_AT += ufms.at
diff --git a/libproto/mbox/tests/atlocal.in b/libproto/mbox/tests/atlocal.in
new file mode 100644
index 000000000..882a58f1f
--- /dev/null
+++ b/libproto/mbox/tests/atlocal.in
@@ -0,0 +1,5 @@
+# @configure_input@ -*- shell-script -*-
+# Configurable variable values for Mailutils test suite.
+# Copyright (C) 2004-2020 Free Software Foundation, Inc.
+
+PATH=@abs_builddir@:$top_srcdir:$srcdir:$PATH
diff --git a/libproto/mbox/tests/testsuite.at b/libproto/mbox/tests/testsuite.at
new file mode 100644
index 000000000..be324d799
--- /dev/null
+++ b/libproto/mbox/tests/testsuite.at
@@ -0,0 +1,18 @@
+# GNU Mailutils -- a suite of utilities for electronic mail
+# Copyright (C) 2019-2020 Free Software Foundation, Inc.
+#
+# This library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This library 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
+m4_include([testsuite.inc])
+AT_INIT
+m4_include([ufms.at]) \ No newline at end of file
diff --git a/testsuite/ufms.at b/libproto/mbox/tests/ufms.at
index 76b9bf14c..76b9bf14c 100644
--- a/testsuite/ufms.at
+++ b/libproto/mbox/tests/ufms.at
diff --git a/testsuite/ufms.c b/libproto/mbox/tests/ufms.c
index feeb51422..feeb51422 100644
--- a/testsuite/ufms.c
+++ b/libproto/mbox/tests/ufms.c
diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index 3819f79be..e97cc023f 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -13,4 +13,3 @@ mimetest
mockmail
mockmta
msgset
-ufms
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index 51a3b8c5d..c7b2457a4 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -57,8 +57,7 @@ noinst_PROGRAMS = \
msgset\
mimetest\
mockmail\
- mockmta\
- ufms
+ mockmta
LDADD = \
$(MU_LIB_MAILBOX)\
@@ -83,6 +82,7 @@ TESTSUITE_AT += \
mbdel.at\
mime.at\
mime01.at\
- ufms.at
+ mockmail.at\
+ mockmta.at
diff --git a/testsuite/mockmail.at b/testsuite/mockmail.at
new file mode 100644
index 000000000..4951c1279
--- /dev/null
+++ b/testsuite/mockmail.at
@@ -0,0 +1,110 @@
+# This file is part of GNU Mailutils. -*- Autotest -*-
+# Copyright (C) 2017-2020 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([mockmail])
+
+AT_DATA([msg0],
+[From: gray@example.org
+To: root@example.com
+Subject: mockmail testing
+
+Message text.
+..dot-stuffed line
+Please discard.
+.
+])
+
+AT_DATA([msg],
+[From: gray@example.org
+To: root@example.com
+Subject: mockmail testing
+
+Message text.
+Please discard.
+])
+
+AT_CHECK([mockmail root < msg0
+cat mail.dump
+],
+[0],
+[[MSGID: 0001
+NRCPT: 1
+RCPT[0]: root
+LENGTH: 119
+From: gray@example.org
+To: root@example.com
+Subject: mockmail testing
+
+Message text.
+.dot-stuffed line
+Please discard.
+
+]])
+
+AT_CHECK([mockmail -oi gray root < msg
+cat mail.dump
+],
+[0],
+[[MSGID: 0001
+NRCPT: 2
+RCPT[0]: gray
+RCPT[1]: root
+LENGTH: 101
+From: gray@example.org
+To: root@example.com
+Subject: mockmail testing
+
+Message text.
+Please discard.
+
+]])
+
+AT_CHECK([mockmail -oi -f gray@example.com root < msg
+cat mail.dump
+],
+[0],
+[[MSGID: 0001
+SENDER: gray@example.com
+NRCPT: 1
+RCPT[0]: root
+LENGTH: 101
+From: gray@example.org
+To: root@example.com
+Subject: mockmail testing
+
+Message text.
+Please discard.
+
+]])
+
+AT_CHECK([mockmail -oi -t < msg
+cat mail.dump
+],
+[0],
+[[MSGID: 0001
+NRCPT: 1
+RCPT[0]: root@example.com
+LENGTH: 101
+From: gray@example.org
+To: root@example.com
+Subject: mockmail testing
+
+Message text.
+Please discard.
+
+]])
+
+AT_CLEANUP
diff --git a/testsuite/mockmail.c b/testsuite/mockmail.c
index 09cdb2296..9b0c32ed2 100644
--- a/testsuite/mockmail.c
+++ b/testsuite/mockmail.c
@@ -376,6 +376,8 @@ main (int argc, char **argv)
case B_NL:
if (c == '.')
msg.state = B_DOT;
+ else
+ msg.state = B_INIT;
break;
case B_DOT:
diff --git a/testsuite/mockmta.at b/testsuite/mockmta.at
new file mode 100644
index 000000000..84e3e22a1
--- /dev/null
+++ b/testsuite/mockmta.at
@@ -0,0 +1,69 @@
+# This file is part of GNU Mailutils. -*- Autotest -*-
+# Copyright (C) 2017-2020 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([mockmta])
+AT_CHECK([
+nc -h > /dev/null 2>&1
+test $? -eq 1 || AT_SKIP_TEST
+AT_DATA([session],
+[EHLO example.org
+MAIL FROM: <gray@example.org>
+RCPT TO: <root@example.org>
+DATA
+From: gray@example.org
+To: root@example.com
+Subject: mockmta testing
+
+Message text.
+Please discard.
+.
+QUIT
+])
+set - $(mockmta -d mail.dump)
+if test $# -ne 2; then
+ echo >&2 "mockmta failed"
+ exit 1
+fi
+sed -e 's/$/ /' session | nc localhost $1 | tr -d '\r'
+kill $2
+cat mail.dump
+],
+[0],
+[220 Ready
+250-localhost Mock MTA pleased to meet you
+250-PIPELINING
+250 HELP
+250 Sender ok
+250 Recipient ok
+354 Enter mail, end with "." on a line by itself
+250 0001 Message accepted for delivery
+221 Bye
+MSGID: 0001
+DOMAIN: example.org
+SENDER: <gray@example.org>
+NRCPT: 1
+RCPT[[0]]: <root@example.org>
+LENGTH: 102
+From: gray@example.org
+To: root@example.com
+Subject: mockmta testing
+
+Message text.
+Please discard.
+.
+
+])
+AT_CLEANUP
diff --git a/testsuite/mockmta.c b/testsuite/mockmta.c
index 7bc6e38ba..969f99e49 100644
--- a/testsuite/mockmta.c
+++ b/testsuite/mockmta.c
@@ -8,7 +8,7 @@
DESCRIPTION
Starts a mock MTA, which behaves almost identically to the real one,
except that it does not actually inject messages to the mail transport
- sustem. Instead, each accepted message is logged to the DUMPFILE.
+ system. Instead, each accepted message is logged to the DUMPFILE.
Being a mailutils test tool, mockmta is written without relying on
the mailutils libraries. Only libc and, optionally, GnuTLS functions
diff --git a/testsuite/testsuite.at b/testsuite/testsuite.at
index fa9fed5be..ffbdcac30 100644
--- a/testsuite/testsuite.at
+++ b/testsuite/testsuite.at
@@ -18,6 +18,11 @@ m4_include([testsuite.inc])
AT_INIT
+AT_BANNER(Auxiliary tools)
+m4_include([cwdrepl.at])
+m4_include([mockmail.at])
+m4_include([mockmta.at])
+
AT_BANNER(UIDs)
m4_include([lstuid00.at])
m4_include([lstuid01.at])
@@ -33,6 +38,3 @@ m4_include([mbdel.at])
AT_BANNER(Folder mailbox removal)
m4_include([fldel.at])
-AT_BANNER(Various)
-m4_include([ufms.at])
-m4_include([cwdrepl.at])

Return to:

Send suggestions and report system problems to the System administrator.