diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-03-12 12:04:08 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-03-12 12:04:08 +0200 |
commit | 02c6a0ad553ad51f91af9d9e6c28f2529e759305 (patch) | |
tree | 1aa932d4f8e938c570460c8fc414ff48309cc706 | |
parent | 7c10eca883faa5dd5b01bf1e50b04abb792a6639 (diff) | |
download | wydawca-02c6a0ad553ad51f91af9d9e6c28f2529e759305.tar.gz wydawca-02c6a0ad553ad51f91af9d9e6c28f2529e759305.tar.bz2 |
Enable notification tests conditionally.
The tests are enabled only if the mailutils module is built.
* configure.ac (WD_MAILUTILS): New subst variable.
* tests/atlocal.in (WD_MAILUTILS): New variable.
* tests/testsuite.at (AT_MAILUTILS_PREREQ): New macro.
* tests/check-notify.at: Skip the test if mailutils is not configured.
* tests/mailstats.at: Likewise.
* tests/notify-upl.at: Likewise.
* modules/mailutils/mod_mailutils.c (get_uploader_email): Simplify
the signature.
(expand_email_admin,expand_email_owner): Make static.
* src/wydawca.h (expand_email_admin,expand_email_owner): Remove protos.
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | modules/mailutils/mod_mailutils.c | 11 | ||||
-rw-r--r-- | src/wydawca.h | 2 | ||||
-rw-r--r-- | tests/atlocal.in | 1 | ||||
-rw-r--r-- | tests/check-notify.at | 1 | ||||
-rw-r--r-- | tests/mailstats.at | 1 | ||||
-rw-r--r-- | tests/notify-upl.at | 1 | ||||
-rw-r--r-- | tests/testsuite.at | 2 |
8 files changed, 12 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac index e165dea..94f6daf 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -70,6 +70,7 @@ AC_CHECK_FUNCS([fchdir memset strchr strdup strerror strrchr setegid setregid\ | |||
70 | 70 | ||
71 | AM_GNU_MAILUTILS(2.0, [mailer], [status_mailutils=yes], [status_mailutils=no]) | 71 | AM_GNU_MAILUTILS(2.0, [mailer], [status_mailutils=yes], [status_mailutils=no]) |
72 | AM_CONDITIONAL([COND_MAILUTILS],[test $status_mailutils = yes]) | 72 | AM_CONDITIONAL([COND_MAILUTILS],[test $status_mailutils = yes]) |
73 | AC_SUBST(WD_MAILUTILS,[$status_mailutils]) | ||
73 | 74 | ||
74 | # ********************** | 75 | # ********************** |
75 | # MySQL | 76 | # MySQL |
diff --git a/modules/mailutils/mod_mailutils.c b/modules/mailutils/mod_mailutils.c index 2265a76..1df460a 100644 --- a/modules/mailutils/mod_mailutils.c +++ b/modules/mailutils/mod_mailutils.c | |||
@@ -626,10 +626,9 @@ mod_mailutils_LTX_flush() | |||
626 | } | 626 | } |
627 | 627 | ||
628 | static mu_address_t | 628 | static mu_address_t |
629 | get_uploader_email(struct uploader_info const *info, | 629 | get_uploader_email(struct file_triplet const *trp, const char **errp) |
630 | struct file_triplet const *trp, | ||
631 | const char **errp) | ||
632 | { | 630 | { |
631 | struct uploader_info const *info = trp->uploader; | ||
633 | mu_address_t addr; | 632 | mu_address_t addr; |
634 | mu_address_t rcpt = NULL; | 633 | mu_address_t rcpt = NULL; |
635 | int rc; | 634 | int rc; |
@@ -709,7 +708,7 @@ get_recipient(struct dictionary *dict, struct file_triplet const *trp, | |||
709 | return rcpt; | 708 | return rcpt; |
710 | } | 709 | } |
711 | 710 | ||
712 | const char * | 711 | static const char * |
713 | expand_email_admin(struct metadef *def, void *data) | 712 | expand_email_admin(struct metadef *def, void *data) |
714 | { | 713 | { |
715 | if (mu_address_aget_printable(admin_address, &def->storage) == 0) | 714 | if (mu_address_aget_printable(admin_address, &def->storage) == 0) |
@@ -719,7 +718,7 @@ expand_email_admin(struct metadef *def, void *data) | |||
719 | return def->value; | 718 | return def->value; |
720 | } | 719 | } |
721 | 720 | ||
722 | const char * | 721 | static const char * |
723 | expand_email_owner(struct metadef *def, void *data) | 722 | expand_email_owner(struct metadef *def, void *data) |
724 | { | 723 | { |
725 | struct file_triplet *trp = data; | 724 | struct file_triplet *trp = data; |
@@ -765,7 +764,7 @@ t_notify(struct mailevt *evt, int ev, struct file_triplet const *trp) | |||
765 | break; | 764 | break; |
766 | 765 | ||
767 | case notify_user: | 766 | case notify_user: |
768 | rcpt = get_uploader_email(trp->uploader, trp, &errp); | 767 | rcpt = get_uploader_email(trp, &errp); |
769 | break; | 768 | break; |
770 | 769 | ||
771 | case notify_owner: | 770 | case notify_owner: |
diff --git a/src/wydawca.h b/src/wydawca.h index 08126ac..1948e75 100644 --- a/src/wydawca.h +++ b/src/wydawca.h | |||
@@ -318,8 +318,6 @@ char *meta_expand_string(const char *string, struct metadef *def, void *data, | |||
318 | void meta_free(struct metadef *def); | 318 | void meta_free(struct metadef *def); |
319 | struct metadef *metadef_join(struct metadef *a, struct metadef *b); | 319 | struct metadef *metadef_join(struct metadef *a, struct metadef *b); |
320 | 320 | ||
321 | const char *expand_email_admin(struct metadef *def, void *data); | ||
322 | const char *expand_email_owner(struct metadef *def, void *data); | ||
323 | 321 | ||
324 | /* Modules */ | 322 | /* Modules */ |
325 | 323 | ||
diff --git a/tests/atlocal.in b/tests/atlocal.in index 89cfd3f..2f01c30 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in | |||
@@ -12,6 +12,7 @@ WD_CONFSRC=@abs_top_srcdir@/tests/etc | |||
12 | WD_DISTDIR=@abs_top_srcdir@/tests/dist | 12 | WD_DISTDIR=@abs_top_srcdir@/tests/dist |
13 | WD_SRC=@abs_top_builddir@/tests/source | 13 | WD_SRC=@abs_top_builddir@/tests/source |
14 | WD_DST=@abs_top_builddir@/tests/dest | 14 | WD_DST=@abs_top_builddir@/tests/dest |
15 | WD_MAILUTILS=@WD_MAILUTILS@ | ||
15 | MKDIR_P="@MKDIR_P@" | 16 | MKDIR_P="@MKDIR_P@" |
16 | 17 | ||
17 | wydawca_init_testdirs() { | 18 | wydawca_init_testdirs() { |
diff --git a/tests/check-notify.at b/tests/check-notify.at index bebfa4b..d31e1b9 100644 --- a/tests/check-notify.at +++ b/tests/check-notify.at | |||
@@ -68,6 +68,7 @@ The Project Submission Robot | |||
68 | ]) | 68 | ]) |
69 | 69 | ||
70 | AT_CHECK([ | 70 | AT_CHECK([ |
71 | AT_MAILUTILS_PREREQ | ||
71 | wydawca_init_testdirs | 72 | wydawca_init_testdirs |
72 | wydawca_config wydawca.rc | 73 | wydawca_config wydawca.rc |
73 | mv wydawca.rc simple.rc | 74 | mv wydawca.rc simple.rc |
diff --git a/tests/mailstats.at b/tests/mailstats.at index e5c769d..a7a9bae 100644 --- a/tests/mailstats.at +++ b/tests/mailstats.at | |||
@@ -67,6 +67,7 @@ Wydawca | |||
67 | ]) | 67 | ]) |
68 | 68 | ||
69 | AT_CHECK([ | 69 | AT_CHECK([ |
70 | AT_MAILUTILS_PREREQ | ||
70 | wydawca_init_testdirs | 71 | wydawca_init_testdirs |
71 | wydawca_config wydawca.rc | 72 | wydawca_config wydawca.rc |
72 | wydawca_config mailstats.rc | 73 | wydawca_config mailstats.rc |
diff --git a/tests/notify-upl.at b/tests/notify-upl.at index b6425ba..60574a9 100644 --- a/tests/notify-upl.at +++ b/tests/notify-upl.at | |||
@@ -79,6 +79,7 @@ s,^-[[rwx-]]\{9\} @USER@.*file.sig$,listing of file.sig, | |||
79 | ]) | 79 | ]) |
80 | 80 | ||
81 | AT_CHECK([ | 81 | AT_CHECK([ |
82 | AT_MAILUTILS_PREREQ | ||
82 | wydawca_init_testdirs | 83 | wydawca_init_testdirs |
83 | wydawca_config wydawca.rc | 84 | wydawca_config wydawca.rc |
84 | mv wydawca.rc simple.rc | 85 | mv wydawca.rc simple.rc |
diff --git a/tests/testsuite.at b/tests/testsuite.at index d0195e3..16e5a41 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at | |||
@@ -23,6 +23,8 @@ m4_define([AT_SORT_PREREQ],[ | |||
23 | test -z "`sort < /dev/null 2>&1`" || AT_SKIP_TEST | 23 | test -z "`sort < /dev/null 2>&1`" || AT_SKIP_TEST |
24 | ]) | 24 | ]) |
25 | 25 | ||
26 | m4_define([AT_MAILUTILS_PREREQ],[test "$WD_MAILUTILS" = yes || AT_SKIP_TEST]) | ||
27 | |||
26 | AT_INIT | 28 | AT_INIT |
27 | AT_TESTED([wydawca]) | 29 | AT_TESTED([wydawca]) |
28 | m4_include([version.at]) | 30 | m4_include([version.at]) |