diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-01-02 18:50:14 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-01-02 18:50:14 +0200 |
commit | 1b0a4de9fa73dd2453cbd2902c2cd4d000f4abe7 (patch) | |
tree | 061ee328e2464d5bed9f5882642fbc25d32de8bc | |
parent | a510f517e1aff073e6b37a5fa9e8ed825de836af (diff) | |
download | wydawca-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.c | 8 | ||||
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rw-r--r-- | tests/atlocal.in | 6 | ||||
-rw-r--r-- | tests/check-fail.at | 56 | ||||
-rw-r--r-- | tests/check-notify.at | 86 | ||||
-rw-r--r-- | tests/check-ok.at | 56 | ||||
-rw-r--r-- | tests/etc/notify.rc | 20 | ||||
-rw-r--r-- | tests/etc/wydawca.rcin | 27 | ||||
-rw-r--r-- | tests/mailstats.at | 2 | ||||
-rw-r--r-- | tests/notify-upl.at | 3 | ||||
-rw-r--r-- | tests/testsuite.at | 4 | ||||
-rw-r--r-- | tests/upload-dry.at | 6 | ||||
-rw-r--r-- | tests/upload.at | 2 |
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 | ||
42 | TESTSUITE_AT = \ | 42 | TESTSUITE_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 | |||
14 | WD_DST=@abs_top_builddir@/tests/dest | 14 | WD_DST=@abs_top_builddir@/tests/dest |
15 | 15 | ||
16 | wydawca_init_testdirs() { | 16 | wydawca_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 | ||
39 | wydawca_upload() { | 39 | wydawca_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 | |||
17 | AT_SETUP([Verification test failure]) | ||
18 | AT_KEYWORDS([uploads check-test check-fail]) | ||
19 | |||
20 | AT_DATA([template], | ||
21 | [wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started | ||
22 | wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite | ||
23 | wydawca: [[ERR]] spool check script for file@ckfail returned 1 | ||
24 | wydawca: [[INFO]] errors: 1 | ||
25 | wydawca: [[INFO]] warnings: 0 | ||
26 | wydawca: [[INFO]] bad signatures: 0 | ||
27 | wydawca: [[INFO]] access violation attempts: 0 | ||
28 | wydawca: [[INFO]] complete triplets: 1 | ||
29 | wydawca: [[INFO]] incomplete triplets: 0 | ||
30 | wydawca: [[INFO]] bad triplets: 0 | ||
31 | wydawca: [[INFO]] expired triplets: 0 | ||
32 | wydawca: [[INFO]] triplet successes: 0 | ||
33 | wydawca: [[INFO]] files uploaded: 0 | ||
34 | wydawca: [[INFO]] files archived: 0 | ||
35 | wydawca: [[INFO]] symlinks created: 0 | ||
36 | wydawca: [[INFO]] symlinks removed: 0 | ||
37 | wydawca: [[INFO]] check failures: 1 | ||
38 | wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished | ||
39 | ]) | ||
40 | |||
41 | AT_CHECK([ | ||
42 | wydawca_init_testdirs | ||
43 | wydawca_config wydawca.rc | ||
44 | wydawca_upload fail file file.directive.asc file.sig | ||
45 | |||
46 | wydawca_expandmeta template experr | ||
47 | |||
48 | wydawca --no-preproc -c wydawca.rc | ||
49 | ], | ||
50 | [0], | ||
51 | [], | ||
52 | [experr]) | ||
53 | |||
54 | wydawca_clean_testdirs | ||
55 | |||
56 | AT_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 | |||
17 | AT_SETUP([Verification test failure notification]) | ||
18 | AT_KEYWORDS([uploads check-test check-fail check-fail-notify notify]) | ||
19 | |||
20 | AT_DATA([template], | ||
21 | [wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) started | ||
22 | wydawca: [[NOTICE]] file.directive.asc: COMMENT: Gnupload for Wydawca testsuite | ||
23 | wydawca: [[ERR]] spool check script for file@ckfail returned 1 | ||
24 | wydawca: [[INFO]] errors: 1 | ||
25 | wydawca: [[INFO]] warnings: 0 | ||
26 | wydawca: [[INFO]] bad signatures: 0 | ||
27 | wydawca: [[INFO]] access violation attempts: 0 | ||
28 | wydawca: [[INFO]] complete triplets: 1 | ||
29 | wydawca: [[INFO]] incomplete triplets: 0 | ||
30 | wydawca: [[INFO]] bad triplets: 0 | ||
31 | wydawca: [[INFO]] expired triplets: 0 | ||
32 | wydawca: [[INFO]] triplet successes: 0 | ||
33 | wydawca: [[INFO]] files uploaded: 0 | ||
34 | wydawca: [[INFO]] files archived: 0 | ||
35 | wydawca: [[INFO]] symlinks created: 0 | ||
36 | wydawca: [[INFO]] symlinks removed: 0 | ||
37 | wydawca: [[INFO]] check failures: 1 | ||
38 | wydawca: [[NOTICE]] AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) finished | ||
39 | ]) | ||
40 | |||
41 | AT_DATA([outtmpl], | ||
42 | [-F wydawca-noreply@localhost @USER@@localhost | ||
43 | ========= | ||
44 | From: wydawca-noreply@localhost | ||
45 | To: "Wydawca Test User" <@USER@@localhost> | ||
46 | Subject: file rejected | ||
47 | X-Mailer: AT_PACKAGE_TARNAME (AT_PACKAGE_NAME AT_PACKAGE_VERSION) | ||
48 | |||
49 | Your upload of file has been rejected by the distribution | ||
50 | verification procedure with the following diagnostics: | ||
51 | |||
52 | WYDAWCA_SPOOL=ckfail | ||
53 | WYDAWCA_SOURCE=@WD_SRC@/fail | ||
54 | WYDAWCA_DEST=@WD_DST@ | ||
55 | WYDAWCA_URL=ftp://wydawca.ckfail | ||
56 | WYDAWCA_TRIPLET_BASE=file | ||
57 | WYDAWCA_DIST_FILE=file | ||
58 | |||
59 | Please fix the tarball and resubmit. | ||
60 | |||
61 | Regards, | ||
62 | Wydawca | ||
63 | The Project Submission Robot | ||
64 | ]) | ||
65 | |||
66 | AT_CHECK([ | ||
67 | wydawca_init_testdirs | ||
68 | wydawca_config wydawca.rc | ||
69 | mv wydawca.rc simple.rc | ||
70 | cat $WD_CONFSRC/notify.rc simple.rc > wydawca.rc | ||