diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2017-11-11 11:10:49 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2017-11-11 11:10:49 +0200 |
commit | 499992bf3bbf7e7d3e1203563f856f6db229d73c (patch) | |
tree | e34d7f1c16bef5ce978fe40a35f41abea5a3f49f /tests | |
parent | ba1c15e2290246d272037404c46f44abd9d98c0e (diff) | |
download | wydawca-499992bf3bbf7e7d3e1203563f856f6db229d73c.tar.gz wydawca-499992bf3bbf7e7d3e1203563f856f6db229d73c.tar.bz2 |
Fix build with mailutils 3.4
* Makefile.am (ACLOCAL_AMFLAGS): Add am.
* NEWS: Update.
* am/mailutils.m4: New file. A fixed version of upstream mailutils.m4
* configure.ac: Require mailutils 3.3. Raise patchlevel.
* tests/nullmail.c: New file.
* tests/.gitignore: Add nullmail
* tests/Makefile.am: Build nullmail
* tests/etc/nullmail: Remove
* tests/etc/Makefile.am: Remove nullmail script.
* tests/atlocal.in (WY_TESTDIR): New variable.
* tests/check-notify.at: Use new nullmail tool. Update expected
output.
* tests/mailstats.at: Likewise.
* tests/notify-upl.at: Likewise.
* tests/etc/mailstats.rcin: Fix mailer command line.
* tests/etc/notify.rcin: Likewise.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.gitignore | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 6 | ||||
-rw-r--r-- | tests/atlocal.in | 2 | ||||
-rw-r--r-- | tests/check-notify.at | 4 | ||||
-rw-r--r-- | tests/etc/Makefile.am | 1 | ||||
-rw-r--r-- | tests/etc/mailstats.rcin | 2 | ||||
-rw-r--r-- | tests/etc/notify.rcin | 2 | ||||
-rwxr-xr-x | tests/etc/nullmail | 11 | ||||
-rw-r--r-- | tests/mailstats.at | 4 | ||||
-rw-r--r-- | tests/notify-upl.at | 8 | ||||
-rw-r--r-- | tests/nullmail.c | 84 |
11 files changed, 98 insertions, 27 deletions
diff --git a/tests/.gitignore b/tests/.gitignore index 1df6b71..461469e 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -10,3 +10,4 @@ wstest wsbatch pushck bkupname +nullmail diff --git a/tests/Makefile.am b/tests/Makefile.am index 3f7a491..ebd86ff 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -80,7 +80,7 @@ check-local: atconfig atlocal $(TESTSUITE) #installcheck-local: # $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin -check_PROGRAMS = wstest wsbatch pushck bkupname +check_PROGRAMS = wstest wsbatch pushck bkupname AM_CPPFLAGS = \ -I$(top_srcdir)/grecs/src\ -I$(top_srcdir)/include\ @@ -90,3 +90,7 @@ LDADD=@GRECS_LDADD@ pushck_LDADD=../src/pushd.o bkupname_LDADD=../src/backup.o @GRECS_LDADD@ +if COND_MAILUTILS + check_PROGRAMS += nullmail + nullmail_LDADD = @MAILUTILS_LIBS@ +endif diff --git a/tests/atlocal.in b/tests/atlocal.in index af69a75..083c968 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -12,6 +12,7 @@ WY_CONFSRC=@abs_top_srcdir@/tests/etc WY_DISTDIR=@abs_top_srcdir@/tests/dist WY_SRC=@abs_top_builddir@/tests/source WY_DST=@abs_top_builddir@/tests/dest +WY_TESTDIR=@abs_top_builddir@/tests WY_MAILUTILS=@WY_MAILUTILS@ MKDIR_P="@MKDIR_P@" @@ -35,6 +36,7 @@ wydawca_expandmeta() { s,@WY_SRC@,$WY_SRC,g; s,@WY_DST@,$WY_DST,g; s,@WY_CONFSRC@,$WY_CONFSRC,g; + s,@WY_TESTDIR@,$WY_TESTDIR,g; s,@WY_MODDIR@,@abs_top_builddir@/modules/mailutils,g" $1 > $2 } diff --git a/tests/check-notify.at b/tests/check-notify.at index 65aa8b7..fa5cbeb 100644 --- a/tests/check-notify.at +++ b/tests/check-notify.at @@ -43,12 +43,10 @@ wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) fini ]) AT_DATA([outtmpl], -[-F wydawca-noreply@localhost @USER@@localhost -========= +[From wydawca-noreply@localhost From: wydawca-noreply@localhost To: "Wydawca Test User" <@USER@@localhost> Subject: file rejected -X-Mailer: AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) Your upload of file has been rejected by the distribution verification procedure with the following diagnostics: diff --git a/tests/etc/Makefile.am b/tests/etc/Makefile.am index ffb8f99..34d6024 100644 --- a/tests/etc/Makefile.am +++ b/tests/etc/Makefile.am @@ -22,7 +22,6 @@ EXTRA_DIST = \ secring.asc\ wydawca.rcin\ notify.rcin\ - nullmail\ mailstats.rcin GPG_FLAGS = --quiet --no-permission-warning --homedir . diff --git a/tests/etc/mailstats.rcin b/tests/etc/mailstats.rcin index 995cd65..ebe364c 100644 --- a/tests/etc/mailstats.rcin +++ b/tests/etc/mailstats.rcin @@ -20,7 +20,7 @@ module-init mailutils { admin-address "root@localhost"; from-address "wydawca-noreply@localhost"; - mailer "| @WY_CONFSRC@/nullmail @WY_DST@/mail.out -F ${sender} ${rcpt}"; + mailer "| @WY_TESTDIR@/nullmail -o @WY_DST@/mail.out -F ${sender} ${rcpt}"; mail-statistics { statistics all; diff --git a/tests/etc/notify.rcin b/tests/etc/notify.rcin index 3ae3783..b6630b8 100644 --- a/tests/etc/notify.rcin +++ b/tests/etc/notify.rcin @@ -20,7 +20,7 @@ module-init mailutils { admin-address "root@localhost"; from-address "wydawca-noreply@localhost"; - mailer "| @WY_CONFSRC@/nullmail @WY_DST@/mail.out -F ${sender} ${rcpt}"; + mailer "| @WY_TESTDIR@/nullmail -o @WY_DST@/mail.out -F ${sender} ${rcpt}"; } # Notify the user about successful uploads diff --git a/tests/etc/nullmail b/tests/etc/nullmail deleted file mode 100755 index 55220a6..0000000 --- a/tests/etc/nullmail +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/sh - -out=${1:-/dev/null} -shift - -echo $* >> $out -echo "=========" >> $out -cat - >> $out -echo "=========" -echo "" -exit 0
\ No newline at end of file diff --git a/tests/mailstats.at b/tests/mailstats.at index 32fcb0f..c24cb0e 100644 --- a/tests/mailstats.at +++ b/tests/mailstats.at @@ -38,12 +38,10 @@ wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) fini ]) AT_DATA([expout], -[-F wydawca-noreply@localhost root@localhost -========= +[From wydawca-noreply@localhost From: wydawca-noreply@localhost To: root@localhost Subject: Wydawca stats -X-Mailer: AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) This is to notify you that the recent run of wydawca caused the following results: diff --git a/tests/notify-upl.at b/tests/notify-upl.at index 3ace508..7af08e0 100644 --- a/tests/notify-upl.at +++ b/tests/notify-upl.at @@ -39,12 +39,10 @@ wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) fini ]) AT_DATA([outtmpl], -[-F wydawca-noreply@localhost proj-owner@localhost -========= +[From wydawca-noreply@localhost From: wydawca-noreply@localhost To: "Project Admin" <proj-owner@localhost> Subject: Upload of proj successful -X-Mailer: AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) Wydawca Test User (@USER@@localhost) successfully uploaded files for proj to ftp://wydawca.test/proj. Files uploaded: @@ -55,12 +53,10 @@ listing of file.sig Regards, Wydawca The Project Submission Robot --F wydawca-noreply@localhost @USER@@localhost -========= +From wydawca-noreply@localhost From: wydawca-noreply@localhost To: "Wydawca Test User" <@USER@@localhost> Subject: Upload of proj successful -X-Mailer: AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) Upload of proj to ftp://wydawca.test/proj finished successfully. Files uploaded: diff --git a/tests/nullmail.c b/tests/nullmail.c new file mode 100644 index 0000000..4c5bb9d --- /dev/null +++ b/tests/nullmail.c @@ -0,0 +1,84 @@ +#include <mailutils/mailutils.h> + +char const *headers[] = { + MU_HEADER_FROM, + MU_HEADER_TO, + MU_HEADER_SUBJECT, + NULL +}; + +char *output_name; +char *sender_email; + +static struct mu_option nullmail_options[] = { + { "output", 'o', "FILE", MU_OPTION_DEFAULT, + "dump mail to file", + mu_c_string, &output_name }, + { "from", 'F', "EMAIL", MU_OPTION_DEFAULT, + "sender email address", + mu_c_string, &sender_email }, + MU_OPTION_END +}, *options[] = { nullmail_options, NULL }; + +struct mu_cli_setup cli = { + options, + NULL, + "null mailer", + NULL +}; + +char *capa[] = { + "debug", + NULL +}; + +int +main (int argc, char **argv) +{ + int i, rc; + mu_message_t msg; + mu_stream_t input, output, str; + mu_header_t hdr; + mu_body_t body; + + mu_cli (argc, argv, &cli, capa, NULL, &argc, &argv); + /* FIXME: non-option arguments are silently ignored */ + if (output_name) + MU_ASSERT (mu_file_stream_create (&output, output_name, + MU_STREAM_CREAT|MU_STREAM_APPEND)); + else + { + output = mu_strout; + mu_stream_ref (output); + } + + if (sender_email) + mu_stream_printf (output, "From %s\n", sender_email); + + MU_ASSERT (mu_temp_file_stream_create (&input, NULL, 0)); + MU_ASSERT (mu_stream_copy (input, mu_strin, 0, NULL)); + MU_ASSERT (mu_stream_to_message (input, &msg)); + MU_ASSERT (mu_message_get_header (msg, &hdr)); + for (i = 0; headers[i]; i++) + { + char *val; + rc = mu_header_aget_value_unfold (hdr, headers[i], &val); + if (rc == 0) + { + mu_stream_printf (output, "%s: %s\n", headers[i], val); + free (val); + } + else if (rc != MU_ERR_NOENT) + mu_diag_funcall (MU_DIAG_ERROR, "mu_header_get_value_unfold", + headers[i], rc); + } + mu_stream_printf (output, "\n"); + MU_ASSERT (mu_message_get_body (msg, &body)); + MU_ASSERT (mu_body_get_streamref (body, &str)); + MU_ASSERT (mu_stream_copy (output, str, 0, NULL)); + + mu_stream_close (output); + + return 0; +} + |