diff options
Diffstat (limited to 'agent/test')
-rwxr-xr-x | agent/test/TEST | 3 | ||||
-rw-r--r-- | agent/test/actions | 6 | ||||
-rw-r--r-- | agent/test/cmd/biff.t | 39 | ||||
-rw-r--r-- | agent/test/cmd/post.t | 21 | ||||
-rw-r--r-- | agent/test/cmd/save.t | 20 | ||||
-rw-r--r-- | agent/test/filter/base64.t | 2 | ||||
-rw-r--r-- | agent/test/filter/qp.t | 2 | ||||
-rw-r--r-- | agent/test/getopt.pl | 2 | ||||
-rw-r--r-- | agent/test/mail-long | 20 | ||||
-rw-r--r-- | agent/test/mime | 4 | ||||
-rw-r--r-- | agent/test/mime-recursive | 47 | ||||
-rw-r--r-- | agent/test/option/U.t | 2 | ||||
-rw-r--r-- | agent/test/pl/cmd.pl | 2 | ||||
-rw-r--r-- | agent/test/pl/filter.pl | 2 | ||||
-rw-r--r-- | agent/test/pl/init.pl | 2 | ||||
-rw-r--r-- | agent/test/pl/logfile.pl | 2 | ||||
-rw-r--r-- | agent/test/pl/mail.pl | 2 | ||||
-rw-r--r-- | agent/test/pl/misc.pl | 18 | ||||
-rw-r--r-- | agent/test/pl/mta.pl | 2 |
19 files changed, 165 insertions, 33 deletions
diff --git a/agent/test/TEST b/agent/test/TEST index 6977049..41c588f 100755 --- a/agent/test/TEST +++ b/agent/test/TEST @@ -58,6 +58,7 @@ $how_many = 0; require './getopt.pl'; &Getopt; + $mailagent = 'mailagent'; # Default program (dataloaded version) $mailagent = 'magent' if $opt_n; # Use non-dataloaded version $ENV{'MAILAGENT'} = $mailagent; @@ -67,7 +68,6 @@ $ENV{'PATH'} = "$pwd/..:.:" . $ENV{'PATH'}; -f '../filter/filter' && -x _ || die "No filter.\n"; $> || die "Cannot run tests as super-user. [$<,$>]\n"; - &load_ok; # Don't rerun successful tests if up to date # A level file indicates default loglvl @@ -115,7 +115,6 @@ select(OK); $| = 1; # We may safely interrupt select(STDOUT); - foreach $dir (@tests) { next unless -d $dir; &run($dir); diff --git a/agent/test/actions b/agent/test/actions index 0a99d4d..695bee2 100644 --- a/agent/test/actions +++ b/agent/test/actions @@ -67,13 +67,13 @@ maildir = ~; -X-Tag: /abort/ +X-Tag: /abort/ # trailing comment (space required after the '#') { ABORT -f; - SAVE always; + SAVE always; # trailing comment ABORT; SAVE %u.1; -} +} # trailing comment X-Tag: /annotate/ { diff --git a/agent/test/cmd/biff.t b/agent/test/cmd/biff.t index c1890f9..fbd687b 100644 --- a/agent/test/cmd/biff.t +++ b/agent/test/cmd/biff.t @@ -82,29 +82,42 @@ cp_mail("../mime"); &add_header('X-Tag: biff 3'); &make_tty(0, 0777, 40); # 40 & 41 `$cmd`; -$? == 0 || print "41\n"; --f 'ok' || print "42\n"; --s 'tty0' || print "43\n"; -&get_log(44, 'tty0'); -¬_log('--foo', 45); -&check_log('^Got mail in ~/ok', 46) == 1 || print "47\n"; -&check_log('successfully decoded', 48) == 1 || print "49\n"; +$? == 0 || print "42\n"; +-f 'ok' || print "43\n"; +-s 'tty0' || print "44\n"; +&get_log(45, 'tty0'); +¬_log('--foo', 46); +&check_log('^Got mail in ~/ok', 47) == 1 || print "48\n"; +&check_log('successfully decoded', 49) == 1 || print "50\n"; &cleanup; cp_mail("../qp"); my $subject = <<EOM; -Subject: =?Cp1252?Q?Perl:_La_haute_tec?= - =?Cp1252?Q?hnicit=E9_au_service_des_professionnels?= +Subject: =?latin1?Q?Perl:_La_haute_technicit=E9_au_service_des_professionnels?= EOM chop $subject; &replace_header($subject); &add_header('X-Tag: biff 3'); -&make_tty(0, 0777, 50); # 50 & 51 +&make_tty(0, 0777, 50); # 51 & 52 `$cmd`; -$? == 0 || print "52\n"; -&get_log(53, 'tty0'); +$? == 0 || print "53\n"; +&get_log(54, 'tty0'); &check_log( - 'Subject: Perl: La haute technicité au service des professionnels', 54); + 'Subject: Perl: La haute technicité au service des professionnels', 55); +&cleanup; + +cp_mail("../mime-recursive"); +&add_header('X-Tag: biff 3'); +&make_tty(0, 0777, 40); # 56 & 57 +`$cmd`; +$? == 0 || print "58\n"; +-f 'ok' || print "59\n"; +-s 'tty0' || print "60\n"; +&get_log(61, 'tty0'); +¬_log('--foo', 62); +¬_log('--bar', 63); +&check_log('^Got mail in ~/ok', 64) == 1 || print "65\n"; +&check_log('successfully decoded', 66) == 1 || print "67\n"; &cleanup; unlink 'mail'; diff --git a/agent/test/cmd/post.t b/agent/test/cmd/post.t index 9c0d705..a216d51 100644 --- a/agent/test/cmd/post.t +++ b/agent/test/cmd/post.t @@ -17,6 +17,7 @@ do '../pl/cmd.pl'; do '../pl/mta.pl'; +do '../pl/misc.pl'; &add_header('X-Tag: post 1'); `$cmd`; @@ -60,6 +61,24 @@ $? == 0 || print "15\n"; # 1 EOH + 3 paragraphs in mail &check_log('^$', 17) == 4 or print "18\n"; +unlink 'mail', 'list', 'send.news'; + +&cp_mail("../mail-long"); +&add_header('X-Tag: post 1'); +`$cmd`; +$? == 0 || print "19\n"; +-f "$user" && print "20\n"; # Mail not saved +-f 'send.news' || print "21\n"; # Mail processed + +# These strings must not be cut (this is around the 78 character limit) +my @long = ( + "character_limit_and_must_therefore", + "9207030043.AA04311\@iecc.cambridge.ma.us" +); +for (my $i = 0; $i < @long; $i++) { + &contains_string('send.news', $long[$i]) || print 22 + $i, "\n"; +} + +unlink 'mail'; &clear_mta; -unlink 'mail', 'list'; print "0\n"; diff --git a/agent/test/cmd/save.t b/agent/test/cmd/save.t index 738bd31..c35208e 100644 --- a/agent/test/cmd/save.t +++ b/agent/test/cmd/save.t @@ -71,11 +71,29 @@ $? == 0 || print "15\n"; -f 'ok' || print "16\n"; $size = -s 'ok'; -&add_option('-o fromfake: OFF'); +&add_option('-o "fromfake: OFF"'); `$cmd`; $? == 0 || print "17\n"; &get_log(18, 'ok'); &check_log('^From: ', 19) == 1 || print "20\n"; unlink "$mbox", "$user", 'mail', 'ok'; + +cp_mail("../mail-long"); +&add_header('X-Tag: save #1'); +`$cmd`; +$? == 0 || print "21\n"; +-f "$mbox" || print "22\n"; # Mail saved here +-f "$user" && print "23\n"; # Must not exist! + +# These strings must not be cut (this is around the 78 character limit) +my @long = ( + "character_limit_and_must_therefore", + "9207030043.AA04311\@iecc.cambridge.ma.us" +); +for (my $i = 0; $i < @long; $i++) { + &contains_string('mbox', $long[$i]) || print 24 + $i, "\n"; +} + +unlink "$mbox", "$user", 'mail', 'ok'; print "0\n"; diff --git a/agent/test/filter/base64.t b/agent/test/filter/base64.t index 2faf229..48832a5 100644 --- a/agent/test/filter/base64.t +++ b/agent/test/filter/base64.t @@ -1,6 +1,6 @@ # Check base64 body decoding for matching -# $Id: base64.t 38 2008-06-13 09:32:24Z rmanfredi $ +# $Id$ # # Copyright (c) 2008, Raphael Manfredi # diff --git a/agent/test/filter/qp.t b/agent/test/filter/qp.t index dde74a5..65fcd92 100644 --- a/agent/test/filter/qp.t +++ b/agent/test/filter/qp.t @@ -1,6 +1,6 @@ # Check quoted-printable body decoding for matching -# $Id: qp.t 38 2008-06-13 09:32:24Z rmanfredi $ +# $Id$ # # Copyright (c) 2008, Raphael Manfredi # diff --git a/agent/test/getopt.pl b/agent/test/getopt.pl index cba4ede..6b92cb5 100644 --- a/agent/test/getopt.pl +++ b/agent/test/getopt.pl @@ -1,4 +1,4 @@ -;# $RCSfile: getopt.pl,v $$Revision: 77 $$Date: 2012-01-08 15:55:16 -0800 (Sun, 08 Jan 2012) $ +;# $RCSfile: getopt.pl,v $$Revision$$Date$ # # This library is no longer being maintained, and is included for backward # compatibility with Perl 4 programs which may require it. diff --git a/agent/test/mail-long b/agent/test/mail-long new file mode 100644 index 0000000..e219ff1 --- /dev/null +++ b/agent/test/mail-long @@ -0,0 +1,20 @@ +From compilers-request@iecc.cambridge.ma.us Sun Jul 12 14:45:54 PDT 1992 +Received: from eiffel.eiffel.com by lyon.eiffel.com (5.61/1.34) + id AA13012; Thu, 2 Jul 92 22:34:10 -0700 +Received: from uunet.UUCP by eiffel.eiffel.com (4.0/SMI-4.0) + id AA09695; Thu, 2 Jul 92 22:31:36 PDT +Received: from ursa-major.spdcc.com by relay2.UU.NET with SMTP + (5.61/UUNET-internet-primary) id AA21794; Fri, 3 Jul 92 01:17:38 -0400 +Received: by ursa-major.spdcc.com with sendmail-5.65/4.7 + id <AA13205@ursa-major.spdcc.com>; Fri, 3 Jul 92 01:17:34 -0400 +Received: by iecc.cambridge.ma.us (smail2.5+) + id AA04311; 3 Jul 92 00:43:22 EDT (Fri) +To: ram@eiffel.com, foo@bar.com, anonymous@example-domain.com, + root@another-domain.com, bar@another-long-domain-name.com, another_user@example.com +Long-Header: this_is_too_long_to_be_cut_shorter_than_our_about_eighty_character_limit_and_must_therefore_be_atomically_emitted +From: compilers-request@iecc.cambridge.ma.us +Subject: Re: melting ice technology? +Date: 3 Jul 92 00:43:22 EDT (Fri) +Message-Id: <making_this_intentionally_longer_than_it_should_be.9207030043.AA04311@iecc.cambridge.ma.us> + +Text body diff --git a/agent/test/mime b/agent/test/mime index 8e05599..0b41848 100644 --- a/agent/test/mime +++ b/agent/test/mime @@ -10,8 +10,8 @@ Message-ID: <D42E3A26BC29C94DB4CC3DA3569AE82B0157AE42DE@GVW1088EXB.pobox.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="foo" Status: RO -Content-Length: 609 -Lines: 22 +Content-Length: 610 +Lines: 23 --foo Content-Type: text/html; charset="iso8859-1" diff --git a/agent/test/mime-recursive b/agent/test/mime-recursive new file mode 100644 index 0000000..a560289 --- /dev/null +++ b/agent/test/mime-recursive @@ -0,0 +1,47 @@ +From raphael_manfredi@pobox.com Tue Jun 10 17:44:12 2008 +Received: from tours.ram.loc (fetchmail@localhost [127.0.0.1]) + by tours.ram.loc (8.14.3/8.13.8/Debian-3) with ESMTP id m5AFiCJq002957 + for <ram@localhost>; Tue, 10 Jun 2008 17:44:12 +0200 +From: "Raphael Manfredi" <Raphael_Manfredi@pobox.com> +To: "Raphael Manfredi" <Raphael_Manfredi@pobox.com> +Date: Tue, 10 Jun 2008 15:35:21 +0000 +Subject: Sample recursive MIME message +Message-ID: <D42E3A26BC29C94DB4CC3DA3569AE82B0157AE42DE@GVW1088EXB.pobox.com> +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="bar" +Status: RO +Content-Length: 748 +Lines: 32 + +--bar +Content-Type: multipart/mixed; boundary="foo" + +--foo +Content-Type: text/html; charset="iso8859-1" + +<html> +<head> + <title>Sample HTML part</title> +</head> +<body> + <p>Sole paragraph</p> +</body> +</html> + +--foo +Content-Type: text/html; charset="utf-8" + +<p>Sample HTML fragment</p> + +--foo-- +--bar +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: base64 +Content-Length: 346 + +VGhpcyBtZXNzYWdlIGlzIG9uZSBiaWcgTUlNRSBwYXJ0IHRoYXQgaGFzIGJlZW4gYmFzZTY0LWVu +Y29kZWQuDQoNClRoZSBtYWlsYWdlbnQgdGVzdCBzdWl0ZSBpcyBnb2luZyB0byBsb29rIGZvciB0 +aGUgZm9sbG93aW5nIGxpbmU6DQoNCiAgICAgICAgKioqIFlFUywgc3VjY2Vzc2Z1bGx5IGRlY29k +ZWQgKioqDQoNCmluIHRoZSBkZWNvZGVkIGJvZHkgYXMgcHJvb2YgdGhhdCB0aGUgYmFzZTY0IGRl +Y29kaW5nIGxvZ2ljIGlzIHdvcmtpbmcuDQo= +--bar-- diff --git a/agent/test/option/U.t b/agent/test/option/U.t index 8a3beca..c6eaa8c 100644 --- a/agent/test/option/U.t +++ b/agent/test/option/U.t @@ -1,6 +1,6 @@ # -U : disable reject / abort of first UNIQUE and REJECT. -# $Id: U.t 11 2008-05-28 15:10:12Z rmanfredi $ +# $Id$ # # Copyright (c) 1990-2006, Raphael Manfredi # diff --git a/agent/test/pl/cmd.pl b/agent/test/pl/cmd.pl index e291996..5fc2b82 100644 --- a/agent/test/pl/cmd.pl +++ b/agent/test/pl/cmd.pl @@ -1,6 +1,6 @@ # Common actions at the top of each command test -;# $Id: cmd.pl 1 2006-08-24 13:24:12Z rmanfredi $ +;# $Id$ ;# ;# Copyright (c) 1990-2006, Raphael Manfredi ;# diff --git a/agent/test/pl/filter.pl b/agent/test/pl/filter.pl index fd2bed3..4c720c1 100644 --- a/agent/test/pl/filter.pl +++ b/agent/test/pl/filter.pl @@ -1,6 +1,6 @@ # Common actions at the top of each filtering test -;# $Id: filter.pl 1 2006-08-24 13:24:12Z rmanfredi $ +;# $Id$ ;# ;# Copyright (c) 1990-2006, Raphael Manfredi ;# diff --git a/agent/test/pl/init.pl b/agent/test/pl/init.pl index c2f8f11..d8596ea 100644 --- a/agent/test/pl/init.pl +++ b/agent/test/pl/init.pl @@ -1,6 +1,6 @@ # Set up mailagent and filter paths -;# $Id: init.pl 1 2006-08-24 13:24:12Z rmanfredi $ +;# $Id$ ;# ;# Copyright (c) 1990-2006, Raphael Manfredi ;# diff --git a/agent/test/pl/logfile.pl b/agent/test/pl/logfile.pl index 67ec46c..90ed307 100644 --- a/agent/test/pl/logfile.pl +++ b/agent/test/pl/logfile.pl @@ -1,6 +1,6 @@ # Get log file (by default) or any other file into @log -;# $Id: logfile.pl 1 2006-08-24 13:24:12Z rmanfredi $ +;# $Id$ ;# ;# Copyright (c) 1990-2006, Raphael Manfredi ;# diff --git a/agent/test/pl/mail.pl b/agent/test/pl/mail.pl index 1651399..b596279 100644 --- a/agent/test/pl/mail.pl +++ b/agent/test/pl/mail.pl @@ -1,6 +1,6 @@ # Utilities to twinkle default mail message -;# $Id: mail.pl 38 2008-06-13 09:32:24Z rmanfredi $ +;# $Id$ ;# ;# Copyright (c) 1990-2006, Raphael Manfredi ;# diff --git a/agent/test/pl/misc.pl b/agent/test/pl/misc.pl index ad9b2df..304d5bd 100644 --- a/agent/test/pl/misc.pl +++ b/agent/test/pl/misc.pl @@ -1,6 +1,6 @@ # Common actions at the top of each misc test -;# $Id: misc.pl 1 2006-08-24 13:24:12Z rmanfredi $ +;# $Id$ ;# ;# Copyright (c) 1990-2006, Raphael Manfredi ;# @@ -27,3 +27,19 @@ sub add_option { $cmd = join(' ', $cmd[0], $opt, @cmd[1..$#cmd]); } +# Check that file contains a given string +sub contains_string { + my ($file, $string) = @_; + local *FILE, $_; + open(FILE, $file) || return 0; + my $matched = 0; + while (<FILE>) { + if (/\Q$string/) { + $matched = 1; + last; + } + } + close FILE; + return $matched; +} + diff --git a/agent/test/pl/mta.pl b/agent/test/pl/mta.pl index 4a2af35..10ccbee 100644 --- a/agent/test/pl/mta.pl +++ b/agent/test/pl/mta.pl @@ -1,6 +1,6 @@ # Basic MTA/NTA for tests -# $Id: mta.pl 1 2006-08-24 13:24:12Z rmanfredi $ +# $Id$ # # Copyright (c) 1990-2006, Raphael Manfredi # |