You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2006/12/14 14:49:52 UTC

svn commit: r487210 - in /spamassassin/trunk/t: spamd_kill_restart.t spamd_kill_restart_rr.t

Author: jm
Date: Thu Dec 14 05:49:51 2006
New Revision: 487210

URL: http://svn.apache.org/viewvc?view=rev&rev=487210
Log:
still test failures on the zone.  try to kill one possible race condition, in case that's causing them

Modified:
    spamassassin/trunk/t/spamd_kill_restart.t
    spamassassin/trunk/t/spamd_kill_restart_rr.t

Modified: spamassassin/trunk/t/spamd_kill_restart.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_kill_restart.t?view=diff&rev=487210&r1=487209&r2=487210
==============================================================================
--- spamassassin/trunk/t/spamd_kill_restart.t (original)
+++ spamassassin/trunk/t/spamd_kill_restart.t Thu Dec 14 05:49:51 2006
@@ -27,6 +27,19 @@
   dbgprint "killing spamd at pid $pid1, loop try $retry...\n";
   ok ($pid1 != 0 and kill ('INT', $pid1));
 
+# ensure we wait for the exit to happen; under load, we could
+# still be waiting at this point for the spamd to receive the
+# signal
+
+  dbgprint "Waiting for spamd at pid $pid1 to exit...\n";
+  my $timeout = 20;
+  do {
+    # no increase in the timeout here
+    sleep (1) if $timeout > 0;
+    $timeout--;
+  } while(-e $pid_file && $timeout);
+  ok (!-e $pid_file);
+
 # override these so the old logs are still visible and the new
 # spamd will be started even though stop_spamd() was not called
   $spamd_pid = 0;
@@ -84,3 +97,4 @@
   #} until ($npid != $opid or $timeout == 0);
   return $npid;
 }
+

Modified: spamassassin/trunk/t/spamd_kill_restart_rr.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_kill_restart_rr.t?view=diff&rev=487210&r1=487209&r2=487210
==============================================================================
--- spamassassin/trunk/t/spamd_kill_restart_rr.t (original)
+++ spamassassin/trunk/t/spamd_kill_restart_rr.t Thu Dec 14 05:49:51 2006
@@ -16,25 +16,40 @@
 
 my($pid1, $pid2);
 
-print "Starting spamd...\n";
+sub dbgprint { print STDERR "[".time()."] ".$_[0]; }
+
+dbgprint "Starting spamd...\n";
 start_spamd("-L --round-robin -r ${pid_file}");
 sleep 1;
 
 for $retry (0 .. 9) {
   ok ($pid1 = get_pid());
-  print "killing spamd at pid $pid1, loop try $retry...\n";
+  dbgprint "killing spamd at pid $pid1, loop try $retry...\n";
   ok ($pid1 != 0 and kill ('INT', $pid1));
 
+# ensure we wait for the exit to happen; under load, we could
+# still be waiting at this point for the spamd to receive the
+# signal
+
+  dbgprint "Waiting for spamd at pid $pid1 to exit...\n";
+  my $timeout = 20;
+  do {
+    # no increase in the timeout here
+    sleep (1) if $timeout > 0;
+    $timeout--;
+  } while(-e $pid_file && $timeout);
+  ok (!-e $pid_file);
+
 # override these so the old logs are still visible and the new
 # spamd will be started even though stop_spamd() was not called
   $spamd_pid = 0;
   $testname = "spamd_kill_restart_rr_retry_".$retry;
 
-  print "starting new spamd, loop try $retry...\n";
+  dbgprint "starting new spamd, loop try $retry...\n";
   start_spamd("-D -L --round-robin -r ${pid_file}");
   ok ($pid1 = get_pid());
 
-  print "Waiting for spamd at pid $pid1 to restart...\n";
+  dbgprint "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;
@@ -46,13 +61,13 @@
   ok (-e $pid_file);
 
   ok ($pid2 = get_pid($pid1));
-  print "Looking for new spamd at pid $pid2...\n";
+  dbgprint "Looking for new spamd at pid $pid2...\n";
   ok ($pid2 != 0 and kill (0, $pid2));
 
   $pid1 = $pid2;
 }
 
-  print "Checking GTUBE...\n";
+  dbgprint "Checking GTUBE...\n";
   %patterns = (
     q{ X-Spam-Flag: YES } => 'flag',
     q{ GTUBE }            => 'gtube',
@@ -61,7 +76,7 @@
   ok_all_patterns;
 
 
-print "Stopping spamd...\n";
+dbgprint "Stopping spamd...\n";
 stop_spamd;
 
 
@@ -82,3 +97,4 @@
   #} until ($npid != $opid or $timeout == 0);
   return $npid;
 }
+