aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--doc/wydawca.texi16
-rw-r--r--src/cmdline.opt9
-rw-r--r--src/config.c19
-rw-r--r--src/gpg.c33
-rw-r--r--src/job.c64
-rw-r--r--src/net.c10
-rw-r--r--src/process.c4
-rw-r--r--src/triplet.c15
-rw-r--r--src/verify.c7
-rw-r--r--src/watcher.c18
-rw-r--r--src/wydawca.c36
-rw-r--r--src/wydawca.h10
-rw-r--r--tests/.gitignore4
-rw-r--r--tests/Makefile.am8
-rw-r--r--tests/atlocal.in82
-rw-r--r--tests/check-fail.at16
-rw-r--r--tests/check-notify.at26
-rw-r--r--tests/check-ok.at11
-rw-r--r--tests/etc/mailstats.cfin2
-rw-r--r--tests/etc/notify.cfin2
-rw-r--r--tests/etc/wydawca.cfin13
-rw-r--r--tests/inotify-ok.at54
-rw-r--r--tests/mailstats.at9
-rw-r--r--tests/notify-upl.at11
-rw-r--r--tests/testsuite.at27
-rw-r--r--tests/upl11.at15
-rw-r--r--tests/upl12f.at23
-rw-r--r--tests/upl12t.at17
-rw-r--r--tests/upload-dry.at22
-rw-r--r--tests/upload.at8
-rw-r--r--tests/wyasync.c334
-rw-r--r--tests/wyinit.c120
33 files changed, 818 insertions, 228 deletions
diff --git a/configure.ac b/configure.ac
index 5febba2..26ae9ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,6 +142,7 @@ if test $status_inotify = yes; then
AC_DEFINE([WITH_INOTIFY],1,[Set to 1 if inotify(7) is to be used])
fi
AM_CONDITIONAL([COND_INOTIFY],[test $status_inotify = yes])
+AC_SUBST(WY_INOTIFY,[$status_inotify])
# Grecs subsystem
diff --git a/doc/wydawca.texi b/doc/wydawca.texi
index f7245ee..127abde 100644
--- a/doc/wydawca.texi
+++ b/doc/wydawca.texi
@@ -413,13 +413,17 @@ all diagnostics via @command{syslog}, and the option
the standard error.
@xopindex{cron, described}
- The operation mode is configured in the configuration file. If the
-latter configures daemon mode, you can still instruct
-@command{wydawca} to run as a cron job by the @option{--cron} command
-line option. This may be needed, for example, to schedule a daily
+ The operation mode can be configured in the configuration file or
+in the command line. Command line options take precedence over
+configuration settings. The cron mode is the default. It can also
+be requested explicitly, using the @option{--cron} command
+line option. This may be needed, for example, to schedule a daily
@command{wydawca} run when the main daemon instance is already
running.
+@xopindex{daemon, described}
+Similarly, the @option{--daemon} option enables daemon mode.
+
@anchor{spool selection}
Usually @command{wydawca} attempts to process all the configured
spools. You may instruct it to process only a subset of these
@@ -3692,6 +3696,10 @@ Run in cron mode. @xref{starting,, cron}.
@xref{stderr, The @option{--syslog} option}.
+@opsummary{daemon}
+@item --daemon
+Run in daemon mode. @xref{starting,, daemon}.
+
@opsummary{debug}
@sopindex{d, summary}
@item --debug
diff --git a/src/cmdline.opt b/src/cmdline.opt
index 88c7c32..bcb92d8 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -75,8 +75,13 @@ END
OPTION(cron,,,
[<force cron mode>])
BEGIN
- cron_option = 1;
- wy_log_to_stderr = 0;
+ wy_mode_option = WY_MODE_CRON;
+END
+
+OPTION(daemon,,,
+ [<force daemon mode>])
+BEGIN
+ wy_mode_option = WY_MODE_DAEMON;
END
OPTION(force,,,
diff --git a/src/config.c b/src/config.c
index 2bb3550..240645a 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1412,11 +1412,28 @@ cb_upload_version(enum grecs_callback_command cmd, grecs_node_t * node,
*pversion = n;
return 0;
}
+
+static int
+cb_daemon_mode(enum grecs_callback_command cmd, grecs_node_t *node,
+ void *varptr, void *cb_data)
+{
+ grecs_locus_t *locus = &node->locus;
+ grecs_value_t *value = node->v.value;
+ int t;
+
+ if (wy_assert_string_arg(locus, cmd, value))
+ return 1;
+ if (grecs_string_convert(&t, grecs_type_bool, value->v.string, locus))
+ return 1;
+ if (t)
+ wy_mode = WY_MODE_DAEMON;
+ return 0;
+}
static struct grecs_keyword wydawca_kw[] = {
{ "daemon", NULL,
N_("Enable daemon mode"),
- grecs_type_bool, GRECS_DFLT, &daemon_mode },
+ grecs_type_bool, GRECS_DFLT, NULL, 0, cb_daemon_mode },
{ "foreground", NULL,
N_("Start in foreground even in daemon mode"),
grecs_type_bool, GRECS_DFLT, &foreground },
diff --git a/src/gpg.c b/src/gpg.c
index 7da0f0d..dd15927 100644
--- a/src/gpg.c
+++ b/src/gpg.c
@@ -42,6 +42,8 @@ recursive_rmdir(const char *name)
struct dirent *ent;
if (chdir(name)) {
+ if (errno == ENOENT)
+ return 0;
wy_log(LOG_ERR, _("cannot change to directory %s: %s"),
name, strerror(errno));
return 1;
@@ -218,7 +220,9 @@ verify_directive_signature(struct wy_triplet *trp)
gpgme_error_t ec;
int rc;
struct wy_user *uptr;
-
+ struct stat st;
+ FILE *fp;
+
create_gpg_homedir();
fail_if_err(gpgme_new(&ctx));
@@ -237,9 +241,30 @@ verify_directive_signature(struct wy_triplet *trp)
uptr->name, uptr->fpr));
}
- fail_if_err(gpgme_data_new_from_file(&directive_data,
- trp->file[file_directive].name,
- 1));
+ fp = fopenat_ro(trp->spool->source_fd, trp->file[file_directive].name);
+ if (!fp) {
+ wy_log(LOG_ERR, _("cannot open file %s/%s: %s"),
+ trp->spool->source_dir, trp->file[file_directive].name,
+ strerror(errno));
+ return 1;
+ }
+ if (fstat(fileno(fp), &st)) {
+ wy_log(LOG_ERR, _("cannot stat file %s/%s: %s"),
+ trp->spool->source_dir, trp->file[file_directive].name,
+ strerror(errno));
+ fclose(fp);
+ return 1;
+ }
+
+ ec = gpgme_data_new_from_filepart(&directive_data,
+ NULL, fp, 0, st.st_size);
+ fclose(fp);
+ if (ec) {
+ wy_log(LOG_ERR, _("%s: GPGME error: %s"),
+ "gpgme_data_new_from_filepart", gpgme_strerror(ec));
+ return 1;
+ }
+
gpgme_data_new(&plain);
ec = gpgme_op_verify(ctx, directive_data, NULL, plain);
if (ec == GPG_ERR_NO_ERROR) {
diff --git a/src/job.c b/src/job.c
index 54fce7d..b413bf5 100644
--- a/src/job.c
+++ b/src/job.c
@@ -16,11 +16,18 @@
#include "wydawca.h"
-#define STATE_FINISHED 0x01
-#define STATE_QUEUED 0x02
-#define STATE_ACTIVE 0x04
+enum {
+ STATE_FINISHED,
+ STATE_QUEUED,
+ STATE_ACTIVE
+};
+
+#define STATE_MASK(s) (1<<(s))
-#define STATE_ANY (STATE_FINISHED|STATE_QUEUED|STATE_ACTIVE)
+#define STATE_ANY \
+ (STATE_MASK(STATE_FINISHED) |\
+ STATE_MASK(STATE_QUEUED) | \
+ STATE_MASK(STATE_ACTIVE))
struct job {
enum job_type type;
@@ -130,7 +137,7 @@ job_locate(int type, int mask, void *data)
{
struct job *p;
for (p = queue; p; p = p->next)
- if (p->type == type && (p->state & mask)) {
+ if (p->type == type && (STATE_MASK(p->state) & mask)) {
switch (p->type) {
case JOB_TRIPLET:{
struct wy_triplet *tp;
@@ -161,7 +168,7 @@ job_active_count()
struct job *job;
size_t count = 0;
for (job = queue; job; job = job->next)
- if (job->state & STATE_ACTIVE)
+ if (job->state == STATE_ACTIVE)
count++;
return count;
}
@@ -229,7 +236,6 @@ job_start(struct job *job)
pid = fork();
if (pid == 0) {
- int i;
signal(SIGHUP, SIG_DFL);
signal(SIGTERM, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
@@ -237,8 +243,6 @@ job_start(struct job *job)
signal(SIGCHLD, SIG_DFL);
signal(SIGALRM, SIG_DFL);
alarm(0);
- for (i = getdtablesize(); i > 2; i--)
- close(i);
exit(wydawca_scanner(job) ? WYDAWCA_EX_AGAIN : 0);
} else if (pid == -1) {
wy_log(LOG_CRIT, "fork: %s", strerror(errno));
@@ -301,7 +305,9 @@ job_schedule(int type, void *data)
{
struct job *job;
- job = job_locate(type, type == JOB_TRIPLET ? STATE_QUEUED : STATE_ANY,
+ job = job_locate(type,
+ type == JOB_TRIPLET
+ ? STATE_MASK(STATE_QUEUED) : STATE_ANY,
data);
if (!job) {
job = grecs_zalloc(sizeof(*job));
@@ -332,7 +338,7 @@ job_schedule(int type, void *data)
job_insert(job, NULL);
}
- job->state |= STATE_QUEUED;
+ job->state = STATE_QUEUED;
job_start(job);
}
@@ -399,9 +405,8 @@ job_queue_runner(time_t min_interval)
if (pid <= 0)
break;
for (job = queue; job; job = job->next) {
- if ((job->state & STATE_ACTIVE) && job->pid == pid) {
- job->state &= ~STATE_ACTIVE;
- job->state |= STATE_FINISHED;
+ if (job->state == STATE_ACTIVE && job->pid == pid) {
+ job->state = STATE_FINISHED;
jq_clear(job);
job->exit_status = status;
jobcnt--;
@@ -411,24 +416,21 @@ job_queue_runner(time_t min_interval)
for (job = queue; job;) {
struct job *next = job->next;
- if (job->state & STATE_FINISHED) {
+ if (job->state == STATE_FINISHED) {
print_status(job, 0);
- if ((job->state &= ~STATE_FINISHED) == 0) {
- if (WIFEXITED(job->exit_status) &&
- WEXITSTATUS(job->exit_status) ==
- WYDAWCA_EX_AGAIN) {
- time_t interval = lock_timeout;
- if (interval == 0)
- interval = lock_expire_time;
- /* Re-queue the job */
- job->state = STATE_QUEUED;
- job->timestamp = now + interval;
- } else {
- job_remove(job);
- job_destroy(job);
- job = next;
- continue;
- }
+ if (WIFEXITED(job->exit_status) &&
+ WEXITSTATUS(job->exit_status) == WYDAWCA_EX_AGAIN) {
+ time_t interval = lock_timeout;
+ if (interval == 0)
+ interval = lock_expire_time;
+ /* Re-queue the job */
+ job->state = STATE_QUEUED;
+ job->timestamp = now + interval;
+ } else {
+ job_remove(job);
+ job_destroy(job);
+ job = next;
+ continue;
}
}
diff --git a/src/net.c b/src/net.c
index a27a9e7..9e951af 100644
--- a/src/net.c
+++ b/src/net.c
@@ -155,6 +155,13 @@ sig_term(int sig)
terminate = 1;
}
+static inline int
+notify_parent(void)
+{
+ char *p = getenv("WYDAWCA_NOTIFY_PARENT");
+ return (p && strcmp(p, "1") == 0);
+}
+
void
wydawca_listener()
{
@@ -175,6 +182,9 @@ wydawca_listener()
exit(EX_CONFIG);
}
+ if (notify_parent())
+ kill(getppid(), SIGUSR1);
+
job_init();
signal(SIGHUP, sig_hup);
signal(SIGTERM, sig_term);
diff --git a/src/process.c b/src/process.c
index f2b172c..80fd511 100644
--- a/src/process.c
+++ b/src/process.c
@@ -184,7 +184,7 @@ spool_add_new_file(const struct spool *spool, const char *name,
/* Scan upload directory from the DPAIR and register all files found
there, forming triplets when possible */
void
-scan_spool_unlocked(struct spool *spool, int uc, uid_t * uv)
+scan_spool_unlocked(struct spool *spool, int uc, uid_t *uv)
{
DIR *dir;
struct dirent *ent;
@@ -219,7 +219,7 @@ scan_spool_unlocked(struct spool *spool, int uc, uid_t * uv)
}
int
-scan_spool(struct spool *spool, int uc, uid_t * uv)
+scan_spool(struct spool *spool, int uc, uid_t *uv)
{
char *lockfile = wydawca_lockname(spool->tag);
int rc = wydawca_lock(lockfile);
diff --git a/src/triplet.c b/src/triplet.c
index 4cf9bac..6612ddf 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -365,7 +365,11 @@ static int
triplet_processor(void *data, void *proc_data)
{
struct wy_triplet *trp = data;
-
+ struct spool *spool = proc_data;
+
+ if (trp->spool != spool)
+ return 0;
+
wy_debug(1, ("FILE %s, DIST=%s, SIG=%s, DIRECTIVE=%s",
trp->name,
SP(trp->file[file_dist].name),
@@ -411,14 +415,11 @@ spool_commit_triplets(struct spool *spool, struct wy_triplet *tplist)
push_dir(spool->source_dir);
if (tplist) {
while (tplist) {
- struct wy_triplet *next = tplist->jq_next;
- if (tplist->spool == spool)
- triplet_processor(tplist, NULL);
- tplist = next;
+ triplet_processor(tplist, spool);
+ tplist = tplist->jq_next;
}
} else if (triplet_table) {
- grecs_symtab_foreach(triplet_table, triplet_processor, NULL);
- grecs_symtab_clear(triplet_table);
+ grecs_symtab_foreach(triplet_table, triplet_processor, spool);
}
pop_dir();
}
diff --git a/src/verify.c b/src/verify.c
index b5880db..09451ea 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -102,10 +102,11 @@ fill_project_name(struct wy_triplet *trp)
return 1;
}
- fp = fopen(trp->file[file_directive].name, "r");
+ fp = fopenat_ro(trp->spool->source_fd, trp->file[file_directive].name);
if (!fp) {
- wy_log(LOG_ERR, _("cannot open file %s: %s"),
- trp->file[file_directive].name, strerror(errno));
+ wy_log(LOG_ERR, _("cannot open file %s/%s: %s"),
+ trp->spool->source_dir, trp->file[file_directive].name,
+ strerror(errno));
return 1;
}
diff --git a/src/watcher.c b/src/watcher.c
index 814385d..cb05f07 100644
--- a/src/watcher.c
+++ b/src/watcher.c
@@ -229,3 +229,21 @@ watcher_run(int ifd)
return 0;
}
+
+FILE *
+fopenat_ro(int dirfd, char const *name)
+{
+ int fd;
+ FILE *fp;
+
+ fd = openat(dirfd, name, O_RDONLY);
+ if (fd == -1)
+ return NULL;
+ fp = fdopen(fd, "r");
+ if (fp == NULL) {
+ int ec = errno;
+ close(fd);
+ errno = ec;
+ }
+ return fp;
+}
diff --git a/src/wydawca.c b/src/wydawca.c
index 4450bac..d83ccab 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -36,13 +36,16 @@ unsigned long print_stats; /* Print final statistics output */
time_t file_sweep_time = 0;
char *tar_command_name = "tar";
int archive_signatures = 1; /* Archive sig files by default */
-int lint_mode = 0;
+
+int lint_mode;
+
+int wy_mode = WY_MODE_NORMAL;
+int wy_mode_option = -1;
+
int preprocess_only = 0;
-int cron_option = 0;
int foreground_option = -1;
int single_process_option = -1;
-int daemon_mode = 0;
int foreground;
int single_process;
time_t wakeup_interval;
@@ -353,7 +356,7 @@ main(int argc, char **argv)
wy_debug(4, (_("using GPGME version %s"), p));
if (argc) {
- if (daemon_mode) {
+ if (wy_mode == WY_MODE_DAEMON) {
wy_log(LOG_CRIT, _("extra arguments in daemon mode"));
exit(EX_UNAVAILABLE);
} else {
@@ -384,17 +387,28 @@ main(int argc, char **argv)
exit(0);
if (wy_dry_run || selected_spools())
- cron_option = 1;
- if (cron_option)
- daemon_mode = 0;
+ wy_mode_option = WY_MODE_CRON;
+ if (wy_mode_option != -1)
+ wy_mode = wy_mode_option;
if (foreground_option >= 0)
foreground = foreground_option;
if (single_process_option >= 0)
single_process = single_process_option;
- if (wy_log_to_stderr == -1)
- wy_log_to_stderr = !daemon_mode || foreground;
-
+ if (wy_log_to_stderr == -1) {
+ switch (wy_mode) {
+ case WY_MODE_NORMAL:
+ wy_log_to_stderr = 1;
+ break;
+ case WY_MODE_CRON:
+ wy_log_to_stderr = 0;
+ break;
+ case WY_MODE_DAEMON:
+ wy_log_to_stderr = foreground;
+ break;
+ }
+ }
+
grecs_log_to_stderr = wy_log_to_stderr;
if (!wy_log_to_stderr) {
openlog(wy_syslog_tag, LOG_PID, wy_log_facility);
@@ -419,7 +433,7 @@ main(int argc, char **argv)
wy_log(LOG_NOTICE, _("wydawca (%s) started"), PACKAGE_STRING);
scan_all_spools(uidc, uidv);
- if (daemon_mode)
+ if (wy_mode == WY_MODE_DAEMON)
wydawca_daemon();
else
logstats();
diff --git a/src/wydawca.h b/src/wydawca.h
index c2ae2de..fd0bbfb 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -334,7 +334,13 @@ extern time_t lock_expire_time;
extern time_t lock_timeout;
extern int enable_locking;
-extern int daemon_mode;
+enum {
+ WY_MODE_NORMAL,
+ WY_MODE_CRON,
+ WY_MODE_DAEMON,
+};
+extern int wy_mode;
+
extern time_t wakeup_interval;
extern int foreground;
extern int single_process;
@@ -601,3 +607,5 @@ int watcher_run(int);
#endif
int wy_stat_expansion(char **ret, char const *name, size_t len);
+FILE *fopenat_ro(int dirfd, char const *name);
+
diff --git a/tests/.gitignore b/tests/.gitignore
index 4fa16bb..d2800cc 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -4,9 +4,9 @@ package.m4
testsuite
testsuite.dir
testsuite.log
-source
-dest
pushck
bkupname
nullmail
cwdrepl
+wyasync
+wyinit
diff --git a/tests/Makefile.am b/tests/Makefile.am
index edf7b08..437eff4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -47,6 +47,7 @@ TESTSUITE_AT = \
check-fail.at\
check-notify.at\
check-ok.at\
+ inotify-ok.at\
notify-upl.at\
mailstats.at\
pushdir.at\
@@ -79,7 +80,7 @@ check-local: atconfig atlocal $(TESTSUITE)
#installcheck-local:
# $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
-check_PROGRAMS = pushck bkupname cwdrepl
+check_PROGRAMS = pushck bkupname cwdrepl wyinit
AM_CPPFLAGS = \
@GRECS_INCLUDES@ \
-I$(top_srcdir)/include\
@@ -88,6 +89,11 @@ LDADD=@GRECS_LDADD@
pushck_LDADD=../src/pushd.o
bkupname_LDADD=../src/backup.o @GRECS_LDADD@
+wyinit_LDADD=@GRECS_LDADD@
+
+if COND_INOTIFY
+ check_PROGRAMS += wyasync
+endif
if COND_MAILUTILS
check_PROGRAMS += nullmail
diff --git a/tests/atlocal.in b/tests/atlocal.in
index d0a9899..6102995 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -6,14 +6,15 @@ PATH=@abs_builddir@:@abs_top_builddir@/src:@abs_top_srcdir@/build-aux:$top_srcdi
XFAILFILE=$abs_builddir/.badversion
-trap "cleanup; test -r $XFAILFILE && cat $XFAILFILE; exit $?" 1 2 13 15
+trap "test -r $XFAILFILE && cat $XFAILFILE; exit $?" 1 2 13 15
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_DST=dest
WY_TESTDIR=@abs_top_builddir@/tests
WY_MAILUTILS=@WY_MAILUTILS@
+WY_INOTIFY=@WY_INOTIFY@
MKDIR_P="@MKDIR_P@"
if test -w /; then
@@ -24,62 +25,49 @@ fi
ulimit -c unlimited
-wydawca_init_testdirs() {
- for dir in "$WY_SRC" "$WY_SRC/test" "${WY_SRC}/fail" "${WY_SRC}/ok" "$WY_DST"
- do
- if test -d "$dir"; then
- rm -rf "$dir"/*
- else
- mkdir "$dir"
- fi
- done
-}
-
-wydawca_clean_testdirs() {
- rm -rf "$WY_SRC" "$WY_DST"
-}
-
wydawca_expandmeta() {
- sed -e "s/@USER@/$USER/g" \
- -e "s,@WY_SRC@,$WY_SRC,g" \
- -e "s,@WY_DST@,$WY_DST,g" \
- -e "s,@WY_CONFSRC@,$WY_CONFSRC,g" \
- -e "s,@WY_TESTDIR@,$WY_TESTDIR,g" \
- -e "s,@WY_MODDIR@,@abs_top_builddir@/modules/mailutils,g" $1 > $2
+ sed -e "s/@USER@/$USER/g" \
+ -e "s,@CWD@,$PWD,g" \
+ -e "s,@WY_SRC@,$WY_SRC,g" \
+ -e "s,@WY_DST@,$WY_DST,g" \
+ -e "s,@WY_CONFSRC@,$WY_CONFSRC,g" \
+ -e "s,@WY_TESTDIR@,$WY_TESTDIR,g" \
+ -e "s,@WY_MODDIR@,@abs_top_builddir@/modules/mailutils,g" $1 > $2
}
wydawca_config() {
- wydawca_expandmeta $WY_CONFSRC/${1}in $1
+ wydawca_expandmeta $WY_CONFSRC/${1}in $1
+ wyinit $1
}
wydawca_upload() {
- dir="$WY_SRC/$1"
- shift
- file=$1
- shift
- cp "$WY_DISTDIR/$file" "$dir"
- cp "$WY_DISTDIR/$file.sig" "$dir"
- if test -n "$1"; then
- cp "$WY_DISTDIR/$1" "$dir/$file.directive.asc"
- else
- cp "$WY_DISTDIR/$file.directive.asc" "$dir"
- fi
+ dir=source/$1
+ shift
+ file=$1
+ shift
+ cp "$WY_DISTDIR/$file" "$dir"
+ cp "$WY_DISTDIR/$file.sig" "$dir"
+ if test -n "$1"; then
+ cp "$WY_DISTDIR/$1" "$dir/$file.directive.asc"
+ else
+ cp "$WY_DISTDIR/$file.directive.asc" "$dir"
+ fi
}
wydawca_cmp() {
- p=$1
- shift
- for file in $@
- do
- cmp "$WY_DISTDIR/$file" "$WY_DST/$p/$file" || exit 1
- done
+ p=$1
+ shift
+ for file in $@
+ do
+ cmp "$WY_DISTDIR/$file" "$WY_DST/$p/$file" || exit 1
+ done
}
wydawca_cmparc() {
- p=$1
- shift
- for file in $@
- do
- cmp "$WY_DISTDIR/$file" "$WY_DST/$p/archive/$file" || exit 1
- done
+ p=$1
+ shift
+ for file in $@
+ do
+ cmp "$WY_DISTDIR/$file" "$WY_DST/$p/archive/$file" || exit 1
+ done
}
diff --git a/tests/check-fail.at b/tests/check-fail.at
index f330a2e..268ca47 100644
--- a/tests/check-fail.at
+++ b/tests/check-fail.at
@@ -17,14 +17,14 @@
AT_SETUP([Verification test failure])
AT_KEYWORDS([uploads check-test check-fail])
-AT_DATA([template],
+AT_DATA([experr],
[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
wydawca: [[NOTICE]] file.directive.asc: VERSION: 1.1
wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite
wydawca: [[ERR]] spool check script for file@ckfail returned 1
-wydawca: [[NOTICE]] removing @WY_SRC@/fail/file
-wydawca: [[NOTICE]] removing @WY_SRC@/fail/file.sig
-wydawca: [[NOTICE]] removing @WY_SRC@/fail/file.directive.asc
+wydawca: [[NOTICE]] removing ./source/fail/file
+wydawca: [[NOTICE]] removing ./source/fail/file.sig
+wydawca: [[NOTICE]] removing ./source/fail/file.directive.asc
wydawca: [[INFO]] errors: 1
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -43,18 +43,14 @@ wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) fini
])
AT_CHECK([
-wydawca_init_testdirs
wydawca_config wydawca.cf
wydawca_upload fail file
-wydawca_expandmeta template experr
-
-wydawca $WY_FORCE --no-preproc -c wydawca.cf
+wydawca $WY_FORCE --no-preproc -c wydawca.cf 2>err
+cat err | cwdrepl >&2
],
[0],
[],
[experr])
-wydawca_clean_testdirs
-
AT_CLEANUP
diff --git a/tests/check-notify.at b/tests/check-notify.at
index ec539c4..298ebd0 100644
--- a/tests/check-notify.at
+++ b/tests/check-notify.at
@@ -17,14 +17,14 @@
AT_SETUP([Verification test failure notification])
AT_KEYWORDS([uploads check-test check-fail check-fail-notify notify])
-AT_DATA([template],
+AT_DATA([experr],
[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
wydawca: [[NOTICE]] file.directive.asc: VERSION: 1.1
wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite
wydawca: [[ERR]] spool check script for file@ckfail returned 1
-wydawca: [[NOTICE]] removing @WY_SRC@/fail/file
-wydawca: [[NOTICE]] removing @WY_SRC@/fail/file.sig
-wydawca: [[NOTICE]] removing @WY_SRC@/fail/file.directive.asc
+wydawca: [[NOTICE]] removing ./source/fail/file
+wydawca: [[NOTICE]] removing ./source/fail/file.sig
+wydawca: [[NOTICE]] removing ./source/fail/file.directive.asc
wydawca: [[INFO]] errors: 1
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -42,7 +42,7 @@ wydawca: [[INFO]] check failures: 1
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-AT_DATA([outtmpl],
+AT_DATA([expout],
[From wydawca-noreply@localhost
From: wydawca-noreply@localhost
To: "Wydawca Test User" <gray@localhost>
@@ -52,8 +52,8 @@ Your upload of file has been rejected by the distribution
verification procedure with the following diagnostics:
WYDAWCA_SPOOL=ckfail
-WYDAWCA_SOURCE=@WY_SRC@/fail
-WYDAWCA_DEST=@WY_DST@
+WYDAWCA_SOURCE=./source/fail
+WYDAWCA_DEST=./dest
WYDAWCA_URL=ftp://wydawca.ckfail
WYDAWCA_TRIPLET_BASE=file
WYDAWCA_DIST_FILE=file
@@ -67,24 +67,18 @@ The Project Submission Robot
AT_CHECK([
AT_MAILUTILS_PREREQ
-wydawca_init_testdirs
wydawca_config wydawca.cf
mv wydawca.cf simple.cf
wydawca_config notify.cf
cat notify.cf simple.cf >> wydawca.cf
wydawca_upload fail file
-
-wydawca_expandmeta outtmpl expout
-wydawca_expandmeta template experr
-
-wydawca $WY_FORCE --no-preproc -c wydawca.cf || exit $?
-cat $WY_DST/mail.out
+wydawca $WY_FORCE --no-preproc -c wydawca.cf 2>err || exit $?
+cat err | cwdrepl >&2
+cat mail.out | cwdrepl
],
[0],
[expout],
[experr])
-wydawca_clean_testdirs
-
AT_CLEANUP
diff --git a/tests/check-ok.at b/tests/check-ok.at
index 3193be6..11ee9a1 100644
--- a/tests/check-ok.at
+++ b/tests/check-ok.at
@@ -17,7 +17,7 @@
AT_SETUP([Verification test success])
AT_KEYWORDS([uploads check-test check-success check-ok])
-AT_DATA([template],
+AT_DATA([experr],
[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
wydawca: [[NOTICE]] file.directive.asc: VERSION: 1.1
wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite
@@ -39,19 +39,14 @@ wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) fini
])
AT_CHECK([
-wydawca_init_testdirs
wydawca_config wydawca.cf
wydawca_upload ok file
-
-wydawca_expandmeta template experr
-
-wydawca $WY_FORCE --no-preproc -c wydawca.cf || exit $?
+wydawca $WY_FORCE --no-preproc -c wydawca.cf 2>err|| exit $?
+cat err | cwdrepl >&2
wydawca_cmp proj file file.sig
],
[0],
[],
[experr])
-wydawca_clean_testdirs
-
AT_CLEANUP
diff --git a/tests/etc/mailstats.cfin b/tests/etc/mailstats.cfin
index 46be62e..c81da14 100644
--- a/tests/etc/mailstats.cfin
+++ b/tests/etc/mailstats.cfin
@@ -20,7 +20,7 @@ module-init mailutils {
admin-address "root@localhost";
from-address "wydawca-noreply@localhost";
- mailer "| @WY_TESTDIR@/nullmail -o @WY_DST@/mail.out -F ${sender} ${rcpt}";
+ mailer "| @WY_TESTDIR@/nullmail -o @CWD@/mail.out -F ${sender} ${rcpt}";
mail-statistics {
statistics all;
diff --git a/tests/etc/notify.cfin b/tests/etc/notify.cfin
index 70d2895..64c09b3 100644
--- a/tests/etc/notify.cfin
+++ b/tests/etc/notify.cfin
@@ -20,7 +20,7 @@ module-init mailutils {
admin-address "root@localhost";
from-address "wydawca-noreply@localhost";
- mailer "| @WY_TESTDIR@/nullmail -o @WY_DST@/mail.out -F ${sender} ${rcpt}";
+ mailer "| @WY_TESTDIR@/nullmail -o @CWD@/mail.out -F ${sender} ${rcpt}";
}
# Notify the user about successful uploads