summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2010-01-02 16:50:14 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2010-01-02 16:50:14 (GMT)
commit1b0a4de9fa73dd2453cbd2902c2cd4d000f4abe7 (patch) (side-by-side diff)
tree061ee328e2464d5bed9f5882642fbc25d32de8bc
parenta510f517e1aff073e6b37a5fa9e8ed825de836af (diff)
downloadwydawca-1b0a4de9fa73dd2453cbd2902c2cd4d000f4abe7.tar.gz
wydawca-1b0a4de9fa73dd2453cbd2902c2cd4d000f4abe7.tar.bz2
Add testcases for distribution tarball checking.
* src/directive.c (run_check_script): Reword diagnostic messages. * tests/check-fail.at: New testcase. * tests/check-notify.at: New testcase. * tests/check-ok.at: New testcase. * tests/Makefile.am: Add new files. * tests/testsuite.at: Include new tests. * tests/atlocal.in (wydawca_init_testdirs): Create three source subdirectories. (wydawca_upload): Treat first argument as the name of a source subdirectory. * tests/etc/notify.rc: Add check-failure notification. * tests/etc/wydawca.rcin (ckfail, ckok): New spools. * tests/mailstats.at, tests/notify-upl.at, tests/upload.at: Update. * tests/upload-dry.at: Update output template.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/directive.c8
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/atlocal.in6
-rw-r--r--tests/check-fail.at56
-rw-r--r--tests/check-notify.at86
-rw-r--r--tests/check-ok.at56
-rw-r--r--tests/etc/notify.rc20
-rw-r--r--tests/etc/wydawca.rcin27
-rw-r--r--tests/mailstats.at2
-rw-r--r--tests/notify-upl.at3
-rw-r--r--tests/testsuite.at4
-rw-r--r--tests/upload-dry.at6
-rw-r--r--tests/upload.at2
13 files changed, 266 insertions, 13 deletions
diff --git a/src/directive.c b/src/directive.c
index f648e07..3d70fa8 100644
--- a/src/directive.c
+++ b/src/directive.c
@@ -522,26 +522,26 @@ run_check_script (const char *script, struct file_triplet *trp,
status = WEXITSTATUS (status);
if (status)
{
- logmsg (LOG_ERR, "%s for triplet %s, spool %s returned %d",
+ logmsg (LOG_ERR, "%s for %s@%s returned %d",
descr, trp->name, trp->spool->tag, status);
return 1;
}
else if (debug_level > 2)
- logmsg (LOG_DEBUG, "%s for triplet %s, spool %s returned %d",
+ logmsg (LOG_DEBUG, "%s for %s@%s returned %d",
descr, trp->name, trp->spool->tag, status);
}
else if (WIFSIGNALED (status))
{
int sig = WTERMSIG (status);
logmsg (LOG_NOTICE,
- "%s for triplet %s, spool %s terminated on signal %d",
+ "%s for %s@%s terminated on signal %d",
descr, trp->name, trp->spool->tag, sig);
return 1;
}
else
{
logmsg (LOG_NOTICE,
- "%s for triplet %s, spool %s terminated with unhandled status",
+ "%s for %s@%s terminated with unhandled status",
descr, trp->name, trp->spool->tag);
return 1;
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7d8aead..3da497b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -40,6 +40,9 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
## ------------ ##
TESTSUITE_AT = \
+ check-fail.at\
+ check-notify.at\
+ check-ok.at\
testsuite.at\
notify-upl.at\
mailstats.at\
diff --git a/tests/atlocal.in b/tests/atlocal.in
index b3906f8..7f6e327 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -14,7 +14,7 @@ WD_SRC=@abs_top_builddir@/tests/source
WD_DST=@abs_top_builddir@/tests/dest
wydawca_init_testdirs() {
- for dir in "$WD_SRC" "$WD_DST"
+ for dir in "$WD_SRC" "$WD_SRC/test" "${WD_SRC}/fail" "${WD_SRC}/ok" "$WD_DST"
do
if test -d "$dir"; then
rm -rf "$dir"/*
@@ -37,9 +37,11 @@ wydawca_config() {
}
wydawca_upload() {
+ dir="$WD_SRC/$1"
+ shift
for file in $@
do
- cp "$WD_DISTDIR/$file" "$WD_SRC"
+ cp "$WD_DISTDIR/$file" "$dir"
done
}
diff --git a/tests/check-fail.at b/tests/check-fail.at
new file mode 100644
index 0000000..8d1e86a
--- a/dev/null
+++ b/tests/check-fail.at
@@ -0,0 +1,56 @@
+# Check distribution verification tests - failure -*- Autotest -*-
+# Copyright (C) 2010 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([Verification test failure])
+AT_KEYWORDS([uploads check-test check-fail])
+
+AT_DATA([template],
+[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
+wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite
+wydawca: [[ERR]] spool check script for file@ckfail returned 1
+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: 1
+wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
+])
+
+AT_CHECK([
+wydawca_init_testdirs
+wydawca_config wydawca.rc
+wydawca_upload fail file file.directive.asc file.sig
+
+wydawca_expandmeta template experr
+
+wydawca --no-preproc -c wydawca.rc
+],
+[0],
+[],
+[experr])
+
+wydawca_clean_testdirs
+
+AT_CLEANUP
diff --git a/tests/check-notify.at b/tests/check-notify.at
new file mode 100644
index 0000000..16ae296
--- a/dev/null
+++ b/tests/check-notify.at
@@ -0,0 +1,86 @@
+# Check distribution verification tests - failure notification -*- Autotest -*-
+# Copyright (C) 2010 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([Verification test failure notification])
+AT_KEYWORDS([uploads check-test check-fail check-fail-notify notify])
+
+AT_DATA([template],
+[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
+wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite
+wydawca: [[ERR]] spool check script for file@ckfail returned 1
+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: 1
+wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
+])
+
+AT_DATA([outtmpl],
+[-F wydawca-noreply@localhost @USER@@localhost
+=========
+From: wydawca-noreply@localhost
+To: "Wydawca Test User" <@USER@@localhost>
+Subject: file rejected
+X-Mailer: AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION)
+
+Your upload of file has been rejected by the distribution
+verification procedure with the following diagnostics:
+
+WYDAWCA_SPOOL=ckfail
+WYDAWCA_SOURCE=@WD_SRC@/fail
+WYDAWCA_DEST=@WD_DST@
+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([
+wydawca_init_testdirs
+wydawca_config wydawca.rc
+mv wydawca.rc simple.rc
+cat $WD_CONFSRC/notify.rc simple.rc > wydawca.rc
+
+wydawca_upload fail file file.directive.asc file.sig
+
+wydawca_expandmeta outtmpl expout
+wydawca_expandmeta template experr
+
+wydawca --no-preproc -c wydawca.rc || exit $?
+cat $WD_DST/mail.out
+],
+[0],
+[expout],
+[experr])
+
+wydawca_clean_testdirs
+
+AT_CLEANUP
diff --git a/tests/check-ok.at b/tests/check-ok.at
new file mode 100644
index 0000000..8942631
--- a/dev/null
+++ b/tests/check-ok.at
@@ -0,0 +1,56 @@
+# Check distribution verification tests - success -*- Autotest -*-
+# Copyright (C) 2010 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([Verification test success])
+AT_KEYWORDS([uploads check-test check-success check-ok])
+
+AT_DATA([template],
+[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
+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_CHECK([
+wydawca_init_testdirs
+wydawca_config wydawca.rc
+wydawca_upload ok file file.directive.asc file.sig
+
+wydawca_expandmeta template experr
+
+wydawca --no-preproc -c wydawca.rc || exit $?
+wydawca_cmp proj file file.sig
+],
+[0],
+[],
+[experr])
+
+wydawca_clean_testdirs
+
+AT_CLEANUP
diff --git a/tests/etc/notify.rc b/tests/etc/notify.rc
index 528d8f5..4461ce3 100644
--- a/tests/etc/notify.rc
+++ b/tests/etc/notify.rc
@@ -174,3 +174,23 @@ Wydawca
The Project Submission Robot
EOT;
}
+
+notify-event {
+ event check-failure;
+ recipient user;
+ message <<EOT
+Subject: ${triplet:dist} rejected
+
+Your upload of ${triplet:dist} has been rejected by the distribution
+verification procedure with the following diagnostics:
+
+${check:diagn}
+Please fix the tarball and resubmit.
+
+Regards,
+Wydawca
+The Project Submission Robot
+EOT;
+}
+
+
diff --git a/tests/etc/wydawca.rcin b/tests/etc/wydawca.rcin
index d012554..7e9f4ad 100644
--- a/tests/etc/wydawca.rcin
+++ b/tests/etc/wydawca.rcin
@@ -26,7 +26,6 @@ dictionary project-owner {
params ("/exact",
"proj", "proj-owner@localhost", "Project Admin");
}
-
dictionary project-uploader {
type builtin;
query "${project}";
@@ -66,9 +65,33 @@ dictionary project-uploader {
spool test {
url ftp://wydawca.test;
- source "@WD_SRC@";
+ source "@WD_SRC@/test";
+ destination "@WD_DST@";
+ archive none;
+}
+
+spool ckfail {
+ url ftp://wydawca.ckfail;
+ source "@WD_SRC@/fail";
+ destination "@WD_DST@";
+ 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 "@WD_SRC@/ok";
destination "@WD_DST@";
archive none;
+ check-script "exit 0";
}
admin-address "root@localhost";
diff --git a/tests/mailstats.at b/tests/mailstats.at
index 7722bab..2b35d46 100644
--- a/tests/mailstats.at
+++ b/tests/mailstats.at
@@ -69,7 +69,7 @@ AT_CHECK([
wydawca_init_testdirs
wydawca_config wydawca.rc
cat $WD_CONFSRC/mailstats.rc >> wydawca.rc
-wydawca_upload file file.directive.asc file.sig
+wydawca_upload test file file.directive.asc file.sig
wydawca_expandmeta errtmpl experr
ulimit -c unlimited
diff --git a/tests/notify-upl.at b/tests/notify-upl.at
index 73283cc..d91a4d6 100644
--- a/tests/notify-upl.at
+++ b/tests/notify-upl.at
@@ -15,6 +15,7 @@
# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
AT_SETUP([Simple upload and notification])
+AT_KEYWORDS([notify])
AT_DATA([errtmpl],
[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
@@ -81,7 +82,7 @@ wydawca_init_testdirs
wydawca_config wydawca.rc
mv wydawca.rc simple.rc
cat $WD_CONFSRC/notify.rc simple.rc > wydawca.rc
-wydawca_upload file file.directive.asc file.sig
+wydawca_upload test file file.directive.asc file.sig
wydawca_expandmeta errtmpl experr
wydawca_expandmeta outtmpl expout
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 055e10a..1adc6db 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -27,3 +27,7 @@ m4_include([upload-dry.at])
m4_include([upload.at])
m4_include([notify-upl.at])
m4_include([mailstats.at])
+
+m4_include([check-fail.at])
+m4_include([check-ok.at])
+m4_include([check-notify.at])
diff --git a/tests/upload-dry.at b/tests/upload-dry.at
index 39772b3..8102df7 100644
--- a/tests/upload-dry.at
+++ b/tests/upload-dry.at
@@ -18,7 +18,9 @@ AT_SETUP([Dry-run upload])
AT_DATA([template],
[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
-wydawca: [[DEBUG]] @WD_SRC@ -> @WD_DST@
+wydawca: [[DEBUG]] @WD_SRC@/ok -> @WD_DST@
+wydawca: [[DEBUG]] @WD_SRC@/fail -> @WD_DST@
+wydawca: [[DEBUG]] @WD_SRC@/test -> @WD_DST@
wydawca: [[DEBUG]] found file file: distributive, stem: file
wydawca: [[DEBUG]] found file file.directive.asc: signed upload directive, stem: file
wydawca: [[DEBUG]] found file file.sig: detached signature, stem: file
@@ -51,7 +53,7 @@ wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) fini
AT_CHECK([
wydawca_init_testdirs
wydawca_config wydawca.rc
-wydawca_upload file file.directive.asc file.sig
+wydawca_upload test file file.directive.asc file.sig
wydawca_expandmeta template experr
diff --git a/tests/upload.at b/tests/upload.at
index 4bd9252..a7b14ee 100644
--- a/tests/upload.at
+++ b/tests/upload.at
@@ -39,7 +39,7 @@ wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) fini
AT_CHECK([
wydawca_init_testdirs
wydawca_config wydawca.rc
-wydawca_upload file file.directive.asc file.sig
+wydawca_upload test file file.directive.asc file.sig
wydawca_expandmeta template experr

Return to:

Send suggestions and report system problems to the System administrator.