Mailing List Archive

svn commit: r178127 - /spamassassin/trunk/t/spamd_hup.t
Author: jm
Date: Tue May 24 00:16:11 2005
New Revision: 178127

URL: http://svn.apache.org/viewcvs?rev=178127&view=rev
Log:
try HUPping several times to catch more possible problems

Modified:
spamassassin/trunk/t/spamd_hup.t

Modified: spamassassin/trunk/t/spamd_hup.t
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/t/spamd_hup.t?rev=178127&r1=178126&r2=178127&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_hup.t (original)
+++ spamassassin/trunk/t/spamd_hup.t Tue May 24 00:16:11 2005
@@ -4,7 +4,7 @@
use SATest; sa_t_init("spamd_hup");
use constant TEST_ENABLED => !$SKIP_SPAMD_TESTS && !$RUNNING_ON_WINDOWS;

-use Test; BEGIN { plan tests => (TEST_ENABLED? 8 : 0) };
+use Test; BEGIN { plan tests => (TEST_ENABLED? 80 : 0) };

use File::Spec;

@@ -20,33 +20,37 @@
start_spamd("-L -r ${pid_file}");
sleep 1;

-ok ($pid1 = get_pid());
-print "HUPing spamd at pid $pid1...\n";
-ok ($pid1 != 0 and kill ('HUP', $pid1));
+for $retry (0 .. 9) {
+ ok ($pid1 = get_pid());
+ print "HUPing spamd at pid $pid1, loop try $retry...\n";
+ ok ($pid1 != 0 and kill ('HUP', $pid1));

-print "Waiting for spamd at pid $pid1 to restart...\n";
+ print "Waiting for spamd at pid $pid1 to restart...\n";
# note that the wait period increases the longer it takes,
# 20 retries works out to a total of 60 seconds
-my $timeout = 20;
-my $wait = 0;
- do {
- sleep (int($wait++ / 4) + 1) if $timeout > 0;
- $timeout--;
-} while(!-e $pid_file && $timeout);
-ok (-e $pid_file);
+ my $timeout = 20;
+ my $wait = 0;
+ do {
+ sleep (int($wait++ / 4) + 1) if $timeout > 0;
+ $timeout--;
+ } while(!-e $pid_file && $timeout);
+ ok (-e $pid_file);

-ok ($pid2 = get_pid($pid1));
-print "Looking for new spamd at pid $pid2...\n";
+ ok ($pid2 = get_pid($pid1));
+ print "Looking for new spamd at pid $pid2...\n";
#ok ($pid2 != $pid1);
-ok ($pid2 != 0 and kill (0, $pid2));
+ ok ($pid2 != 0 and kill (0, $pid2));

-print "Checking GTUBE...\n";
-%patterns = (
- q{ X-Spam-Flag: YES } => 'flag',
- q{ GTUBE } => 'gtube',
-);
-ok (spamcrun ("< data/spam/gtube.eml", \&patterns_run_cb));
-ok_all_patterns;
+ print "Checking GTUBE...\n";
+ %patterns = (
+ q{ X-Spam-Flag: YES } => 'flag',
+ q{ GTUBE } => 'gtube',
+ );
+ ok (spamcrun ("< data/spam/gtube.eml", \&patterns_run_cb));
+ ok_all_patterns;
+
+ $pid1 = $pid2;
+}


print "Stopping spamd...\n";