aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-01-02 18:50:14 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2010-01-02 18:50:14 +0200
commit1b0a4de9fa73dd2453cbd2902c2cd4d000f4abe7 (patch)
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.
-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,
522 status = WEXITSTATUS (status); 522 status = WEXITSTATUS (status);
523 if (status) 523 if (status)
524 { 524 {
525 logmsg (LOG_ERR, "%s for triplet %s, spool %s returned %d", 525 logmsg (LOG_ERR, "%s for %s@%s returned %d",
526 descr, trp->name, trp->spool->tag, status); 526 descr, trp->name, trp->spool->tag, status);
527 return 1; 527 return 1;
528 } 528 }
529 else if (debug_level > 2) 529 else if (debug_level > 2)
530 logmsg (LOG_DEBUG, "%s for triplet %s, spool %s returned %d", 530 logmsg (LOG_DEBUG, "%s for %s@%s returned %d",
531 descr, trp->name, trp->spool->tag, status); 531 descr, trp->name, trp->spool->tag, status);
532 } 532 }
533 else if (WIFSIGNALED (status)) 533 else if (WIFSIGNALED (status))
534 { 534 {
535 int sig = WTERMSIG (status); 535 int sig = WTERMSIG (status);
536 logmsg (LOG_NOTICE, 536 logmsg (LOG_NOTICE,
537 "%s for triplet %s, spool %s terminated on signal %d", 537 "%s for %s@%s terminated on signal %d",
538 descr, trp->name, trp->spool->tag, sig); 538 descr, trp->name, trp->spool->tag, sig);
539 return 1; 539 return 1;
540 } 540 }
541 else 541 else
542 { 542 {
543 logmsg (LOG_NOTICE, 543 logmsg (LOG_NOTICE,
544 "%s for triplet %s, spool %s terminated with unhandled status", 544 "%s for %s@%s terminated with unhandled status",
545 descr, trp->name, trp->spool->tag); 545 descr, trp->name, trp->spool->tag);
546 return 1; 546 return 1;
547 } 547 }
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
40## ------------ ## 40## ------------ ##
41 41
42TESTSUITE_AT = \ 42TESTSUITE_AT = \
43 check-fail.at\
44 check-notify.at\
45 check-ok.at\
43 testsuite.at\ 46 testsuite.at\
44 notify-upl.at\ 47 notify-upl.at\
45 mailstats.at\ 48 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
14WD_DST=@abs_top_builddir@/tests/dest 14WD_DST=@abs_top_builddir@/tests/dest
15 15
16wydawca_init_testdirs() { 16wydawca_init_testdirs() {
17 for dir in "$WD_SRC" "$WD_DST" 17 for dir in "$WD_SRC" "$WD_SRC/test" "${WD_SRC}/fail" "${WD_SRC}/ok" "$WD_DST"
18 do 18 do
19 if test -d "$dir"; then 19 if test -d "$dir"; then
20 rm -rf "$dir"/* 20 rm -rf "$dir"/*
@@ -37,9 +37,11 @@ wydawca_config() {
37} 37}
38 38
39wydawca_upload() { 39wydawca_upload() {
40 dir="$WD_SRC/$1"
41 shift
40 for file in $@ 42 for file in $@
41 do 43 do
42 cp "$WD_DISTDIR/$file" "$WD_SRC" 44 cp "$WD_DISTDIR/$file" "$dir"
43 done 45 done
44} 46}
45 47
diff --git a/tests/check-fail.at b/tests/check-fail.at
new file mode 100644
index 0000000..8d1e86a
--- /dev/null
+++ b/tests/check-fail.at
@@ -0,0 +1,56 @@
1# Check distribution verification tests - failure -*- Autotest -*-
2# Copyright (C) 2010 Sergey Poznyakoff
3#
4# Wydawca is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# Wydawca is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
16
17AT_SETUP([Verification test failure])
18AT_KEYWORDS([uploads check-test check-fail])
19
20AT_DATA([template],
21[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
22wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite
23wydawca: [[ERR]] spool check script for file@ckfail returned 1
24wydawca: [[INFO]] errors: 1
25wydawca: [[INFO]] warnings: 0
26wydawca: [[INFO]] bad signatures: 0
27wydawca: [[INFO]] access violation attempts: 0
28wydawca: [[INFO]] complete triplets: 1
29wydawca: [[INFO]] incomplete triplets: 0
30wydawca: [[INFO]] bad triplets: 0
31wydawca: [[INFO]] expired triplets: 0
32wydawca: [[INFO]] triplet successes: 0
33wydawca: [[INFO]] files uploaded: 0
34wydawca: [[INFO]] files archived: 0
35wydawca: [[INFO]] symlinks created: 0
36wydawca: [[INFO]] symlinks removed: 0
37wydawca: [[INFO]] check failures: 1
38wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
39])
40
41AT_CHECK([
42wydawca_init_testdirs
43wydawca_config wydawca.rc
44wydawca_upload fail file file.directive.asc file.sig
45
46wydawca_expandmeta template experr
47
48wydawca --no-preproc -c wydawca.rc
49],
50[0],
51[],
52[experr])
53
54wydawca_clean_testdirs
55
56AT_CLEANUP
diff --git a/tests/check-notify.at b/tests/check-notify.at
new file mode 100644
index 0000000..16ae296
--- /dev/null
+++ b/tests/check-notify.at
@@ -0,0 +1,86 @@
1# Check distribution verification tests - failure notification -*- Autotest -*-
2# Copyright (C) 2010 Sergey Poznyakoff
3#
4# Wydawca is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# Wydawca is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with Wydawca. If not, see <http://www.gnu.org/licenses/>.
16
17AT_SETUP([Verification test failure notification])
18AT_KEYWORDS([uploads check-test check-fail check-fail-notify notify])
19
20AT_DATA([template],
21[wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started
22wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite
23wydawca: [[ERR]] spool check script for file@ckfail returned 1
24wydawca: [[INFO]] errors: 1
25wydawca: [[INFO]] warnings: 0
26wydawca: [[INFO]] bad signatures: 0
27wydawca: [[INFO]] access violation attempts: 0
28wydawca: [[INFO]] complete triplets: 1
29wydawca: [[INFO]] incomplete triplets: 0
30wydawca: [[INFO]] bad triplets: 0
31wydawca: [[INFO]] expired triplets: 0
32wydawca: [[INFO]] triplet successes: 0
33wydawca: [[INFO]] files uploaded: 0
34wydawca: [[INFO]] files archived: 0
35wydawca: [[INFO]] symlinks created: 0
36wydawca: [[INFO]] symlinks removed: 0
37wydawca: [[INFO]] check failures: 1
38wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished
39])
40
41AT_DATA([outtmpl],
42[-F wydawca-noreply@localhost @USER@@localhost
43=========
44From: wydawca-noreply@localhost
45To: "Wydawca Test User" <@USER@@localhost>
46Subject: file rejected
47X-Mailer: AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION)
48
49Your upload of file has been rejected by the distribution
50verification procedure with the following diagnostics:
51
52WYDAWCA_SPOOL=ckfail
53WYDAWCA_SOURCE=@WD_SRC@/fail
54WYDAWCA_DEST=@WD_DST@
55WYDAWCA_URL=ftp://wydawca.ckfail
56WYDAWCA_TRIPLET_BASE=file
57WYDAWCA_DIST_FILE=file
58
59Please fix the tarball and resubmit.
60
61Regards,
62Wydawca
63The Project Submission Robot
64])
65
66AT_CHECK([
67wydawca_init_testdirs
68wydawca_config wydawca.rc
69mv wydawca.rc simple.rc
70cat $WD_CONFSRC/notify.rc simple.rc > wydawca.rc