summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2020-04-23 18:14:49 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2020-04-23 18:27:47 (GMT)
commit8234484dba123ad8001657def8fb57133f9610bf (patch) (side-by-side diff)
tree3c648730985b0ec37ed6fa5af7fe35fedaeb3c31
parent80466e8f237077f11134554ab1a68b47f49616e2 (diff)
downloadwydawca-8234484dba123ad8001657def8fb57133f9610bf.tar.gz
wydawca-8234484dba123ad8001657def8fb57133f9610bf.tar.bz2
Rewrite the testsuite.
Use gpg2 to create the keys, and sign files as necessary. * NEWS: Update. * doc/wydawca.texi: Update. * configure.ac: Detect the presence of GPG version 2. * src/cmdline.opt (--single-process): Remove. * src/config.c: Remove the "single-process" statement. * src/triplet.c (triplet_enqueue): Fix eventual NULL dereference. (wy_triplet_wait): Update the WY_STAT_INCOMPLETE_TRIPLETS counter. * src/wydawca.c (single_process_option): Remove global. * src/wydawca.h (single_process): Remove global. * tests/.gitignore: Update. * tests/Makefile.am: Update. * tests/atlocal.in: Rewrite. * tests/chargen.c: New auxiliary tool * tests/dist/file: Remove. * tests/dist/file.directive.asc: Remove. * tests/dist/file.sig: Remove. * tests/dist/file12f.directive.asc: Remove. * tests/dist/file12t.directive.asc: Reemove. * tests/dist/rmsymlink.directive.asc: Remove. * tests/dist/symlink.directive.asc: Remove. * tests/etc/notify.cfin: Rename to tests/etc/notify.cf * tests/etc/Makefile.am: Update. * tests/etc/dbgen.sh: New file. * tests/etc/keygen.sh: New file. * tests/etc/project: New file. * tests/etc/pubring.asc: Remove. * tests/etc/secring.asc: Remove. * tests/etc/wydawca.cfin: Remove. * tests/*.at: Rewrite.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--NEWS13
-rw-r--r--configure.ac24
-rw-r--r--doc/wydawca.texi58
-rw-r--r--src/cmdline.opt12
-rw-r--r--src/config.c7
-rw-r--r--src/triplet.c10
-rw-r--r--src/wydawca.c4
-rw-r--r--src/wydawca.h1
-rw-r--r--tests/.gitignore1
-rw-r--r--tests/Makefile.am32
-rw-r--r--tests/atlocal.in150
-rw-r--r--tests/chargen.c79
-rw-r--r--tests/check-fail.at41
-rw-r--r--tests/check-notify.at107
-rw-r--r--tests/check-ok.at34
-rw-r--r--tests/dist/file1
-rw-r--r--tests/dist/file.directive.asc14
-rw-r--r--tests/dist/file.sig7
-rw-r--r--tests/dist/file12f.directive.asc15
-rw-r--r--tests/dist/file12t.directive.asc15
-rw-r--r--tests/dist/rmsymlink.directive.asc14
-rw-r--r--tests/dist/symlink.directive.asc14
-rw-r--r--tests/dry_run00.at (renamed from tests/upload.at)38
-rw-r--r--tests/dry_run01.at83
-rw-r--r--tests/dry_run02.at (renamed from tests/upl12t.at)55
-rw-r--r--tests/etc/.gitignore3
-rw-r--r--tests/etc/Makefile.am30
-rw-r--r--tests/etc/dbgen.sh93
-rw-r--r--tests/etc/keygen.sh59
-rw-r--r--tests/etc/notify.cf (renamed from tests/etc/notify.cfin)9
-rw-r--r--tests/etc/project4
-rw-r--r--tests/etc/pubring.asc30
-rw-r--r--tests/etc/secring.asc31
-rw-r--r--tests/etc/wydawca.cfin98
-rw-r--r--tests/inotify-ok.at39
-rw-r--r--tests/inotify-rmsymlink.at56
-rw-r--r--tests/inotify-symlink.at59
-rw-r--r--tests/inotify-unatt00.at39
-rw-r--r--tests/inotify-unatt01.at43
-rw-r--r--tests/mailnotify.at (renamed from tests/notify-upl.at)111
-rw-r--r--tests/mailstats.at111
-rw-r--r--tests/rmsymlink00.at46
-rw-r--r--tests/symlink00.at47
-rw-r--r--tests/symlink01.at55
-rw-r--r--tests/testsuite.at59
-rw-r--r--tests/unp-idle.at29
-rw-r--r--tests/unp00.at70
-rw-r--r--tests/unp01.at66
-rw-r--r--tests/unp02.at73
-rw-r--r--tests/upl12f.at61
-rw-r--r--tests/upload-dry.at69
-rw-r--r--tests/upload00.at (renamed from tests/upl11.at)47
-rw-r--r--tests/upload01.at91
53 files changed, 1343 insertions, 1014 deletions
diff --git a/NEWS b/NEWS
index f37bfd6..eaa80ba 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-Wydawca NEWS -- history of user-visible changes. 2020-04-20
+Wydawca NEWS -- history of user-visible changes. 2020-04-23
See the end of file for copying conditions.
Please send Wydawca bug reports to <bug-wydawca@gnu.org.ua>.
@@ -46,12 +46,23 @@ spool simultaneously lock files were used.
This version does not allow for such usage. Only one copy of wydawca
can be running. Therefore spool locking has been discontinued.
+* Command line usage
+
+** The --single-process option removed
+
+** The -d (--debug) option requires argument
+
+The argument is a decimal number specifying the desired debug level.
+Thus, instead of -ddd, use -d3 (or --debug=3).
+
* Configuration changes
** The wakeup-interval statement removed
** The locking statement removed
+** The single-process statement removed
+
** max-connections statement
This new statement configures the maximum number of upload
diff --git a/configure.ac b/configure.ac
index 0e1366b..865d206 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,7 +110,7 @@ AH_BOTTOM(
#endif
])
LDADD=$saved_LDADD
-
+
# **********************
# TCP wrappers
# **********************
@@ -176,10 +176,24 @@ AM_MISSING_PROG([AUTOM4TE], [autom4te])
# Initialize documentation helpers.
IMPRIMATUR_INIT(, [frenchspacing])
-AC_PATH_PROG(GPG, gpg, '')
-if test -n "$GPG"; then
- AC_SUBST(WYDAWCA_GPGFILES, '$(GPGFILES)')
-fi
+# **********************
+# GPG v2 (for the testsuite)
+# **********************
+AC_ARG_VAR([GPG],[Name of the gpg version 2 binary])
+AC_MSG_CHECKING([for the GPG v2 binary])
+uGPG=$GPG
+unset GPG
+for prog in $uGPG gpg2 gpg
+do
+ ver=$($prog --version 2>/dev/null | head -n 1)
+ case $ver in
+ "gpg (GnuPG) 2."*)
+ GPG=$prog
+ break;;
+ esac
+done
+AC_MSG_RESULT([${GPG:-none}${GPG:+, $ver}])
+AM_CONDITIONAL([COND_GPG2],[test -n "$GPG"])
AC_CONFIG_FILES([Makefile
doc/Makefile
diff --git a/doc/wydawca.texi b/doc/wydawca.texi
index 64a6e36..b05e8b0 100644
--- a/doc/wydawca.texi
+++ b/doc/wydawca.texi
@@ -444,16 +444,13 @@ $ wydawca --spool=ftp --spool=test --source=/home/ftp/test-upload
@anchor{debug}
@xopindex{debug, described}
@sopindex{d, described}
- The @option{--debug} (@option{-d}) option tells the program to increase its
-debugging level by 1. The @dfn{debugging level} determines amount
-of information the program reports when it runs. Default level is 0,
-which means that only errors and other critical conditions are
-reported. Raising it may be necessary when debugging new configurations. Each
-@option{-d} option raises the level by one, so you can say
-@command{wydawca -dd} to obtain level 2, for example. The maximum
-debugging level (currently it is 4) prints an impractically big
-amount of information, and is useful mainly for @command{wydawca}
-developers.
+ The @option{--debug} (@option{-d}) option tells the program to set its
+debugging level to the given integer value. @dfn{Debugging level}
+determines the amount of information the program reports when it
+runs. Default level is 0, which means that only errors and other
+critical conditions are reported. Raising it may be necessary when
+debugging new configurations. @samp{Wydawca} version @value{version}
+implements 4 distinct debuggin levels.
@anchor{dry-run}
@xopindex{dry-run, described}
@@ -463,9 +460,11 @@ developers.
modifications to the disk contents, and to print a verbose description
of any actions it would have taken. It sets the debugging level to 1
and directs the diagnostics output to the standard error, as if
-@option{--debug --stderr} options were given. You can raise
-debugging level further by supplying additional @option{--debug}
-options. The @option{--dry-run} option is useful when testing new
+@option{--debug=1 --stderr} options were given. You can further
+control the debugging level by supplying additional @option{--debug}
+options @emph{after} the @option{--dry-run} option.
+
+The @option{--dry-run} option is useful when testing new
configurations, for example:
@smallexample
@@ -498,10 +497,11 @@ reports them on its error output and exits with a non-zero status.
other inconsistencies. If no errors were detected, the program exits
with code 0. Otherwise, the exit code is 78.
- Using this option together with @option{-d} (@option{--debug}),
+ Using this option together with @option{-d1} (@option{--debug=1}),
causes @command{wydawca} to produce a dump of the configuration parse
-tree. Using the @option{-d} option twice prefixes each statement in
-the dump with the file location where it appeared.
+tree. Setting a higher debugging level (e.g. @option{-d2} option) will
+additionally prefix each statement in the dump with the file location
+where it appeared.
@sopindex{E, introduced}
@xopindex{no-preprocessor, introduced}
@@ -980,15 +980,6 @@ If @var{bool} is @samp{yes}, run in foreground. @xref{invocation,
foreground}.
@end deffn
-@deffn {Config} single-process bool
-Configure single process mode. Normally @command{wydawca}
-spawns subprocesses for handling incoming connections and spool jobs.
-This is disabled if @var{bool} is @samp{yes} (a so-called
-@dfn{single-processs mode}). This mode is designed for debugging
-purposes. Do not use it in production environments, because it
-severely impairs performance.
-@end deffn
-
@deffn {Config} umask value
Set the default umask. The @var{value} argument must be an octal number.
@end deffn
@@ -3328,10 +3319,6 @@ daemon @var{arg:@i{boolean}};
# @xref{general, foreground}.
foreground @var{arg:@i{boolean}};
-# @r{Do not spawn subprocesses.}
-# @xref{general, single-process}.
-single-process @var{arg:@i{boolean}};
-
# @r{Set pid file name.}
# @xref{general, pidfile}.
pidfile @var{file:@i{string}};
@@ -3655,9 +3642,9 @@ Run in daemon mode. @xref{starting,, daemon}.
@opsummary{debug}
@sopindex{d, summary}
-@item --debug
-@itemx -d
-Increase debugging level by 1.
+@item --debug=@var{n}
+@itemx -d @var{n}
+Set the debugging level to @var{n}.
@xref{debug, The @option{--debug} option}.
@@ -3683,7 +3670,7 @@ Dump lexical analyzer traces. This is useful for debugging
@item --dry-run
@itemx -n
@dfn{Dry-run mode}: do nothing, print almost everything. This option
-implies @option{--debug --stderr}.
+implies @option{--debug=1 --stderr}.
@xref{dry-run, The dry-run mode}.
@@ -3741,11 +3728,6 @@ Disable preprocessor. @pxref{Preprocessor}.
@item --preprocessor=@var{command}
Use @var{command} instead of the default preprocessor. @pxref{Preprocessor}.
-@opsummary{single-process}
-@item --single-process
-Serialize job invocations by not forking subprocesses for each job.
-@emph{Do not use this option in production environment}.
-
@opsummary{source}
@sopindex{s, summary}
@item --source=@var{name}
diff --git a/src/cmdline.opt b/src/cmdline.opt
index fae3cb1..a23335d 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -96,12 +96,6 @@ BEGIN
foreground_option = 1;
END
-OPTION(single-process,,,
- [<single process mode>])
-BEGIN
- single_process_option = 1;
-END
-
OPTION(config-file,c,FILE,
[<use FILE instead of the default configuration>])
BEGIN
@@ -180,10 +174,10 @@ END
GROUP(Debugging)
-OPTION(debug,d,,
- [<increase debugging level>])
+OPTION(debug,d,[<LEVEL>],
+ [<set debugging level>])
BEGIN
- wy_debug_level++;
+ wy_debug_level = atoi(optarg);
END
OPTION(dump-grammar-trace,,,
diff --git a/src/config.c b/src/config.c
index 9d78ed3..6b99801 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1390,9 +1390,6 @@ static struct grecs_keyword wydawca_kw[] = {
{ "foreground", NULL,
N_("Start in foreground even in daemon mode"),
grecs_type_bool, GRECS_DFLT, &foreground },
- { "single-process", NULL,
- N_("Do not spawn subprocesses"),
- grecs_type_bool, GRECS_DFLT, &single_process },
{ "pidfile", N_("file"),
N_("Set pid file name"),
grecs_type_string, GRECS_CONST, &pidfile},
@@ -1727,7 +1724,7 @@ config_finish(struct grecs_node *tree)
if (file_sweep_time <= 0) {
file_sweep_time = DEFAULT_FILE_SWEEP_TIME;
wy_log(LOG_NOTICE,
- _("file-sweep-time too low; reverting to the default %ds"),
- file_sweep_time);
+ _("file-sweep-time too low; reverting to the default %lus"),
+ (unsigned long)file_sweep_time);
}
}
diff --git a/src/triplet.c b/src/triplet.c
index bde3c14..980c906 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -355,9 +355,10 @@ void
triplet_enqueue(struct wy_triplet *trp)
{
pthread_t tid;
- struct spool *spool = trp->spool;
+ struct spool *spool;
if (!trp)
return;
+ spool = trp->spool;
timer_start(WY_TIMER_SPOOL);
timer_start(spool->timer_id);
if (spool_open_dictionaries(spool) == 0) {
@@ -511,12 +512,19 @@ wy_thr_cleaner(void *ptr)
void
wy_triplet_wait(void)
{
+ size_t n;
+
triplet_list_lock(&triplet_running_list);
while (triplet_running_list.head) {
pthread_cond_wait(&triplet_running_list.cond,
&triplet_running_list.mutex);
}
triplet_list_unlock(&triplet_running_list);
+
+ pthread_mutex_lock(&triplet_table_mutex);
+ n = grecs_symtab_count(triplet_table);
+ pthread_mutex_unlock(&triplet_table_mutex);
+ *wy_get_stat_slot(WY_STAT_INCOMPLETE_TRIPLETS) += n;
}
static pthread_key_t key;
diff --git a/src/wydawca.c b/src/wydawca.c
index 01ef56c..5771feb 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -44,10 +44,8 @@ int wy_mode_option = -1;
int preprocess_only = 0;
int foreground_option = -1;
-int single_process_option = -1;
int foreground;
-int single_process;
time_t wakeup_interval;
struct grecs_list *all_spool_aliases;
char *wy_gpg_homedir;
@@ -417,8 +415,6 @@ main(int argc, char **argv)
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) {
switch (wy_mode) {
diff --git a/src/wydawca.h b/src/wydawca.h
index 90a886e..b3ece49 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -330,7 +330,6 @@ enum {
extern int wy_mode;
extern int foreground;
-extern int single_process;
extern struct grecs_sockaddr listen_sockaddr;
extern size_t max_connections;
extern time_t idle_timeout;
diff --git a/tests/.gitignore b/tests/.gitignore
index e5a908e..6a471f2 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -10,3 +10,4 @@ cwdrepl
wyasync
wyclt
wyinit
+chargen
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fb971d5..8374916 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
-EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 dist
+EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4
DISTCLEANFILES = atconfig $(check_SCRIPTS)
MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
SUBDIRS = etc
@@ -40,31 +40,33 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
## ------------ ##
TESTSUITE_AT = \
+ testsuite.at\
backup00.at\
backup01.at\
backup02.at\
backup03.at\
+ dry_run00.at\
+ dry_run01.at\
+ dry_run02.at\
+ upload00.at\
+ upload01.at\
+ upload02.at\
+ symlink00.at\
+ symlink01.at\
+ rmsymlink00.at\
+ mailnotify.at\
+ mailstats.at\
+ check-ok.at\
check-fail.at\
check-notify.at\
- check-ok.at\
inotify-ok.at\
- inotify-rmsymlink.at\
inotify-symlink.at\
+ inotify-rmsymlink.at\
inotify-unatt00.at\
inotify-unatt01.at\
- notify-upl.at\
- mailstats.at\
- rmsymlink00.at\
- symlink00.at\
- symlink01.at\
- testsuite.at\
- upload.at\
- upload-dry.at\
- upl11.at\
- upl12f.at\
- upl12t.at\
unp00.at\
unp01.at\
+ unp02.at\
unp-idle.at\
version.at
@@ -89,7 +91,7 @@ check-local: atconfig atlocal $(TESTSUITE)
#installcheck-local:
# $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
-check_PROGRAMS = bkupname cwdrepl wyinit wyasync wyclt
+check_PROGRAMS = bkupname cwdrepl wyinit wyasync wyclt chargen
AM_CPPFLAGS = \
@GRECS_INCLUDES@ \
-I$(top_srcdir)/include\
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 6102995..0d7c732 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -8,66 +8,130 @@ XFAILFILE=$abs_builddir/.badversion
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=dest
WY_TESTDIR=@abs_top_builddir@/tests
+WY_CONFSRC=@abs_top_srcdir@/tests/etc
+WY_CONFDST=$WY_TESTDIR/etc
+WY_PROJECTDB=$WY_CONFSRC/project
WY_MAILUTILS=@WY_MAILUTILS@
WY_INOTIFY=@WY_INOTIFY@
-MKDIR_P="@MKDIR_P@"
+WY_MODDIR=@abs_top_builddir@/modules/mailutils
-if test -w /; then
- WY_FORCE=--force
-else
- WY_FORCE=
-fi
+GPG="@GPG@ --quiet --no-permission-warning --batch "
+GNUPGHOME=$WY_CONFDST/gnupg
+export GNUPGHOME
ulimit -c unlimited
-wydawca_expandmeta() {
- 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
-}
+# #####################################
+# Utility functions
+# #####################################
-wydawca_config() {
- wydawca_expandmeta $WY_CONFSRC/${1}in $1
- wyinit $1
+# wy_project_lookup PROJECT WHAT
+wy_project_lookup() {
+ test $# -eq 2 || echo >&2 "wy_project_lookup: bad number of arguments"
+ local n
+ case $2 in
+ PROJECT_NAME) n=1;;
+ REAL_NAME) n=2;;
+ EMAIL) n=3;;
+ COMMENT) n=4;;
+ esac
+ grep "^$1:" $WY_PROJECTDB | cut -d: -f$n
}
+
+# wy_create_directive [-v X.Y] [-u USER] FILENAME PROJECT [DIRECTIVE: VALUE ...]
+wy_create_directive() {
+ local version user
+ while [ $# -ne 0 ]
+ do
+ case $1 in
+ -v) version=$2
+ shift 2;;
+ -u) user=$2
+ shift 2;;
+ --) shift
+ break;;
+ *) break
+ esac
+ done
-wydawca_upload() {
- 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"
+ : ${version:=1.2}
+
+ local filename="$1.directive" project=$2
+ shift 2
+ if [ $(( $# % 2 )) -ne 0 ]; then
+ echo >&2 "wy_create_directive: odd number of arguments"
+ exit 1
fi
+ (echo "version: $version"
+ echo "directory: $project"
+ while [ $# -gt 0 ]
+ do
+ echo "$1 $2"
+ shift 2
+ done) > $filename
+ rm -f $filename.asc
+ : ${user:=$(wy_project_lookup $project REAL_NAME)}
+ rm -f $filename.asc
+ $GPG --clearsign -u "$user" -o $filename.asc $filename
+ rm $filename
}
-wydawca_cmp() {
- p=$1
- shift
- for file in $@
+# wy_genfile [-u USER] [-l SIZE] PROJECT NAME
+wy_genfile() {
+ local length user
+ while [ $# -ne 0 ]
do
- cmp "$WY_DISTDIR/$file" "$WY_DST/$p/$file" || exit 1
+ case $1 in
+ -l) length="-l $2"
+ shift 2;;
+ -u) user=$2
+ shift 2;;
+ --) shift
+ break;;
+ *) break
+ esac
done
+
+ local project=$1 filename=$2
+ chargen $length > $filename
+
+ : ${user:=$(wy_project_lookup $project REAL_NAME)}
+ rm -f $filename.sig
+ $GPG -ba -o $filename.sig $filename
}
-wydawca_cmparc() {
- p=$1
- shift
- for file in $@
+# wy_create_upload [-u USER] [-l SIZE] PROJECT NAME [DIRECTIVE: VALUE...]
+wy_create_upload() {
+ local length_option user_option
+ while [ $# -ne 0 ]
do
- cmp "$WY_DISTDIR/$file" "$WY_DST/$p/archive/$file" || exit 1
+ case $1 in
+ -l)
+ length_option="$1 $2"
+ shift 2;;
+ -u)
+ user_option="$1 $2"
+ shift 2;;
+ --) shift
+ break;;
+ *) break
+ esac
done
+ local project=$1 filename=$2
+ shift 2
+ wy_genfile $length_option $user_option $project $filename
+ wy_create_directive $user_option $filename $project\
+ filename: $(basename $filename)\
+ "$@"
+}
+
+wy_config_head() {
+ cat <<EOF
+pidfile $PWD/wydawca.pid;
+statistics all;
+umask 022;
+create-directories yes;
+#include "$WY_CONFDST/database.cf"
+EOF
}
diff --git a/tests/chargen.c b/tests/chargen.c
new file mode 100644
index 0000000..13ef8f5
--- a/dev/null
+++ b/tests/chargen.c
@@ -0,0 +1,79 @@
+/*
+ NAME
+ chargen - generate a stream of characters
+
+ SYNOPSIS
+ chargen [-c C] [-l LEN] [-p] [-s N]
+
+ DESCRIPTION
+ Produces on standard output a stream of characters. The stream consists
+ of all 256 characters repeated cyclically until total number of characters
+ reaches 4096 (or LEN).
+
+ OPTIONS
+ -c C Start from ASCII character C
+
+ -l LEN
+ Stop when LEN characters have been generated.
+
+ -p Produce only printable characters
+
+ -s N Start from character with ordinal number N
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <unistd.h>
+#include <errno.h>
+#include <ctype.h>
+
+int
+main(int argc, char **argv)
+{
+ int c;
+ int start = 0;
+ int mod = UCHAR_MAX;
+ size_t i, len = 4096;
+ int printable = 0;
+ char *p;
+
+ while ((c = getopt(argc, argv, "cl:ps:")) != EOF) {
+ switch (c) {
+ case 'c':
+ start = optarg[0];
+ break;
+ case 'p':
+ printable = 1;
+ break;
+ case 's':
+ start = atoi(optarg) % UCHAR_MAX;
+ break;
+ case 'l':
+ errno = 0;
+ len = strtoul(optarg, &p, 10);
+ if (*p) {
+ fprintf(stderr, "bad length (near %s)", p);
+ exit(1);
+ } else if (errno) {
+ perror("bad length");
+ exit(1);
+ }
+ break;
+ default:
+ exit(2);
+ }
+ }
+
+ if (printable && !isprint(start))
+ do {
+ start = (start + 1) % mod;
+ } while (printable && !isprint(start));
+
+ for (i = 0; i < len; i++) {
+ putchar(start);
+ do {
+ start = (start + 1) % mod;
+ } while (printable && !isprint(start));
+ }
+ return 0;
+}
diff --git a/tests/check-fail.at b/tests/check-fail.at
index 268ca47..4c4b1c9 100644
--- a/tests/check-fail.at
+++ b/tests/check-fail.at
@@ -16,15 +16,28 @@
AT_SETUP([Verification test failure])
AT_KEYWORDS([uploads check-test check-fail])
-
-AT_DATA([experr],
+AT_CHECK_UPLOAD([
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+ check-script "exit 1";
+}
+],
+[wy_create_upload conversion upload/conversion-1.1.tar
+cp -a upload orig
+set -e
+wydawca --no-preproc -c wydawca.cf 2>err
+cat err | cwdrepl >&2
+],
+[0],
+[],
[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 ./source/fail/file
-wydawca: [[NOTICE]] removing ./source/fail/file.sig
-wydawca: [[NOTICE]] removing ./source/fail/file.directive.asc
+wydawca: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
+wydawca: [[ERR]] spool check script for conversion-1.1.tar@test returned 1
+wydawca: [[NOTICE]] removing ./upload/conversion-1.1.tar
+wydawca: [[NOTICE]] removing ./upload/conversion-1.1.tar.sig
+wydawca: [[NOTICE]] removing ./upload/conversion-1.1.tar.directive.asc
wydawca: [[INFO]] errors: 1
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -41,16 +54,6 @@ wydawca: [[INFO]] symlinks removed: 0
wydawca: [[INFO]] check failures: 1
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
+AT_CLEANUP
-AT_CHECK([
-wydawca_config wydawca.cf
-wydawca_upload fail file
-
-wydawca $WY_FORCE --no-preproc -c wydawca.cf 2>err
-cat err | cwdrepl >&2
-],
-[0],
-[],
-[experr])
-AT_CLEANUP
diff --git a/tests/check-notify.at b/tests/check-notify.at
index 298ebd0..63a00a4 100644
--- a/tests/check-notify.at
+++ b/tests/check-notify.at
@@ -17,14 +17,67 @@
AT_SETUP([Verification test failure notification])
AT_KEYWORDS([uploads check-test check-fail check-fail-notify notify])
-AT_DATA([experr],
+AT_CHECK_UPLOAD([
+module-prepend-load-path "$WY_MODDIR";
+module mailutils mod_mailutils.la;
+module-init mailutils {
+ admin-address "root@localhost";
+ from-address "wydawca-noreply@localhost";
+ mailer "| $WY_TESTDIR/nullmail -o $PWD/mail.out -F \${sender} \${rcpt}";
+}
+
+#include "$WY_CONFSRC/notify.cf"
+
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+ check-script <<EOT
+echo WYDAWCA_SPOOL=\$WYDAWCA_SPOOL
+echo WYDAWCA_SOURCE=\$WYDAWCA_SOURCE
+echo WYDAWCA_DEST=\$WYDAWCA_DEST
+echo WYDAWCA_URL=\$WYDAWCA_URL
+echo WYDAWCA_TRIPLET_BASE=\$WYDAWCA_TRIPLET_BASE
+echo WYDAWCA_DIST_FILE=\$WYDAWCA_DIST_FILE
+exit 1
+EOT;
+}
+],
+[wy_create_upload conversion upload/conversion-1.1.tar
+cp -a upload orig
+set -e
+wydawca --no-preproc -c wydawca.cf 2>err
+cat err | cwdrepl >&2
+cat mail.out | cwdrepl
+],
+[0],
+[From wydawca-noreply@localhost
+From: wydawca-noreply@localhost
+To: "Wydawca tester for the Conversion project" <jeannot@example.com>
+Subject: conversion-1.1.tar rejected
+
+Your upload of conversion-1.1.tar has been rejected by the distribution
+verification procedure with the following diagnostics:
+
+WYDAWCA_SPOOL=test
+WYDAWCA_SOURCE=./upload
+WYDAWCA_DEST=./dest
+WYDAWCA_URL=ftp://wydawca.test
+WYDAWCA_TRIPLET_BASE=conversion-1.1.tar
+WYDAWCA_DIST_FILE=conversion-1.1.tar
+
+Please fix the tarball and resubmit.
+
+Regards,
+Wydawca
+The Project Submission Robot
+],
[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 ./source/fail/file
-wydawca: [[NOTICE]] removing ./source/fail/file.sig
-wydawca: [[NOTICE]] removing ./source/fail/file.directive.asc
+wydawca: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
+wydawca: [[ERR]] spool check script for conversion-1.1.tar@test returned 1
+wydawca: [[NOTICE]] removing ./upload/conversion-1.1.tar
+wydawca: [[NOTICE]] removing ./upload/conversion-1.1.tar.sig
+wydawca: [[NOTICE]] removing ./upload/conversion-1.1.tar.directive.asc
wydawca: [[INFO]] errors: 1
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -41,44 +94,6 @@ wydawca: [[INFO]] symlinks removed: 0
wydawca: [[INFO]] check failures: 1
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
+AT_CLEANUP
-AT_DATA([expout],
-[From wydawca-noreply@localhost
-From: wydawca-noreply@localhost
-To: "Wydawca Test User" <gray@localhost>
-Subject: file rejected
-
-Your upload of file has been rejected by the distribution
-verification procedure with the following diagnostics:
-
-WYDAWCA_SPOOL=ckfail
-WYDAWCA_SOURCE=./source/fail
-WYDAWCA_DEST=./dest
-WYDAWCA_URL=ftp://wydawca.ckfail
-WYDAWCA_TRIPLET_BASE=file
-WYDAWCA_DIST_FILE=file
-
-Please fix the tarball and resubmit.
-
-Regards,
-Wydawca
-The Project Submission Robot
-])
-
-AT_CHECK([
-AT_MAILUTILS_PREREQ
-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 $WY_FORCE --no-preproc -c wydawca.cf 2>err || exit $?
-cat err | cwdrepl >&2
-cat mail.out | cwdrepl
-],
-[0],
-[expout],
-[experr])
-AT_CLEANUP
diff --git a/tests/check-ok.at b/tests/check-ok.at
index 11ee9a1..a7090da 100644
--- a/tests/check-ok.at
+++ b/tests/check-ok.at
@@ -16,11 +16,25 @@
AT_SETUP([Verification test success])
AT_KEYWORDS([uploads check-test check-success check-ok])
-
-AT_DATA([experr],
+AT_CHECK_UPLOAD([
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+ check-script "exit 0";
+}
+],
+[wy_create_upload conversion upload/conversion-1.1.tar
+cp -a upload orig
+set -e
+wydawca --no-preproc -c wydawca.cf
+cmp orig/conversion-1.1.tar dest/conversion/conversion-1.1.tar
+cmp orig/conversion-1.1.tar.sig dest/conversion/conversion-1.1.tar.sig
+],
+[0],
+[],
[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: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -37,16 +51,6 @@ wydawca: [[INFO]] symlinks removed: 0
wydawca: [[INFO]] check failures: 0
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
+AT_CLEANUP
-AT_CHECK([
-wydawca_config wydawca.cf
-wydawca_upload ok file
-wydawca $WY_FORCE --no-preproc -c wydawca.cf 2>err|| exit $?
-cat err | cwdrepl >&2
-wydawca_cmp proj file file.sig
-],
-[0],
-[],
-[experr])
-AT_CLEANUP
diff --git a/tests/dist/file b/tests/dist/file
deleted file mode 100644
index 2635c5c..0000000
--- a/tests/dist/file
+++ b/dev/null
@@ -1 +0,0 @@
-This is a test file for Wydawca testsuite.
diff --git a/tests/dist/file.directive.asc b/tests/dist/file.directive.asc
deleted file mode 100644
index 0f40f6f..0000000
--- a/tests/dist/file.directive.asc
+++ b/dev/null
@@ -1,14 +0,0 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-version: 1.1
-directory: proj
-comment: Gnupload for Wydawca testsuite
-filename: file
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.7 (GNU/Linux)
-
-iD8DBQFJnExlCZA3/2YT9iMRAgm7AJ9SLO/vihu3PeAwyRQsJp85NVC9swCdE+FQ
-SF9/JnHygja6qb5KRZEleuw=
-=RjYY
------END PGP SIGNATURE-----
diff --git a/tests/dist/file.sig b/tests/dist/file.sig
deleted file mode 100644
index 31cdef1..0000000
--- a/tests/dist/file.sig
+++ b/dev/null
@@ -1,7 +0,0 @@
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.7 (GNU/Linux)
-
-iD8DBQBJnExlCZA3/2YT9iMRAjDIAKCSt2MbRo8g9P9y/u9WZp1tGlVShwCeI7K+
-3G2UCTc/xlj200mHP2+B84M=
-=UO+/
------END PGP SIGNATURE-----
diff --git a/tests/dist/file12f.directive.asc b/tests/dist/file12f.directive.asc
deleted file mode 100644
index 11b206d..0000000
--- a/tests/dist/file12f.directive.asc
+++ b/dev/null
@@ -1,15 +0,0 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-version: 1.2
-directory: proj
-comment: Gnupload for Wydawca testsuite
-filename: file
-replace: false
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.9 (GNU/Linux)
-
-iEYEARECAAYFAk/B+FwACgkQCZA3/2YT9iN1CQCgh9sbdy1zz6o6jTJRGXAbjClq
-jvoAn3wcsnvIzx2vZchPMSfpJ3ZaPV1f
-=g4s4
------END PGP SIGNATURE-----
diff --git a/tests/dist/file12t.directive.asc b/tests/dist/file12t.directive.asc
deleted file mode 100644
index 921ca1e..0000000
--- a/tests/dist/file12t.directive.asc
+++ b/dev/null
@@ -1,15 +0,0 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-version: 1.2
-directory: proj
-comment: Gnupload for Wydawca testsuite
-filename: file
-replace: true
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.9 (GNU/Linux)
-
-iEYEARECAAYFAk/B+GAACgkQCZA3/2YT9iMwzgCgzIWjeAwRlI0aLgUAo8XafrId
-qLsAoIQp2r63b+WxDdvwDrvXBwtQJq1x
-=t6tj
------END PGP SIGNATURE-----
diff --git a/tests/dist/rmsymlink.directive.asc b/tests/dist/rmsymlink.directive.asc
deleted file mode 100644
index e6a520e..0000000
--- a/tests/dist/rmsymlink.directive.asc
+++ b/dev/null
@@ -1,14 +0,0 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-version: 1.2
-directory: proj
-comment: remove symlink
-rmsymlink: file-latest
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEARECAAYFAl6UodIACgkQCZA3/2YT9iNb7wCgjHrB9xDfdndQISqF+SwQbeJi
-PVAAoKlzBCycNslZ4bo7h36Nenfv3k9u
-=CTgS
------END PGP SIGNATURE-----
diff --git a/tests/dist/symlink.directive.asc b/tests/dist/symlink.directive.asc
deleted file mode 100644
index 4654f48..0000000
--- a/tests/dist/symlink.directive.asc
+++ b/dev/null
@@ -1,14 +0,0 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-version: 1.2
-directory: proj
-comment: create a symlink
-symlink: file file-latest
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1
-
-iEYEARECAAYFAl6UhygACgkQCZA3/2YT9iOH3wCgvJmS3Q5FcLQvhwZisDzNCQGS
-klQAn3KHpEHp1YjBV3U2tvSAcGhYUwd5
-=vx2j
------END PGP SIGNATURE-----
diff --git a/tests/upload.at b/tests/dry_run00.at
index 5eb4e64..b8202fd 100644
--- a/tests/upload.at
+++ b/tests/dry_run00.at
@@ -1,4 +1,4 @@
-# Check working uploads -*- Autotest -*-
+# Check dry-run uploads -*- Autotest -*-
# Copyright (C) 2009-2012, 2017, 2019-2020 Sergey Poznyakoff
#
# Wydawca is free software; you can redistribute it and/or modify
@@ -13,13 +13,25 @@
#
# You should have received a copy of the GNU General Public License
# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
-
-AT_SETUP([Simple upload])
-
-AT_DATA([experr],
+AT_SETUP([Dry-run upload])
+AT_KEYWORDS([upload upload-single upload-success dry-run])
+AT_CHECK_UPLOAD([
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[wy_create_upload conversion upload/conversion-1.1.tar \
+ comment: "Dry-run upload"
+set -e
+wydawca --no-preproc --dry-run --debug=0 -c wydawca.cf
+],
+[0],
+[],
[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: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
+wydawca: [[NOTICE]] conversion-1.1.tar.directive.asc: COMMENT: Dry-run upload
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -36,15 +48,5 @@ wydawca: [[INFO]] symlinks removed: 0
wydawca: [[INFO]] check failures: 0
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-
-AT_CHECK([
-wydawca_config wydawca.cf
-wydawca_upload test file
-wydawca $WY_FORCE --no-preproc -c wydawca.cf || exit $?
-wydawca_cmp proj file file.sig
-],
-[0],
-[],
-[experr])
-
AT_CLEANUP
+
diff --git a/tests/dry_run01.at b/tests/dry_run01.at
new file mode 100644
index 0000000..387a9da
--- a/dev/null
+++ b/tests/dry_run01.at
@@ -0,0 +1,83 @@
+# Check dry-run uploads -*- Autotest -*-
+# Copyright (C) 2009-2012, 2017, 2019-2020 Sergey Poznyakoff
+#
+# Wydawca 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.
+#
+# Wydawca 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 Wydawca. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Failed upload])
+AT_KEYWORDS([upload upload-single upload-failure dry-run])
+AT_CHECK_UPLOAD([
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[wy_create_upload -u forese@example.com conversion upload/conversion-1.1.tar \
+ comment: "Dry-run upload"
+set -e
+wydawca --no-preproc --dry-run --debug=0 -c wydawca.cf 2>err
+
+# FIXME: The incomplete triplets count can be set to 1 if the directive
+# file is seen first. In this case it is parsed early, found to be signed
+# by wrong person (which also raises the bad signatures and access violation
+# attempts counts) and the corresponding triplet is removed. Then, the
+# archive and signature files are read and combined into a single inclomplete
+# triplet. Incomplete because the directive part has already been dismissed.
+# This triplet is detected at the end of the run.
+#
+# If, on the other hand, the archive and signature were read first and the
+# directive file last, then the completed triplet would be thrown out and
+# incomplete triplet count would remain 0.
+#
+# Ways out:
+# 1. Detain the triplet in table until it is completed and only then
+# verify the signature. This will always produce the second case.
+# However, it implies parsing the signature file early. Actually,
+# that's the way wydawca operates now. However, although it seemed
+# a nice idea at the time, now I incline to the second solution.
+# 2. Verify the triplet as soon as the directive file is read. Parse
+# the directive only if the signature passes verification. Otherwise,
+# drop it. This is pretty similar to how wydawca operates now, except
+# that the directive file would be parsed only if verified. That seems
+# to be an advantage, since that's what the signature is for, in the
+# first place. Secondly, that would allow to use right GPGME function
+# for extracting the file content, instead of feedling with it manually.
+# The drawback is that processing of badly signed directives would
+# sometimes produce false incomplete triplets. The only fix is to defer
+# triplet processing to the end of directory scan, which implies a
+# memory usage overhead.
+sed -e 's/incomplete triplets: 1/incomplete triplets: 0/' err >&2
+],
+[0],
+[],
+[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
+wydawca: [[ERR]] No public key
+wydawca: [[ERR]] invalid signature for conversion-1.1.tar
+wydawca: [[INFO]] errors: 2
+wydawca: [[INFO]] warnings: 0
+wydawca: [[INFO]] bad signatures: 1
+wydawca: [[INFO]] access violation attempts: 1
+wydawca: [[INFO]] complete triplets: 0
+wydawca: [[INFO]] incomplete triplets: 0
+wydawca: [[INFO]] bad triplets: 0
+wydawca: [[INFO]] expired triplets: 0
+wydawca: [[INFO]] triplet successes: 0
+wydawca: [[INFO]] files uploaded: 0
+wydawca: [[INFO]] files archived: 0
+wydawca: [[INFO]] symlinks created: 0
+wydawca: [[INFO]] symlinks removed: 0
+wydawca: [[INFO]] check failures: 0
+wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
+])
+AT_CLEANUP
+
diff --git a/tests/upl12t.at b/tests/dry_run02.at
index 634cd56..7dcf8f2 100644
--- a/tests/upl12t.at
+++ b/tests/dry_run02.at
@@ -1,4 +1,4 @@
-# Check working uploads -*- Autotest -*-
+# Check dry-run uploads -*- Autotest -*-
# Copyright (C) 2009-2012, 2017, 2019-2020 Sergey Poznyakoff
#
# Wydawca is free software; you can redistribute it and/or modify
@@ -13,46 +13,39 @@
#
# You should have received a copy of the GNU General Public License
# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
-
-AT_SETUP([Implicit archivation enabled (version 1.2)])
-AT_KEYWORDS([upl12t])
-
-AT_DATA([experr],
+AT_SETUP([Incomplete triplet])
+AT_KEYWORDS([upload upload-single upload-inclomplete dry-run])
+AT_CHECK_UPLOAD([
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[wy_create_upload conversion upload/conversion-1.1.tar \
+ comment: "Dry-run upload"
+rm upload/conversion-1.1.tar.sig
+wydawca --no-preproc --dry-run --debug=0 -c wydawca.cf
+],
+[0],
+[],
[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
-wydawca: [[NOTICE]] file.directive.asc: VERSION: 1.2
-wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite
+wydawca: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
wydawca: [[INFO]] access violation attempts: 0
-wydawca: [[INFO]] complete triplets: 1
-wydawca: [[INFO]] incomplete triplets: 0
+wydawca: [[INFO]] complete triplets: 0
+wydawca: [[INFO]] incomplete triplets: 1
wydawca: [[INFO]] bad triplets: 0
wydawca: [[INFO]] expired triplets: 0
-wydawca: [[INFO]] triplet successes: 1
-wydawca: [[INFO]] files uploaded: 2
-wydawca: [[INFO]] files archived: 2
+wydawca: [[INFO]] triplet successes: 0
+wydawca: [[INFO]] files uploaded: 0
+wydawca: [[INFO]] files archived: 0
wydawca: [[INFO]] symlinks created: 0
wydawca: [[INFO]] symlinks removed: 0
wydawca: [[INFO]] check failures: 0
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-
-AT_CHECK([
-wydawca_config wydawca.cf
-mkdir dest/proj
-cp "$WY_DISTDIR/file" dest/proj
-cp "$WY_DISTDIR/file.sig" dest/proj
-
-wydawca_upload test file file12t.directive.asc
-
-wydawca $WY_FORCE --no-preproc -c wydawca.cf 2>err || exit $?
-cat err | cwdrepl >&2
-wydawca_cmp proj file file.sig
-wydawca_cmparc proj file file.sig
-],
-[0],
-[],
-[experr])
-
AT_CLEANUP
+
diff --git a/tests/etc/.gitignore b/tests/etc/.gitignore
index 9176bae..75b8e00 100644
--- a/tests/etc/.gitignore
+++ b/tests/etc/.gitignore
@@ -1,3 +1,2 @@
-*.gpg
-random_seed
+gnupg
*.cf
diff --git a/tests/etc/Makefile.am b/tests/etc/Makefile.am
index 2f572d1..72edb5d 100644
--- a/tests/etc/Makefile.am
+++ b/tests/etc/Makefile.am
@@ -14,19 +14,25 @@
# You should have received a copy of the GNU General Public License
# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
-GPGFILES = secring.gpg pubring.gpg
-noinst_DATA = @WYDAWCA_GPGFILES@
-
EXTRA_DIST = \
- pubring.asc\
- secring.asc\
- wydawca.cfin\
- notify.cfin\
+ dbgen.sh\
+ keygen.sh\
+ project\
+ notify.cf\
mailstats.cfin
-GPG_FLAGS = --quiet --no-permission-warning --homedir .
-pubring.gpg secring.gpg: $(srcdir)/pubring.asc $(srcdir)/secring.asc
- $(GPG) $(GPG_FLAGS) --import < $(srcdir)/pubring.asc
- $(GPG) $(GPG_FLAGS) --allow-secret-key-import --import < $(srcdir)/secring.asc
+if COND_GPG2
+noinst_DATA = gnupg database.cf
+endif
+
+gnupg: keygen.sh Makefile.am
+ $(AM_V_GEN)$(SHELL) $(srcdir)/keygen.sh --gpg $(GPG) --homedir gnupg $(srcdir)/project
+
+database.cf: dbgen.sh Makefile.am
+ $(AM_V_GEN)$(SHELL) $(srcdir)/dbgen.sh -o $@ \
+ --gpg $(GPG) --homedir gnupg $(srcdir)/project
+
+DISTCLEANFILES=database.cf
+distclean-am: clean-am distclean-generic
+ rm -rf gnupg
-DISTCLEANFILES = *.gpg *.gpg~ random_seed
diff --git a/tests/etc/dbgen.sh b/tests/etc/dbgen.sh
new file mode 100644
index 0000000..fa2db73
--- a/dev/null
+++ b/tests/etc/dbgen.sh
@@ -0,0 +1,93 @@
+#!/bin/sh
+# Usage: dbgen.sh [--gpg GPG] [--homedir DIR] INFILE
+
+GNUPGHOME=gnupg
+export GNUPGHOME
+
+while [ $# -ne 0 ]
+do
+ case $1 in
+ --gpg)
+ GPG=$2
+ shift 2
+ ;;
+ --homedir)
+ GNUPGHOME=$2
+ shift 2
+ ;;
+ --output)
+ output=$2
+ shift 2
+ ;;
+ --output=*)
+ output=${1##--output=}
+ shift
+ ;;
+ -o)
+ output=$2
+ shift 2
+ ;;
+ -o*)
+ output=${1##-o}
+ shift
+ ;;
+ --)
+ shift
+ ;;
+ --*)
+ echo >&2 "$0: unrecognized option $1"
+ exit 1
+ ;;
+ *) break
+ esac
+done
+
+if [ $# -eq 1 ]; then
+ projects_db=$1
+else
+ echo >&2 "$0: exactly one argument must be given"
+ exit 1
+fi
+
+if [ -n "$output" ]; then
+ exec >$output
+fi
+
+cat <<\EOF
+dictionary project-owner {
+ type builtin;
+ query "${project}";
+ params ("/exact",
+EOF
+
+oIFS=$IFS
+IFS=":"
+while read project realname email comment
+do
+ IFS=$oIFS
+ echo " \"$project\", \"$email\", \"$realname\","
+ IFS=":"
+done < $projects_db | sed -e '$s/,$/);/'
+IFS=$oIFS
+
+echo "}"
+
+cat <<\EOF
+dictionary project-uploader {
+ type builtin;
+ query "${project}";
+ params ("/exact",
+EOF
+
+IFS=":"
+while read project realname email comment
+do
+ IFS=$oIFS
+ user=${email%%@*}
+ echo " \"$project\", \"$user\", \"$comment\", \"$email\","
+ ${GPG:-gpg2} --quiet --no-permission-warning --batch \
+ --export --armor "$realname" |
+ sed -r -e 's/.*/"&\\n"/' -e '$s/$/,/'
+ IFS=":"
+done < $projects_db | sed -e '$s/,$/);/'
+echo "}"
diff --git a/tests/etc/keygen.sh b/tests/etc/keygen.sh
new file mode 100644
index 0000000..76099c3
--- a/dev/null
+++ b/tests/etc/keygen.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+# Usage: keygen.sh [--gpg GPG] --homedir DIR [INFILE]
+
+unset GNUPGHOME
+while [ $# -ne 0 ]
+do
+ case $1 in
+ --gpg)
+ GPG=$2
+ shift 2
+ ;;
+ --homedir)
+ GNUPGHOME=$2
+ shift 2
+ ;;
+ --)
+ shift
+ ;;
+ --*)
+ echo >&2 "$0: unrecognized option $1"
+ exit 1
+ ;;
+ *) break
+ esac
+done
+
+if [ $# -eq 1 ]; then
+ exec <$1
+fi
+
+: ${GNUPGHOME:?the --homedir option must be given}
+if [ -d $GNUPGHOME ]; then
+ rm -rf $GNUPGHOME/*
+else
+ mkdir $GNUPGHOME
+fi
+export GNUPGHOME
+
+oIFS=$IFS
+IFS=':'
+while read project realname email comment
+do
+ IFS=$oIFS
+ cat <<EOF
+%echo Generating OpenPGP key for user $realname
+Key-Type: RSA
+Key-Length: 2048
+Subkey-Type: ELG-E
+Subkey-Length: 2048
+Name-Real: $realname
+Name-Comment: $comment
+Name-Email: $email
+Expire-Date: 0
+%no-protection
+%transient-key
+%commit
+EOF
+ IFS=':'
+done | ${GPG:-gpg2} --quiet --no-permission-warning --batch --gen-key
diff --git a/tests/etc/notify.cfin b/tests/etc/notify.cf
index 64c09b3..9e3a820 100644
--- a/tests/etc/notify.cfin
+++ b/tests/etc/notify.cf
@@ -14,15 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
-module-prepend-load-path "@WY_MODDIR@";
-module mailutils mod_mailutils.la;
-module-init mailutils {
- admin-address "root@localhost";
- from-address "wydawca-noreply@localhost";
-
- mailer "| @WY_TESTDIR@/nullmail -o @CWD@/mail.out -F ${sender} ${rcpt}";
-}
-
# Notify the user about successful uploads
notify-event {
event success;
diff --git a/tests/etc/project b/tests/etc/project
new file mode 100644
index 0000000..7bb9a7f
--- a/dev/null
+++ b/tests/etc/project
@@ -0,0 +1,4 @@
+conversion:Jeannot de Chevigny:jeannot@example.com:Wydawca tester for the Conversion project
+mugello:Forese da Rabatta:forese@example.com:The Mugello project
+dogana:Niccolo da Cignano:niccolo@example.com:Admin of the Dogana project
+falcon:Federigo degli Alberighi:federigo@example.com:The Falcon project
diff --git a/tests/etc/pubring.asc b/tests/etc/pubring.asc
deleted file mode 100644
index ba1f166..0000000
--- a/tests/etc/pubring.asc
+++ b/dev/null
@@ -1,30 +0,0 @@
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.4.7 (GNU/Linux)
-
-mQGhBEmZcTERBAD9sD9d3xhVHURwbLcHUHIK6LGSHAlFzKv4MSOk+6nJhdvbQfIV
-YAe6VZ8fTX8EX7f0Vw53or1mlBOZpMNeEHp/IejFwnT3pAF3xiHTwbmwJg+0RuKo
-dwfN0vO9xECj3/ZsBvSYbYty8Vmy2e8osrNdXAXd+8Z3xJ3reAWOujGj9wCg1qg5
-1LJgEIbPdZm0Iv43Pvdzbi8EAMlW6oZuBFuQXf0e2NceZKrZvGjFDWLgIgHvLmXb
-0d+7kmLgCwJ2J7byOAnKQ8eu/1+V3WYvYd6Scut3809J8Cx5KhEbwuZLx/V4yUUW
-S2SjFV4i+5qqvPwrgGezd5Cus5qxkOabXitG8EccQe0k8lhiRKLgt6zBftC+MgDX
-o4NwA/UZqm58F4jLuVDHbnz9Jv5/jfyduzg6UwGgU+IdE9eBpmzmVGdgVQixGFRW
-hIiDdCo6y4yvljBy6jaZVuwDc8jrVQDo8bo3EWkkcajXT+BVCpkSJAPLfDnKXJW0
-jXM9X/zNiZBNoEyx/qRUEvHO1irSffSZ1kiJMMGRaNN7T7jMtCxXeWRhd2NhIChU
-ZXN0c3VpdGUpIDxidWctd3lkYXdjYUBnbnUub3JnLnVhPohgBBMRAgAgBQJJmXEx
-AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQCZA3/2YT9iMLKQCgwpamuefh
-VAluEw4g+ym1sVi5nxsAn3X1MBePRzYgkJX7vloEwKql63FfuQINBEmZcTEQCACI
-jtyYxEdnXUHwLdQwkvlP7lBsTNn+ofO6Kyf7qMF+dY4PeE/IyO9orcj04iUZ038V
-8WpP1dWkiqXhxN/MQdPNKDcXGbOqtGz8FmsoHlS8lqRO0Tgz44K6hejHHx2gduZe
-uiKCbKjy12lpL5QmRO98Dk9h5M3uRQ8SoKVLzd93TFStDHrlFmialzWFLRidS9fB
-SXmlGQleNS3+WIL8YXr5t4oHIOL9Lq8ZOES4QtZ/vf0DSgJX9eR2vgCeevFlJmAt
-+8psU+cFCzxNb4gHsHcOTqR4H/aXnQp2g+q3pJaev41/V3oVc0ANKQbUV/0SLTK8
-2Ns7Z1+kV/tzsfA1vVmDAAMGB/49jdR1WSY1dX2aA3Ez3jd9EZL3qgYtsjPt2ZgY
-ySFI0gDSniKYayUoDTC7dQ3GYiKhhupiFeIgEbGkKyGZIWbZCFwkqJOzdPWgPRNg
-JXB9hKRGwViZVbvAhcHec83IqGjrndt3oQnlfMrLNR12KWsOpQRYJ8F4CMSNSsQx
-JsjkjStgy/A1zbzkVlgf50lY5sltcWuOYU66lqq63QlK+uwNt1bqIS62fvDNeQK6
-P2O3QX5lg75nEzdUmHyP+yTlSjHTPf7qaRx9UPpnf7r9t/IcjkXAMu6Y2LMgfbTA
-qVoOxiH7h8CeNXaVg8QF2cHGdwGLDvZ3X+Vtck/LjjdmHxiiiEkEGBECAAkFAkmZ
-cTECGwwACgkQCZA3/2YT9iOTCwCeNckYjNiatFHHlOqph3N5hYmix6MAnRPeCkG4
-BBXnlxcgH/vqaSpx7Fgr
-=gYgX
------END PGP PUBLIC KEY BLOCK-----
diff --git a/tests/etc/secring.asc b/tests/etc/secring.asc
deleted file mode 100644
index 28dd1d1..0000000
--- a/tests/etc/secring.asc
+++ b/dev/null
@@ -1,31 +0,0 @@
------BEGIN PGP PRIVATE KEY BLOCK-----
-Version: GnuPG v1.4.7 (GNU/Linux)
-
-lQG6BEmZcTERBAD9sD9d3xhVHURwbLcHUHIK6LGSHAlFzKv4MSOk+6nJhdvbQfIV
-YAe6VZ8fTX8EX7f0Vw53or1mlBOZpMNeEHp/IejFwnT3pAF3xiHTwbmwJg+0RuKo
-dwfN0vO9xECj3/ZsBvSYbYty8Vmy2e8osrNdXAXd+8Z3xJ3reAWOujGj9wCg1qg5
-1LJgEIbPdZm0Iv43Pvdzbi8EAMlW6oZuBFuQXf0e2NceZKrZvGjFDWLgIgHvLmXb
-0d+7kmLgCwJ2J7byOAnKQ8eu/1+V3WYvYd6Scut3809J8Cx5KhEbwuZLx/V4yUUW
-S2SjFV4i+5qqvPwrgGezd5Cus5qxkOabXitG8EccQe0k8lhiRKLgt6zBftC+MgDX
-o4NwA/UZqm58F4jLuVDHbnz9Jv5/jfyduzg6UwGgU+IdE9eBpmzmVGdgVQixGFRW
-hIiDdCo6y4yvljBy6jaZVuwDc8jrVQDo8bo3EWkkcajXT+BVCpkSJAPLfDnKXJW0
-jXM9X/zNiZBNoEyx/qRUEvHO1irSffSZ1kiJMMGRaNN7T7jMAACgyZlnaO3GvmSE
-ZrBEZDY5MBZJyGgKFrQsV3lkYXdjYSAoVGVzdHN1aXRlKSA8YnVnLXd5ZGF3Y2FA
-Z251Lm9yZy51YT6IYAQTEQIAIAUCSZlxMQIbAwYLCQgHAwIEFQIIAwQWAgMBAh4B
-AheAAAoJEAmQN/9mE/YjCykAoMKWprnn4VQJbhMOIPsptbFYuZ8bAJ919TAXj0c2
-IJCV+75aBMCqpetxX50CPQRJmXExEAgAiI7cmMRHZ11B8C3UMJL5T+5QbEzZ/qHz
-uisn+6jBfnWOD3hPyMjvaK3I9OIlGdN/FfFqT9XVpIql4cTfzEHTzSg3FxmzqrRs
-/BZrKB5UvJakTtE4M+OCuoXoxx8doHbmXroigmyo8tdpaS+UJkTvfA5PYeTN7kUP
-EqClS83fd0xUrQx65RZompc1hS0YnUvXwUl5pRkJXjUt/liC/GF6+beKByDi/S6v
-GThEuELWf739A0oCV/Xkdr4AnnrxZSZgLfvKbFPnBQs8TW+IB7B3Dk6keB/2l50K
-doPqt6SWnr+Nf1d6FXNADSkG1Ff9Ei0yvNjbO2dfpFf7c7HwNb1ZgwADBgf+PY3U
-dVkmNXV9mgNxM943fRGS96oGLbIz7dmYGMkhSNIA0p4imGslKA0wu3UNxmIioYbq
-YhXiIBGxpCshmSFm2QhcJKiTs3T1oD0TYCVwfYSkRsFYmVW7wIXB3nPNyKho653b
-d6EJ5XzKyzUddilrDqUEWCfBeAjEjUrEMSbI5I0rYMvwNc285FZYH+dJWObJbXFr
-jmFOupaqut0JSvrsDbdW6iEutn7wzXkCuj9jt0F+ZYO+ZxM3VJh8j/sk5Uox0z3+
-6mkcfVD6Z3+6/bfyHI5FwDLumNizIH20wKlaDsYh+4fAnjV2lYPEBdnBxncBiw72
-d1/lbXJPy443Zh8YogABUwfJqr9IlIvAnQAGKTGZf/5o0jVA2+M42kKHWkl7EtE+
-xmQHC0lW1oVydWETzIhJBBgRAgAJBQJJmXExAhsMAAoJEAmQN/9mE/YjkwsAn000
-qTmHvb87tb4gaYloh0hXnp8TAJ47dSwMRedgWlX4INTUhdbelZAM9w==
-=yYPX
------END PGP PRIVATE KEY BLOCK-----
diff --git a/tests/etc/wydawca.cfin b/tests/etc/wydawca.cfin
deleted file mode 100644
index 06461f7..0000000
--- a/tests/etc/wydawca.cfin
+++ b/dev/null
@@ -1,98 +0,0 @@
-# This file is part of Wydawca testsuite
-# Copyright (C) 2009-2012, 2017, 2019-2020 Sergey Poznyakoff
-#
-# Wydawca 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.
-#
-# Wydawca 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 Wydawca. If not, see <http://www.gnu.org/licenses/>.
-
-pidfile @CWD@/wydawca.pid;
-statistics all;
-
-umask 022;
-
-dictionary project-owner {
- type builtin;
- query "${project}";
- params ("/exact",
- "proj", "proj-owner@localhost", "Project Admin");
-}
-dictionary project-uploader {
- type builtin;
- query "${project}";
- params ("/exact",
- "proj", "gray", "Wydawca Test User", "gray@localhost",
-"-----BEGIN PGP PUBLIC KEY BLOCK-----\n"
-"Version: GnuPG v1.4.7 (GNU/Linux)\n"
-"\n"
-"mQGhBEmZcTERBAD9sD9d3xhVHURwbLcHUHIK6LGSHAlFzKv4MSOk+6nJhdvbQfIV\n"
-"YAe6VZ8fTX8EX7f0Vw53or1mlBOZpMNeEHp/IejFwnT3pAF3xiHTwbmwJg+0RuKo\n"
-"dwfN0vO9xECj3/ZsBvSYbYty8Vmy2e8osrNdXAXd+8Z3xJ3reAWOujGj9wCg1qg5\n"
-"1LJgEIbPdZm0Iv43Pvdzbi8EAMlW6oZuBFuQXf0e2NceZKrZvGjFDWLgIgHvLmXb\n"
-"0d+7kmLgCwJ2J7byOAnKQ8eu/1+V3WYvYd6Scut3809J8Cx5KhEbwuZLx/V4yUUW\n"
-"S2SjFV4i+5qqvPwrgGezd5Cus5qxkOabXitG8EccQe0k8lhiRKLgt6zBftC+MgDX\n"
-"o4NwA/UZqm58F4jLuVDHbnz9Jv5/jfyduzg6UwGgU+IdE9eBpmzmVGdgVQixGFRW\n"
-"hIiDdCo6y4yvljBy6jaZVuwDc8jrVQDo8bo3EWkkcajXT+BVCpkSJAPLfDnKXJW0\n"
-"jXM9X/zNiZBNoEyx/qRUEvHO1irSffSZ1kiJMMGRaNN7T7jMtCxXeWRhd2NhIChU\n"
-"ZXN0c3VpdGUpIDxidWctd3lkYXdjYUBnbnUub3JnLnVhPohgBBMRAgAgBQJJmXEx\n"
-"AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQCZA3/2YT9iMLKQCgwpamuefh\n"
-"VAluEw4g+ym1sVi5nxsAn3X1MBePRzYgkJX7vloEwKql63FfuQINBEmZcTEQCACI\n"
-"jtyYxEdnXUHwLdQwkvlP7lBsTNn+ofO6Kyf7qMF+dY4PeE/IyO9orcj04iUZ038V\n"
-"8WpP1dWkiqXhxN/MQdPNKDcXGbOqtGz8FmsoHlS8lqRO0Tgz44K6hejHHx2gduZe\n"
-"uiKCbKjy12lpL5QmRO98Dk9h5M3uRQ8SoKVLzd93TFStDHrlFmialzWFLRidS9fB\n"
-"SXmlGQleNS3+WIL8YXr5t4oHIOL9Lq8ZOES4QtZ/vf0DSgJX9eR2vgCeevFlJmAt\n"
-"+8psU+cFCzxNb4gHsHcOTqR4H/aXnQp2g+q3pJaev41/V3oVc0ANKQbUV/0SLTK8\n"
-"2Ns7Z1+kV/tzsfA1vVmDAAMGB/49jdR1WSY1dX2aA3Ez3jd9EZL3qgYtsjPt2ZgY\n"
-"ySFI0gDSniKYayUoDTC7dQ3GYiKhhupiFeIgEbGkKyGZIWbZCFwkqJOzdPWgPRNg\n"
-"JXB9hKRGwViZVbvAhcHec83IqGjrndt3oQnlfMrLNR12KWsOpQRYJ8F4CMSNSsQx\n"
-"JsjkjStgy/A1zbzkVlgf50lY5sltcWuOYU66lqq63QlK+uwNt1bqIS62fvDNeQK6\n"
-"P2O3QX5lg75nEzdUmHyP+yTlSjHTPf7qaRx9UPpnf7r9t/IcjkXAMu6Y2LMgfbTA\n"
-"qVoOxiH7h8CeNXaVg8QF2cHGdwGLDvZ3X+Vtck/LjjdmHxiiiEkEGBECAAkFAkmZ\n"
-"cTECGwwACgkQCZA3/2YT9iOTCwCeNckYjNiatFHHlOqph3N5hYmix6MAnRPeCkG4\n"
-"BBXnlxcgH/vqaSpx7Fgr\n"
-"=gYgX\n"
-"-----END PGP PUBLIC KEY BLOCK-----\n");
-}
-
-create-directories yes;
-
-spool test {
- url ftp://wydawca.test;
- source "@CWD@/source/test";
- destination "@CWD@/dest";
- archive directory {
- name "archive";
- };
-}
-
-spool ckfail {
- url ftp://wydawca.ckfail;
- source "@CWD@/source/fail";
- destination "@CWD@/dest";
- archive none;
- check-script <<EOT
-echo WYDAWCA_SPOOL=$WYDAWCA_SPOOL
-echo WYDAWCA_SOURCE=$WYDAWCA_SOURCE
-echo WYDAWCA_DEST=$WYDAWCA_DEST
-echo WYDAWCA_URL=$WYDAWCA_URL
-echo WYDAWCA_TRIPLET_BASE=$WYDAWCA_TRIPLET_BASE
-echo WYDAWCA_DIST_FILE=$WYDAWCA_DIST_FILE
-exit 1
-EOT;
-}
-
-spool ckok {
- url ftp://wydawca.ckok;
- source "@CWD@/source/ok";
- destination "@CWD@/dest";
- archive none;
- check-script "exit 0";
-}
diff --git a/tests/inotify-ok.at b/tests/inotify-ok.at
index 3b12ab2..b9ea8e1 100644
--- a/tests/inotify-ok.at
+++ b/tests/inotify-ok.at
@@ -17,10 +17,30 @@
AT_SETUP([Successful upload])
AT_KEYWORDS([uploads check-test check-success check-ok inotify inotify-ok])
-AT_DATA([experr],
+AT_WYDAWCA_INOTIFY_DAEMON(
+[spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[],
+[mkdir orig
+wy_create_upload conversion orig/conversion-1.1.tar
+cp orig/* upload
+while ! test -f $PWD/dest/conversion/conversion-1.1.tar \
+ && ! test -f $PWD@/dest/conversion/conversion-1.1.tar.sig
+do
+ sleep 1
+done
+],
+[cmp orig/conversion-1.1.tar dest/conversion/conversion-1.1.tar
+cmp orig/conversion-1.1.tar.sig dest/conversion/conversion-1.1.tar.sig
+],
+[0],
+[],
[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: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -39,17 +59,4 @@ wydawca: [[NOTICE]] shutting down on signal "Terminated"
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-AT_WYDAWCA_INOTIFY_DAEMON([],
-[wydawca_upload ok file
-while ! test -f @CWD@/dest/proj/file && ! test -f @CWD@/dest/proj/file.sig
-do
- sleep 1
-done
-],
-[wydawca_cmp proj file file.sig
-],
-[0],
-[],
-[experr])
-
AT_CLEANUP
diff --git a/tests/inotify-rmsymlink.at b/tests/inotify-rmsymlink.at
index 4c36a37..5af136d 100644
--- a/tests/inotify-rmsymlink.at
+++ b/tests/inotify-rmsymlink.at
@@ -17,10 +17,38 @@
AT_SETUP([Remove symlink])
AT_KEYWORDS([inotify rmsymlink inotify-rmsymlink])
-AT_DATA([experr],
+AT_WYDAWCA_DAEMON([
+AT_INOTIFY_PREREQ
+AT_SORT_PREREQ
+],
+[spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[mkdir dest/dogana
+wy_genfile dogana dest/dogana/dogana-0.file
+(cd dest/dogana &&
+ ln -sf dogana-0.file dogana.latest &&
+ ln -sf dogana-0.file.sig dogana.latest.sig)
+],
+[wy_create_directive upload/rmsymlink.directive.asc dogana \
+ rmsymlink: dogana.latest\
+ comment: "remove symlink"
+while test -f $PWD/dest/dogana/dogana.latest && \
+ test -f $PWD/dest/dogana/dogana.latest.sig
+do
+ sleep 1
+done
+],
+[find dest -type l | sort
+],
+[0],
+[],
[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
-wydawca: [[NOTICE]] rmsymlink.directive.asc: VERSION: 1.2
-wydawca: [[NOTICE]] rmsymlink.directive.asc: COMMENT: remove symlink
+wydawca: [[NOTICE]] rmsymlink.directive.asc.directive.asc: VERSION: 1.2
+wydawca: [[NOTICE]] rmsymlink.directive.asc.directive.asc: COMMENT: remove symlink
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -38,26 +66,4 @@ wydawca: [[INFO]] check failures: 0
wydawca: [[NOTICE]] shutting down on signal "Terminated"
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-
-AT_WYDAWCA_DAEMON([
-AT_INOTIFY_PREREQ
-AT_SORT_PREREQ
-],[mkdir dest/proj
-cp "$WY_DISTDIR/file" "$WY_DISTDIR/file.sig" dest/proj
-(cd dest/proj && ln -sf file file-latest && ln -sf file.sig file-latest.sig)
-],
-[cp "$WY_DISTDIR/rmsymlink.directive.asc" source/test
-while test -f @CWD@/dest/proj/file-latest && \
- test -f @CWD@/dest/proj/file-latest.sig
-do
- sleep 1
-done
-],
-[find dest -type l | sort
-],
-[0],
-[],
-[experr])
-
AT_CLEANUP
-
diff --git a/tests/inotify-symlink.at b/tests/inotify-symlink.at
index 5999cb6..0877552 100644
--- a/tests/inotify-symlink.at
+++ b/tests/inotify-symlink.at
@@ -17,10 +17,39 @@
AT_SETUP([Create symlink])
AT_KEYWORDS([inotify symlink inotify-symlink])
-AT_DATA([experr],
+AT_WYDAWCA_DAEMON([
+AT_SORT_PREREQ
+AT_INOTIFY_PREREQ],
+[spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[mkdir dest/dogana
+wy_genfile dogana dest/dogana/dogana-0.file
+],
+[wy_create_directive upload/symlink.directive.asc dogana \
+ symlink: "dogana-0.file dogana.latest" \
+ comment: "create a symlink"
+while ! test -f $PWD/dest/dogana/dogana.latest && \
+ ! test -f $PWD/dest/dogana/dogana.latest.sig
+do
+ sleep 1
+done
+],
+[find dest -type l | sort
+find dest -type l | sort | xargs -n 1 readlink
+],
+[0],
+[dest/dogana/dogana.latest
+dest/dogana/dogana.latest.sig
+dogana-0.file
+dogana-0.file.sig
+],
[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
-wydawca: [[NOTICE]] symlink.directive.asc: VERSION: 1.2
-wydawca: [[NOTICE]] symlink.directive.asc: COMMENT: create a symlink
+wydawca: [[NOTICE]] symlink.directive.asc.directive.asc: VERSION: 1.2
+wydawca: [[NOTICE]] symlink.directive.asc.directive.asc: COMMENT: create a symlink
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -39,29 +68,5 @@ wydawca: [[NOTICE]] shutting down on signal "Terminated"
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-AT_WYDAWCA_DAEMON([
-AT_SORT_PREREQ
-AT_INOTIFY_PREREQ],
-[mkdir dest/proj
-cp "$WY_DISTDIR/file" "$WY_DISTDIR/file.sig" dest/proj
-],
-[cp "$WY_DISTDIR/symlink.directive.asc" source/test
-while ! test -f @CWD@/dest/proj/file-latest && \
- ! test -f @CWD@/dest/proj/file-latest.sig
-do
- sleep 1
-done
-],
-[find dest -type l | sort
-find dest -type l | sort | xargs -n 1 readlink
-],
-[0],
-[dest/proj/file-latest
-dest/proj/file-latest.sig
-file
-file.sig
-],
-[experr])
-
AT_CLEANUP
diff --git a/tests/inotify-unatt00.at b/tests/inotify-unatt00.at
index e87a80d..d33ea27 100644
--- a/tests/inotify-unatt00.at
+++ b/tests/inotify-unatt00.at
@@ -17,10 +17,29 @@
AT_SETUP([Picking up unattended uploads])
AT_KEYWORDS([inotify unattended pickup inotify-unatt00])
-AT_DATA([experr],
+AT_WYDAWCA_INOTIFY_DAEMON(
+[spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[wy_create_upload conversion upload/conversion-1.1.tar
+cp -a upload orig
+],
+[while ! test -f $PWD/dest/conversion/conversion-1.1.tar && \
+ ! test -f $PWD/dest/conversion/conversion-1.1.tar.sig
+do
+ sleep 1
+done
+],
+[cmp orig/conversion-1.1.tar dest/conversion/conversion-1.1.tar
+cmp orig/conversion-1.1.tar.sig dest/conversion/conversion-1.1.tar.sig
+],
+[0],
+[],
[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: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -38,19 +57,5 @@ wydawca: [[INFO]] check failures: 0
wydawca: [[NOTICE]] shutting down on signal "Terminated"
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-
-AT_WYDAWCA_INOTIFY_DAEMON([
-wydawca_upload ok file
-],
-[while ! test -f @CWD@/dest/proj/file && ! test -f @CWD@/dest/proj/file.sig
-do
- sleep 1
-done
-],
-[wydawca_cmp proj file file.sig
-],
-[0],
-[],
-[experr])
AT_CLEANUP
diff --git a/tests/inotify-unatt01.at b/tests/inotify-unatt01.at
index 9451a92..70d516c 100644
--- a/tests/inotify-unatt01.at
+++ b/tests/inotify-unatt01.at
@@ -17,10 +17,31 @@
AT_SETUP([Picking up unattended split uploads])
AT_KEYWORDS([inotify unattended pickup inotify-unatt01])
-AT_DATA([experr],
+AT_WYDAWCA_INOTIFY_DAEMON(
+[spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[mkdir orig
+wy_create_upload conversion orig/conversion-1.1.tar
+cp orig/conversion-1.1.tar orig/conversion-1.1.tar.sig upload
+],
+[cp $PWD/orig/conversion-1.1.tar.directive.asc upload
+while ! test -f $PWD/dest/conversion/conversion-1.1.tar \
+ && ! test -f $PWD/dest/conversion/conversion-1.1.tar.sig
+do
+ sleep 1
+done
+],
+[cmp orig/conversion-1.1.tar dest/conversion/conversion-1.1.tar
+cmp orig/conversion-1.1.tar.sig dest/conversion/conversion-1.1.tar.sig
+],
+[0],
+[],
[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: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -39,22 +60,6 @@ wydawca: [[NOTICE]] shutting down on signal "Terminated"
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-AT_WYDAWCA_INOTIFY_DAEMON([
-cp "$WY_DISTDIR/file" "source/ok/$dir"
-cp "$WY_DISTDIR/file.sig" "source/ok/$dir"
-],
-[cp "$WY_DISTDIR/file.directive.asc" "source/ok"
-while ! test -f @CWD@/dest/proj/file && ! test -f @CWD@/dest/proj/file.sig
-do
- sleep 1
-done
-],
-[wydawca_cmp proj file file.sig
-],
-[0],
-[],
-[experr])
-
AT_CLEANUP
diff --git a/tests/notify-upl.at b/tests/mailnotify.at
index ab75370..6ac8c0b 100644
--- a/tests/notify-upl.at
+++ b/tests/mailnotify.at
@@ -16,80 +16,77 @@
AT_SETUP([Simple upload and notification])
AT_KEYWORDS([notify notify-upl])
+AT_CHECK_UPLOAD([
+module-prepend-load-path "$WY_MODDIR";
+module mailutils mod_mailutils.la;
+module-init mailutils {
+ admin-address "root@localhost";
+ from-address "wydawca-noreply@localhost";
+ mailer "| $WY_TESTDIR/nullmail -o $PWD/mail.out -F \${sender} \${rcpt}";
+}
-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: [[INFO]] errors: 0
-wydawca: [[INFO]] warnings: 0
-wydawca: [[INFO]] bad signatures: 0
-wydawca: [[INFO]] access violation attempts: 0
-wydawca: [[INFO]] complete triplets: 1
-wydawca: [[INFO]] incomplete triplets: 0
-wydawca: [[INFO]] bad triplets: 0
-wydawca: [[INFO]] expired triplets: 0
-wydawca: [[INFO]] triplet successes: 1
-wydawca: [[INFO]] files uploaded: 2
-wydawca: [[INFO]] files archived: 0
-wydawca: [[INFO]] symlinks created: 0
-wydawca: [[INFO]] symlinks removed: 0
-wydawca: [[INFO]] check failures: 0
-wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
-])
-
-AT_DATA([expout],
+#include "$WY_CONFSRC/notify.cf"
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[AT_MAILUTILS_PREREQ
+wy_create_upload conversion upload/conversion-1.1.tar
+cp -a upload orig
+set -e
+wydawca --no-preproc -c wydawca.cf
+cmp orig/conversion-1.1.tar dest/conversion/conversion-1.1.tar
+cmp orig/conversion-1.1.tar.sig dest/conversion/conversion-1.1.tar.sig
+sed -e 's,^-[[rwx-]]\{9\} '${USER}'.* \([[^ ][^ ]]*\)$,listing of \1,' mail.out
+],
+[0],
[From wydawca-noreply@localhost
From: wydawca-noreply@localhost
-To: "Project Admin" <proj-owner@localhost>
-Subject: Upload of proj successful
+To: "Jeannot de Chevigny" <jeannot@example.com>
+Subject: Upload of conversion successful
-Wydawca Test User (gray@localhost) successfully uploaded files
-for proj to ftp://wydawca.test/proj. Files uploaded:
+Wydawca tester for the Conversion project (jeannot@example.com) successfully uploaded files
+for conversion to ftp://wydawca.test/conversion. Files uploaded:
-listing of file
-listing of file.sig
+listing of conversion-1.1.tar
+listing of conversion-1.1.tar.sig
Regards,
Wydawca
The Project Submission Robot
From wydawca-noreply@localhost
From: wydawca-noreply@localhost
-To: "Wydawca Test User" <gray@localhost>
-Subject: Upload of proj successful
+To: "Wydawca tester for the Conversion project" <jeannot@example.com>
+Subject: Upload of conversion successful
-Upload of proj to ftp://wydawca.test/proj finished successfully.
+Upload of conversion to ftp://wydawca.test/conversion finished successfully.
Files uploaded:
-listing of file
-listing of file.sig
+listing of conversion-1.1.tar
+listing of conversion-1.1.tar.sig
Regards,
Wydawca
The Project Submission Robot
-])
-
-AT_DATA([ls.sin],
-[s,^-[[rwx-]]\{9\} @USER@.*file$,listing of file,
-s,^-[[rwx-]]\{9\} @USER@.*file.sig$,listing of file.sig,
-])
-
-AT_CHECK([
-AT_MAILUTILS_PREREQ
-wydawca_config wydawca.cf
-mv wydawca.cf simple.cf
-wydawca_config notify.cf
-cat notify.cf simple.cf >> wydawca.cf
-wydawca_upload test file
-
-wydawca_expandmeta ls.sin ls.sed
-
-wydawca $WY_FORCE --no-preproc -c wydawca.cf || exit $?
-wydawca_cmp proj file file.sig
-cat mail.out | sed -f ls.sed
],
-[0],
-[expout],
-[experr])
-
+[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
+wydawca: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
+wydawca: [[INFO]] errors: 0
+wydawca: [[INFO]] warnings: 0
+wydawca: [[INFO]] bad signatures: 0
+wydawca: [[INFO]] access violation attempts: 0
+wydawca: [[INFO]] complete triplets: 1
+wydawca: [[INFO]] incomplete triplets: 0
+wydawca: [[INFO]] bad triplets: 0
+wydawca: [[INFO]] expired triplets: 0
+wydawca: [[INFO]] triplet successes: 1
+wydawca: [[INFO]] files uploaded: 2
+wydawca: [[INFO]] files archived: 0
+wydawca: [[INFO]] symlinks created: 0
+wydawca: [[INFO]] symlinks removed: 0
+wydawca: [[INFO]] check failures: 0
+wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
+])
AT_CLEANUP
diff --git a/tests/mailstats.at b/tests/mailstats.at
index a235aa2..a758d43 100644
--- a/tests/mailstats.at
+++ b/tests/mailstats.at
@@ -14,30 +14,63 @@
# You should have received a copy of the GNU General Public License
# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
-AT_SETUP([Simple upload statistics])
+AT_SETUP([Mailing statistics])
+AT_KEYWORDS([notify statistics mailstat])
+AT_CHECK_UPLOAD([
+module-prepend-load-path "$WY_MODDIR";
+module mailutils mod_mailutils.la;
+module-init mailutils {
+ admin-address "root@localhost";
+ from-address "wydawca-noreply@localhost";
+ mailer "| $WY_TESTDIR/nullmail -o $PWD/mail.out -F \${sender} \${rcpt}";
-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: [[INFO]] errors: 0
-wydawca: [[INFO]] warnings: 0
-wydawca: [[INFO]] bad signatures: 0
-wydawca: [[INFO]] access violation attempts: 0
-wydawca: [[INFO]] complete triplets: 1
-wydawca: [[INFO]] incomplete triplets: 0
-wydawca: [[INFO]] bad triplets: 0
-wydawca: [[INFO]] expired triplets: 0
-wydawca: [[INFO]] triplet successes: 1
-wydawca: [[INFO]] files uploaded: 2
-wydawca: [[INFO]] files archived: 0
-wydawca: [[INFO]] symlinks created: 0
-wydawca: [[INFO]] symlinks removed: 0
-wydawca: [[INFO]] check failures: 0
-wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
-])
+ mail-statistics {
+ statistics all;
+ message <<EOT
+Subject: Wydawca stats
+
+This is to notify you that the recent run of wydawca
+caused the following results:
-AT_DATA([expout],
+errors ............................. \${stat:errors}
+warning ............................ \${stat:warnings}
+bad signatures ..................... \${stat:bad_signatures}
+access violation attempts .......... \${stat:access_violations}
+complete triplets .................. \${stat:complete_triplets}
+incomplete triplets ................ \${stat:incomplete_triplets}
+bad triplets ....................... \${stat:bad_triplets}
+expired triplets ................... \${stat:expired_triplets}
+triplet successes .................. \${stat:triplet_success}
+files uploaded ..................... \${stat:uploads}
+files archived ..................... \${stat:archives}
+symlinks created ................... \${stat:symlinks}
+symlinks removed ................... \${stat:rmsymlinks}
+
+Regards,
+Wydawca
+EOT;
+ }
+}
+
+notify-event {
+ event finish;
+ module mailutils;
+}
+
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[AT_MAILUTILS_PREREQ
+wy_create_upload conversion upload/conversion-1.1.tar
+cp -a upload orig
+set -e
+wydawca --no-preproc -c wydawca.cf
+cat mail.out
+],
+[0],
[From wydawca-noreply@localhost
From: wydawca-noreply@localhost
To: root@localhost
@@ -62,21 +95,23 @@ symlinks removed ................... 0
Regards,
Wydawca
-])
-
-AT_CHECK([
-AT_MAILUTILS_PREREQ
-wydawca_config wydawca.cf
-wydawca_config mailstats.cf
-cat mailstats.cf >> wydawca.cf
-wydawca_upload test file
-
-wydawca $WY_FORCE --no-preproc -c wydawca.cf || exit $?
-wydawca_cmp proj file file.sig
-cat mail.out
],
-[0],
-[expout],
-[experr])
-
+[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
+wydawca: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
+wydawca: [[INFO]] errors: 0
+wydawca: [[INFO]] warnings: 0
+wydawca: [[INFO]] bad signatures: 0
+wydawca: [[INFO]] access violation attempts: 0
+wydawca: [[INFO]] complete triplets: 1
+wydawca: [[INFO]] incomplete triplets: 0
+wydawca: [[INFO]] bad triplets: 0
+wydawca: [[INFO]] expired triplets: 0
+wydawca: [[INFO]] triplet successes: 1
+wydawca: [[INFO]] files uploaded: 2
+wydawca: [[INFO]] files archived: 0
+wydawca: [[INFO]] symlinks created: 0
+wydawca: [[INFO]] symlinks removed: 0
+wydawca: [[INFO]] check failures: 0
+wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
+])
AT_CLEANUP
diff --git a/tests/rmsymlink00.at b/tests/rmsymlink00.at
index 5db67d5..04d42c1 100644
--- a/tests/rmsymlink00.at
+++ b/tests/rmsymlink00.at
@@ -15,12 +15,36 @@
# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
AT_SETUP([Remove symlink])
-AT_KEYWORDS([rmsymlink rmsymlink00])
+AT_KEYWORDS([symlink rmsymlink00])
-AT_DATA([experr],
+AT_CHECK_UPLOAD([
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[AT_SORT_PREREQ
+mkdir dest/dogana
+wy_genfile dogana dest/dogana/dogana-0.file
+(cd dest/dogana &&
+ ln -sf dogana-0.file dogana.latest &&
+ ln -sf dogana-0.file.sig dogana.latest.sig)
+wy_create_directive upload/rmsymlink.directive.asc dogana \
+ rmsymlink: dogana.latest\
+ comment: "remove symlink"
+set -e
+wydawca --no-preproc -c wydawca.cf
+find dest -type l|sort
+find dest -type f|sort
+],
+[0],
+[dest/dogana/dogana-0.file
+dest/dogana/dogana-0.file.sig
+],
[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
-wydawca: [[NOTICE]] rmsymlink.directive.asc: VERSION: 1.2
-wydawca: [[NOTICE]] rmsymlink.directive.asc: COMMENT: remove symlink
+wydawca: [[NOTICE]] rmsymlink.directive.asc.directive.asc: VERSION: 1.2
+wydawca: [[NOTICE]] rmsymlink.directive.asc.directive.asc: COMMENT: remove symlink
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -37,19 +61,5 @@ wydawca: [[INFO]] symlinks removed: 2
wydawca: [[INFO]] check failures: 0
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-
-AT_CHECK([AT_SORT_PREREQ
-wydawca_config wydawca.cf
-mkdir dest/proj
-cp "$WY_DISTDIR/file" "$WY_DISTDIR/file.sig" dest/proj
-(cd dest/proj && ln -sf file file-latest && ln -sf file.sig file-latest.sig)
-cp "$WY_DISTDIR/rmsymlink.directive.asc" source/test
-wydawca $WY_FORCE --no-preproc -c wydawca.cf || exit $?
-find dest -type l | sort
-],
-[0],
-[],
-[experr])
-
AT_CLEANUP
diff --git a/tests/symlink00.at b/tests/symlink00.at
index b8d6338..76b7ad4 100644
--- a/tests/symlink00.at
+++ b/tests/symlink00.at
@@ -17,10 +17,33 @@
AT_SETUP([Create symlink])
AT_KEYWORDS([symlink symlink00])
-AT_DATA([experr],
+AT_CHECK_UPLOAD([
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[AT_SORT_PREREQ
+mkdir dest/dogana
+wy_genfile dogana dest/dogana/dogana-0.file
+wy_create_directive upload/symlink.directive.asc dogana \
+ symlink: "dogana-0.file dogana.latest" \
+ comment: "create a symlink"
+set -e
+wydawca --no-preproc -c wydawca.cf
+find dest -type l|sort
+find dest -type f|sort
+],
+[0],
+[dest/dogana/dogana.latest
+dest/dogana/dogana.latest.sig
+dest/dogana/dogana-0.file
+dest/dogana/dogana-0.file.sig
+],
[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
-wydawca: [[NOTICE]] symlink.directive.asc: VERSION: 1.2
-wydawca: [[NOTICE]] symlink.directive.asc: COMMENT: create a symlink
+wydawca: [[NOTICE]] symlink.directive.asc.directive.asc: VERSION: 1.2
+wydawca: [[NOTICE]] symlink.directive.asc.directive.asc: COMMENT: create a symlink
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -37,23 +60,5 @@ wydawca: [[INFO]] symlinks removed: 0
wydawca: [[INFO]] check failures: 0
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-
-AT_CHECK([AT_SORT_PREREQ
-wydawca_config wydawca.cf
-mkdir dest/proj
-cp "$WY_DISTDIR/file" "$WY_DISTDIR/file.sig" dest/proj
-cp "$WY_DISTDIR/symlink.directive.asc" source/test
-wydawca $WY_FORCE --no-preproc -c wydawca.cf || exit $?
-find dest -type l | sort
-find dest -type l | sort | xargs -n 1 readlink
-],
-[0],
-[dest/proj/file-latest
-dest/proj/file-latest.sig
-file
-file.sig
-],
-[experr])
-
AT_CLEANUP
diff --git a/tests/symlink01.at b/tests/symlink01.at
index 90d0e49..afcee13 100644
--- a/tests/symlink01.at
+++ b/tests/symlink01.at
@@ -1,4 +1,4 @@
-# Check symlink creation over existing symlinks -*- Autotest -*-
+# Check symlink creation -*- Autotest -*-
# Copyright (C) 2009-2012, 2017, 2019-2020 Sergey Poznyakoff
#
# Wydawca is free software; you can redistribute it and/or modify
@@ -14,13 +14,39 @@
# You should have received a copy of the GNU General Public License
# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
-AT_SETUP([Create symlink that already exists])
+AT_SETUP([Create symlink (overwrite)])
AT_KEYWORDS([symlink symlink01])
-AT_DATA([experr],
+AT_CHECK_UPLOAD([
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[AT_SORT_PREREQ
+mkdir dest/dogana
+wy_genfile dogana dest/dogana/dogana-0.file
+(cd dest/dogana &&
+ ln -sf dogana-0.file dogana.latest &&
+ ln -sf dogana-0.file.sig dogana.latest.sig)
+wy_create_directive upload/symlink.directive.asc dogana \
+ symlink: "dogana-0.file dogana.latest" \
+ comment: "create a symlink"
+set -e
+wydawca --no-preproc -c wydawca.cf
+find dest -type l|sort
+find dest -type f|sort
+],
+[0],
+[dest/dogana/dogana.latest
+dest/dogana/dogana.latest.sig
+dest/dogana/dogana-0.file
+dest/dogana/dogana-0.file.sig
+],
[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
-wydawca: [[NOTICE]] symlink.directive.asc: VERSION: 1.2
-wydawca: [[NOTICE]] symlink.directive.asc: COMMENT: create a symlink
+wydawca: [[NOTICE]] symlink.directive.asc.directive.asc: VERSION: 1.2
+wydawca: [[NOTICE]] symlink.directive.asc.directive.asc: COMMENT: create a symlink
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -37,24 +63,5 @@ wydawca: [[INFO]] symlinks removed: 0
wydawca: [[INFO]] check failures: 0
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-
-AT_CHECK([AT_SORT_PREREQ
-wydawca_config wydawca.cf
-mkdir dest/proj
-cp "$WY_DISTDIR/file" "$WY_DISTDIR/file.sig" dest/proj
-(cd dest/proj && ln -sf file file-latest && ln -sf file.sig file-latest.sig)
-cp "$WY_DISTDIR/symlink.directive.asc" source/test
-wydawca $WY_FORCE --no-preproc -c wydawca.cf || exit $?
-find dest -type l | sort
-find dest -type l | sort | xargs -n 1 readlink
-],
-[0],
-[dest/proj/file-latest
-dest/proj/file-latest.sig
-file
-file.sig
-],
-[experr])
-
AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 511175f..2cbf991 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -23,30 +23,48 @@ m4_define([AT_SORT_PREREQ],[
test -z "`sort < /dev/null 2>&1`" || AT_SKIP_TEST
])
+m4_define([AT_GPG_PREREQ],[test -n "$GPG" || AT_SKIP_TEST])
m4_define([AT_MAILUTILS_PREREQ],[test "$WY_MAILUTILS" = yes || AT_SKIP_TEST])
m4_define([AT_INOTIFY_PREREQ],[test "$WY_INOTIFY" = yes || AT_SKIP_TEST])
-# AT_WYDAWCA_DAEMON([PREREQ],[INI],[SHELL-COMMANDS],[POST],[CODE],[STDOUT],[STDERR])
+# AT_CHECK_UPLOAD([CONFIG],
+m4_define([AT_CHECK_UPLOAD],
+[AT_CHECK([AT_GPG_PREREQ
+(wy_config_head
+cat <<EOF
+$1
+EOF
+) > wydawca.cf
+wyinit wydawca.cf
+$2
+],
+m4_shift2($@))])
+
+# AT_WYDAWCA_DAEMON([PREREQ],[CONFIG],[INI],[SHELL-COMMANDS],[POST],[CODE],[STDOUT],[STDERR])
m4_define([AT_WYDAWCA_DAEMON],
[AT_CHECK([$1
-AT_DATA([helper.in],[$3
-])
cat > helper.sh <<EOT
#!/bin/sh
. $WY_TESTDIR/atlocal
+$4
EOT
-wydawca_expandmeta helper.in helper.bot
-cat helper.bot >> helper.sh
-wydawca_config wydawca.cf
+
+(wy_config_head
+cat <<EOF
$2
+EOF
+) > wydawca.cf
+wyinit wydawca.cf
+
+$3
+
wyasync -c $PWD/wydawca.cf -w --no-preproc -- /bin/sh ./helper.sh || exit $?
-$4
+
+$5
+
cat wydawca.out | cwdrepl
cat wydawca.err | cwdrepl >&2
-],
-[$5],
-[$6],
-[$7])])
+],m4_shiftn(5,$@))])
m4_define([AT_WYDAWCA_INOTIFY_DAEMON],
[AT_WYDAWCA_DAEMON([AT_INOTIFY_PREREQ],$@)])
@@ -59,12 +77,15 @@ m4_include([backup01.at])
m4_include([backup02.at])
m4_include([backup03.at])
+AT_BANNER([Dry-run mode])
+m4_include([dry_run00.at])
+m4_include([dry_run01.at])
+m4_include([dry_run02.at])
+
AT_BANNER([Uploads])
-m4_include([upload-dry.at])
-m4_include([upload.at])
-m4_include([upl11.at])
-m4_include([upl12f.at])
-m4_include([upl12t.at])
+m4_include([upload00.at])
+m4_include([upload01.at])
+m4_include([upload02.at])
AT_BANNER([Symlinks])
m4_include([symlink00.at])
@@ -72,12 +93,12 @@ m4_include([symlink01.at])
m4_include([rmsymlink00.at])
AT_BANNER([Plugins])
-m4_include([notify-upl.at])
+m4_include([mailnotify.at])
m4_include([mailstats.at])
AT_BANNER([Distribution verification])
-m4_include([check-fail.at])
m4_include([check-ok.at])
+m4_include([check-fail.at])
m4_include([check-notify.at])
AT_BANNER([inotify])
@@ -90,4 +111,6 @@ m4_include([inotify-unatt01.at])
AT_BANNER([Legacy upload notification protocol])
m4_include([unp00.at])
m4_include([unp01.at])
+m4_include([unp02.at])
m4_include([unp-idle.at])
+
diff --git a/tests/unp-idle.at b/tests/unp-idle.at
index ba78cef..8cc122b 100644
--- a/tests/unp-idle.at
+++ b/tests/unp-idle.at
@@ -1,17 +1,36 @@
+# Check legacy upload notification protocol -*- Autotest -*-
+# Copyright (C) 2010-2012, 2017, 2019-2020 Sergey Poznyakoff
+#
+# Wydawca 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.
+#
+# Wydawca 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 Wydawca. If not, see <http://www.gnu.org/licenses/>.
+
AT_SETUP([Idle timeout])
AT_KEYWORDS([uploads unp unp-idle])
AT_WYDAWCA_DAEMON([
-AT_SORT_PREREQ
socket=$(pwd)/wydawca.s
-export socket uploaddir GNUPGHOME
+export socket
],
-[cat >> wydawca.cf <<EOT
+[spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
inotify no;
listen $socket;
-EOT
],
-[wyclt -w 7 $socket ckok
+[],
+[wyclt -w 7 $socket test
],
[],
[2],
diff --git a/tests/unp00.at b/tests/unp00.at
index fb2cd6e..3835245 100644
--- a/tests/unp00.at
+++ b/tests/unp00.at
@@ -1,10 +1,52 @@
+# Check legacy upload notification protocol -*- Autotest -*-
+# Copyright (C) 2010-2012, 2017, 2019-2020 Sergey Poznyakoff
+#
+# Wydawca 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.
+#
+# Wydawca 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 Wydawca. If not, see <http://www.gnu.org/licenses/>.
+
AT_SETUP([Successful upload])
AT_KEYWORDS([uploads unp unp00])
-AT_DATA([experr],
+AT_WYDAWCA_DAEMON([
+socket=$(pwd)/wydawca.s
+export socket
+],
+[spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+inotify no;
+listen $socket;
+],
+[],
+[mkdir orig
+wy_create_upload conversion orig/conversion-1.1.tar
+cp orig/* upload
+wyclt $socket test
+while ! test -f $PWD/dest/conversion/conversion-1.1.tar \
+ && ! test -f $PWD@/dest/conversion/conversion-1.1.tar.sig
+do
+ sleep 1
+done
+],
+[cmp orig/conversion-1.1.tar dest/conversion/conversion-1.1.tar
+cmp orig/conversion-1.1.tar.sig dest/conversion/conversion-1.1.tar.sig
+],
+[0],
+[],
[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: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -23,26 +65,4 @@ wydawca: [[NOTICE]] shutting down on signal "Terminated"
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-AT_WYDAWCA_DAEMON([
-socket=$(pwd)/wydawca.s
-export socket
-],
-[cat >> wydawca.cf <<EOT
-inotify no;
-listen $socket;
-EOT
-],
-[wydawca_upload ok file
-wyclt $socket ckok
-while ! test -f @CWD@/dest/proj/file && ! test -f @CWD@/dest/proj/file.sig
-do
- sleep 1
-done
-],
-[wydawca_cmp proj file file.sig
-],
-[0],
-[],
-[experr])
-
AT_CLEANUP
diff --git a/tests/unp01.at b/tests/unp01.at
index ec70ded..5c50a18 100644
--- a/tests/unp01.at
+++ b/tests/unp01.at
@@ -1,5 +1,5 @@
-# Test legacy upload notification requests -*- Autotest -*-
-# Copyright (C) 2020 Sergey Poznyakoff
+# Check legacy upload notification protocol -*- Autotest -*-
+# Copyright (C) 2010-2012, 2017, 2019-2020 Sergey Poznyakoff
#
# Wydawca is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,54 +13,48 @@
#
# You should have received a copy of the GNU General Public License
# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
-AT_SETUP([Multiple successful uploads])
+
+AT_SETUP([Multiple uploads to single spool])
AT_KEYWORDS([uploads unp unp01])
AT_WYDAWCA_DAEMON([
-AT_SORT_PREREQ
socket=$(pwd)/wydawca.s
-uploaddir=$(pwd)/source/ok
-GNUPGHOME=$WY_TESTDIR/etc
-export socket uploaddir GNUPGHOME
+export socket
],
-[cat >> wydawca.cf <<EOT
+[spool release {
+ url ftp://wydawca.release;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
inotify no;
listen $socket;
-EOT
],
-[
-upload() {
- name=$1
- shift
- echo "$@" > $uploaddir/$name
- gpg --batch --no-tty -ba \
- -o $uploaddir/$name.sig $uploaddir/$name
- cat > $name.directive <<EOT
-version: 1.2
-directory: proj
-filename: $name
-EOT
- gpg --batch --no-tty --clearsign \
- -o $uploaddir/$name.directive.asc $name.directive
-}
-
-upload one "first distro" 2>gpg.err
-upload two "second distro" 2>>gpg.err
-
-wyclt $socket ckok
-while ! test -f @CWD@/dest/proj/one && ! test -f @CWD@/dest/proj/one.sig
+[],
+[mkdir orig
+wy_create_upload conversion orig/conversion-1.1.tar
+wy_create_upload -l 16400 mugello orig/mugello-1.0.tar
+wy_create_upload dogana orig/dogana-1.0.tar
+cp orig/* upload
+wyclt $socket release
+while test -f $PWD/upload/conversion-1.1.tar.directive.asc \
+ || test -f $PWD/upload/mugello-1.0.tar.directive.asc \
+ || test -f $PWD/upload/dogana-1.0.tar.directive.asc
do
sleep 1
done
],
-[find dest -type f|sort
+[while read project file
+do
+ cmp orig/$file dest/$project/$file
+ cmp orig/$file.sig dest/$project/$file.sig
+done <<EOF
+conversion conversion-1.1.tar
+mugello mugello-1.0.tar
+dogana dogana-1.0.tar
+EOF
],
[0],
-[dest/proj/one
-dest/proj/one.sig
-dest/proj/two
-dest/proj/two.sig
-],
+[],
[ignore])
AT_CLEANUP
diff --git a/tests/unp02.at b/tests/unp02.at
new file mode 100644
index 0000000..cf693a7
--- a/dev/null
+++ b/tests/unp02.at
@@ -0,0 +1,73 @@
+# Check legacy upload notification protocol -*- Autotest -*-
+# Copyright (C) 2010-2012, 2017, 2019-2020 Sergey Poznyakoff
+#
+# Wydawca 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.
+#
+# Wydawca 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 Wydawca. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([Multiple uploads to all spools])
+AT_KEYWORDS([uploads unp unp02])
+
+AT_WYDAWCA_DAEMON([
+socket=$(pwd)/wydawca.s
+export socket
+],
+[spool release {
+ url ftp://wydawca.release;
+ source "$PWD/upload/release";
+ destination "$PWD/dest/release";
+}
+spool alpha {
+ url ftp://wydawca.alpha;
+ source "$PWD/upload/alpha";
+ destination "$PWD/dest/alpha";
+}
+all-spools (all);
+inotify no;
+listen $socket;
+],
+[],
+[mkdir orig
+mkdir orig/release orig/alpha
+wy_create_upload conversion orig/release/conversion-1.1.tar
+wy_create_upload -l 16400 mugello orig/release/muguello-1.0.tar
+wy_create_upload mugello orig/alpha/muguello-1.0.90.tar
+wy_create_upload dogana orig/release/dogana-1.0.tar
+wy_create_upload -l 86400 falcon orig/alpha/falcon-0.99.tar
+cp -a orig/* upload
+wyclt $socket all
+while test -f $PWD/upload/release/conversion-1.1.tar.directive.asc \
+ || test -f $PWD/upload/release/muguello-1.0.tar.directive.asc \
+ || test -f $PWD/upload/alpha/muguello-1.0.90.tar.directive.asc \
+ || test -f $PWD/upload/release/dogana-1.0.tar.directive.asc \
+ || test -f $PWD/upload/alpha/falcon-0.99.tar.directive.asc
+do
+ sleep 1
+done
+],
+[while read distro project file
+do
+ cmp orig/$distro/$file dest/$distro/$project/$file
+ cmp orig/$distro/$file.sig dest/$distro/$project/$file.sig
+done <<EOF
+release conversion conversion-1.1.tar
+release mugello muguello-1.0.tar
+release dogana dogana-1.0.tar
+alpha mugello muguello-1.0.90.tar
+alpha falcon falcon-0.99.tar
+EOF
+],
+[0],
+[],
+[ignore])
+
+AT_CLEANUP
diff --git a/tests/upl12f.at b/tests/upl12f.at
deleted file mode 100644
index 51d02e9..0000000
--- a/tests/upl12f.at
+++ b/dev/null
@@ -1,61 +0,0 @@
-# Check working uploads -*- Autotest -*-
-# Copyright (C) 2009-2012, 2017, 2019-2020 Sergey Poznyakoff
-#
-# Wydawca 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.
-#
-# Wydawca 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 Wydawca. If not, see <http://www.gnu.org/licenses/>.
-
-AT_SETUP([Implicit archivation disabled (version 1.2)])
-AT_KEYWORDS([upl12f])
-
-AT_DATA([experr],
-[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
-wydawca: [[NOTICE]] file.directive.asc: VERSION: 1.2
-wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite
-wydawca: [[ERR]] refusing to upload file because it already exists and replace is not allowed
-wydawca: [[NOTICE]] removing ./source/test/file
-wydawca: [[NOTICE]] removing ./source/test/file.sig
-wydawca: [[NOTICE]] removing ./source/test/file.directive.asc
-wydawca: [[INFO]] errors: 1
-wydawca: [[INFO]] warnings: 0
-wydawca: [[INFO]] bad signatures: 0
-wydawca: [[INFO]] access violation attempts: 0
-wydawca: [[INFO]] complete triplets: 1
-wydawca: [[INFO]] incomplete triplets: 0
-wydawca: [[INFO]] bad triplets: 0
-wydawca: [[INFO]] expired triplets: 0
-wydawca: [[INFO]] triplet successes: 0
-wydawca: [[INFO]] files uploaded: 0
-wydawca: [[INFO]] files archived: 0
-wydawca: [[INFO]] symlinks created: 0
-wydawca: [[INFO]] symlinks removed: 0
-wydawca: [[INFO]] check failures: 0
-wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
-])
-
-AT_CHECK([
-wydawca_config wydawca.cf
-mkdir dest/proj
-cp "$WY_DISTDIR/file" dest/proj
-cp "$WY_DISTDIR/file.sig" dest/proj
-
-wydawca_upload test file file12f.directive.asc
-
-wydawca $WY_FORCE --no-preproc -c wydawca.cf 2>err || exit $?
-cat err | cwdrepl >&2
-wydawca_cmp proj file file.sig
-],
-[0],
-[],
-[experr])
-
-AT_CLEANUP
diff --git a/tests/upload-dry.at b/tests/upload-dry.at
deleted file mode 100644
index 670148e..0000000
--- a/tests/upload-dry.at
+++ b/dev/null
@@ -1,69 +0,0 @@
-# Check dry-run uploads -*- Autotest -*-
-# Copyright (C) 2009-2012, 2017, 2019-2020 Sergey Poznyakoff
-#
-# Wydawca 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.
-#
-# Wydawca 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 Wydawca. If not, see <http://www.gnu.org/licenses/>.
-
-AT_SETUP([Dry-run upload])
-
-AT_DATA([experr],
-[wydawca: [[DEBUG]] test: creating archive directory
-wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
-wydawca: [[DEBUG]] Good signature from Wydawca (Testsuite) <bug-wydawca@gnu.org.ua>
-wydawca: [[DEBUG]] file: directive file signature OK
-wydawca: [[NOTICE]] file.directive.asc: VERSION: 1.1
-wydawca: [[DEBUG]] processing triplet `file'
-wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite
-wydawca: [[DEBUG]] good detached signature for file
-wydawca: [[DEBUG]] installing file to ./dest/proj
-wydawca: [[DEBUG]] installing file.sig to ./dest/proj
-wydawca: [[INFO]] errors: 0
-wydawca: [[INFO]] warnings: 0
-wydawca: [[INFO]] bad signatures: 0
-wydawca: [[INFO]] access violation attempts: 0
-wydawca: [[INFO]] complete triplets: 1
-wydawca: [[INFO]] incomplete triplets: 0
-wydawca: [[INFO]] bad triplets: 0
-wydawca: [[INFO]] expired triplets: 0
-wydawca: [[INFO]] triplet successes: 1
-wydawca: [[INFO]] files uploaded: 2
-wydawca: [[INFO]] files archived: 0
-wydawca: [[INFO]] symlinks created: 0
-wydawca: [[INFO]] symlinks removed: 0
-wydawca: [[INFO]] check failures: 0
-wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
-])
-
-AT_CHECK([AT_SORT_PREREQ
-wydawca_config wydawca.cf
-wydawca_upload test file
-
-set -e
-wydawca $WY_FORCE --no-preproc --dry-run -c wydawca.cf 2>err
-set +e
-grep "found file" err | sort
-sed -e '/found file/d' \
- -e '/exited successfully/d' \
- -e '/ok -> /d' \
- -e '/fail -> /d' \
- -e '/test -> /d' \
- err | cwdrepl >&2
-],
-[0],
-[wydawca: [[DEBUG]] found file file.directive.asc: signed upload directive, stem: file
-wydawca: [[DEBUG]] found file file.sig: detached signature, stem: file
-wydawca: [[DEBUG]] found file file: distributive, stem: file
-],
-[experr])
-
-AT_CLEANUP
diff --git a/tests/upl11.at b/tests/upload00.at
index e442a92..45b48da 100644
--- a/tests/upl11.at
+++ b/tests/upload00.at
@@ -1,4 +1,4 @@
-# Check working uploads -*- Autotest -*-
+# This file is part of wydawca testsuite. -*- Autotest -*-
# Copyright (C) 2009-2012, 2017, 2019-2020 Sergey Poznyakoff
#
# Wydawca is free software; you can redistribute it and/or modify
@@ -14,13 +14,26 @@
# You should have received a copy of the GNU General Public License
# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
-AT_SETUP([Implicit archivation (version 1.1)])
-AT_KEYWORDS([upl11])
-
-AT_DATA([experr],
+AT_SETUP([Single upload])
+AT_KEYWORDS([upload upload-single upload-success])
+AT_CHECK_UPLOAD([
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[wy_create_upload conversion upload/conversion-1.1.tar
+cp -a upload orig
+set -e
+wydawca --no-preproc -c wydawca.cf
+cmp orig/conversion-1.1.tar dest/conversion/conversion-1.1.tar
+cmp orig/conversion-1.1.tar.sig dest/conversion/conversion-1.1.tar.sig
+],
+[0],
+[],
[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: [[NOTICE]] conversion-1.1.tar.directive.asc: VERSION: 1.2
wydawca: [[INFO]] errors: 0
wydawca: [[INFO]] warnings: 0
wydawca: [[INFO]] bad signatures: 0
@@ -31,27 +44,11 @@ wydawca: [[INFO]] bad triplets: 0
wydawca: [[INFO]] expired triplets: 0
wydawca: [[INFO]] triplet successes: 1
wydawca: [[INFO]] files uploaded: 2
-wydawca: [[INFO]] files archived: 2
+wydawca: [[INFO]] files archived: 0
wydawca: [[INFO]] symlinks created: 0
wydawca: [[INFO]] symlinks removed: 0
wydawca: [[INFO]] check failures: 0
wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
])
-
-AT_CHECK([
-wydawca_config wydawca.cf
-mkdir dest/proj
-cp "$WY_DISTDIR/file" dest/proj
-cp "$WY_DISTDIR/file.sig" dest/proj
-
-wydawca_upload test file
-
-wydawca $WY_FORCE --no-preproc -c wydawca.cf || exit $?
-wydawca_cmp proj file file.sig
-wydawca_cmparc proj file file.sig
-],
-[0],
-[],
-[experr])
-
AT_CLEANUP
+
diff --git a/tests/upload01.at b/tests/upload01.at
new file mode 100644
index 0000000..279599e
--- a/dev/null
+++ b/tests/upload01.at
@@ -0,0 +1,91 @@
+# This file is part of wydawca testsuite. -*- Autotest -*-
+# Copyright (C) 2009-2012, 2017, 2019-2020 Sergey Poznyakoff
+#
+# Wydawca 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.
+#
+# Wydawca 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 Wydawca. If not, see <http://www.gnu.org/licenses/>.
+AT_SETUP([Failed upload])
+AT_KEYWORDS([upload upload-single upload-failure dry-run])
+AT_CHECK_UPLOAD([
+spool test {
+ url ftp://wydawca.test;
+ source "$PWD/upload";
+ destination "$PWD/dest";
+}
+],
+[wy_create_upload -u forese@example.com conversion upload/conversion-1.1.tar
+set -e
+wydawca --no-preproc -c wydawca.cf 2>err
+
+# FIXME: The incomplete triplets count can be set to 1 if the directive
+# file is seen first. In this case it is parsed early, found to be signed
+# by wrong person (which also raises the bad signatures and access violation
+# attempts counts) and the corresponding triplet is removed. Then, the
+# archive and signature files are read and combined into a single inclomplete
+# triplet. Incomplete because the directive part has already been dismissed.
+# This triplet is detected at the end of the run.
+#
+# If, on the other hand, the archive and signature were read first and the
+# directive file last, then the completed triplet would be thrown out and
+# incomplete triplet count would remain 0.
+#
+# Ways out:
+# 1. Detain the triplet in table until it is completed and only then
+# verify the signature. This will always produce the second case.
+# However, it implies parsing the signature file early. Actually,
+# that's the way wydawca operates now. However, although it seemed
+# a nice idea at the time, now I incline to the second solution.
+# 2. Verify the triplet as soon as the directive file is read. Parse
+# the directive only if the signature passes verification. Otherwise,
+# drop it. This is pretty similar to how wydawca operates now, except
+# that the directive file would be parsed only if verified. That seems
+# to be an advantage, since that's what the signature is for, in the
+# first place. Secondly, that would allow to use right GPGME function
+# for extracting the file content, instead of feedling with it manually.
+# The drawback is that processing of badly signed directives would
+# sometimes produce false incomplete triplets. The only fix is to defer
+# triplet processing to the end of directory scan, which implies a
+# memory usage overhead.
+sed -e 's/incomplete triplets: 1/incomplete triplets: 0/' \
+ -e '/removing/d' err >&2
+
+echo "dest dir"
+find dest
+echo "upload dir"
+find upload -name conversion-1.1.tar.directive.asc
+],
+[0],
+[dest dir
+dest
+upload dir
+],
+[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
+wydawca: [[ERR]] No public key
+wydawca: [[ERR]] invalid signature for conversion-1.1.tar
+wydawca: [[INFO]] errors: 2
+wydawca: [[INFO]] warnings: 0
+wydawca: [[INFO]] bad signatures: 1
+wydawca: [[INFO]] access violation attempts: 1
+wydawca: [[INFO]] complete triplets: 0
+wydawca: [[INFO]] incomplete triplets: 0
+wydawca: [[INFO]] bad triplets: 0
+wydawca: [[INFO]] expired triplets: 0
+wydawca: [[INFO]] triplet successes: 0
+wydawca: [[INFO]] files uploaded: 0
+wydawca: [[INFO]] files archived: 0
+wydawca: [[INFO]] symlinks created: 0
+wydawca: [[INFO]] symlinks removed: 0
+wydawca: [[INFO]] check failures: 0
+wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
+])
+AT_CLEANUP
+

Return to:

Send suggestions and report system problems to the System administrator.