summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2013-03-12 10:04:08 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2013-03-12 10:04:08 (GMT)
commit02c6a0ad553ad51f91af9d9e6c28f2529e759305 (patch) (side-by-side diff)
tree1aa932d4f8e938c570460c8fc414ff48309cc706
parent7c10eca883faa5dd5b01bf1e50b04abb792a6639 (diff)
downloadwydawca-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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--configure.ac1
-rw-r--r--modules/mailutils/mod_mailutils.c11
-rw-r--r--src/wydawca.h2
-rw-r--r--tests/atlocal.in1
-rw-r--r--tests/check-notify.at1
-rw-r--r--tests/mailstats.at1
-rw-r--r--tests/notify-upl.at1
-rw-r--r--tests/testsuite.at2
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\
AM_GNU_MAILUTILS(2.0, [mailer], [status_mailutils=yes], [status_mailutils=no])
AM_CONDITIONAL([COND_MAILUTILS],[test $status_mailutils = yes])
+AC_SUBST(WD_MAILUTILS,[$status_mailutils])
# **********************
# 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()
}
static mu_address_t
-get_uploader_email(struct uploader_info const *info,
- struct file_triplet const *trp,
- const char **errp)
+get_uploader_email(struct file_triplet const *trp, const char **errp)
{
+ struct uploader_info const *info = trp->uploader;
mu_address_t addr;
mu_address_t rcpt = NULL;
int rc;
@@ -709,7 +708,7 @@ get_recipient(struct dictionary *dict, struct file_triplet const *trp,
return rcpt;
}
-const char *
+static const char *
expand_email_admin(struct metadef *def, void *data)
{
if (mu_address_aget_printable(admin_address, &def->storage) == 0)
@@ -719,7 +718,7 @@ expand_email_admin(struct metadef *def, void *data)
return def->value;
}
-const char *
+static const char *
expand_email_owner(struct metadef *def, void *data)
{
struct file_triplet *trp = data;
@@ -765,7 +764,7 @@ t_notify(struct mailevt *evt, int ev, struct file_triplet const *trp)
break;
case notify_user:
- rcpt = get_uploader_email(trp->uploader, trp, &errp);
+ rcpt = get_uploader_email(trp, &errp);
break;
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,
void meta_free(struct metadef *def);
struct metadef *metadef_join(struct metadef *a, struct metadef *b);
-const char *expand_email_admin(struct metadef *def, void *data);
-const char *expand_email_owner(struct metadef *def, void *data);
/* Modules */
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
WD_DISTDIR=@abs_top_srcdir@/tests/dist
WD_SRC=@abs_top_builddir@/tests/source
WD_DST=@abs_top_builddir@/tests/dest
+WD_MAILUTILS=@WD_MAILUTILS@
MKDIR_P="@MKDIR_P@"
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
])
AT_CHECK([
+AT_MAILUTILS_PREREQ
wydawca_init_testdirs
wydawca_config wydawca.rc
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
])
AT_CHECK([
+AT_MAILUTILS_PREREQ
wydawca_init_testdirs
wydawca_config wydawca.rc
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,
])
AT_CHECK([
+AT_MAILUTILS_PREREQ
wydawca_init_testdirs
wydawca_config wydawca.rc
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],[
test -z "`sort < /dev/null 2>&1`" || AT_SKIP_TEST
])
+m4_define([AT_MAILUTILS_PREREQ],[test "$WD_MAILUTILS" = yes || AT_SKIP_TEST])
+
AT_INIT
AT_TESTED([wydawca])
m4_include([version.at])

Return to:

Send suggestions and report system problems to the System administrator.