Re: [exim-dev] Preliminary testing of a new Exim test suite

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Philip Hazel
Fecha:  
A: Daniel Tiefnig
Cc: exim-dev
Asunto: Re: [exim-dev] Preliminary testing of a new Exim test suite
On Wed, 30 Nov 2005, Daniel Tiefnig wrote:

> I don't think so. The problem would be more like one of the messages
> gets delayed and is received after the next message in the test.


Which is totally strange, because every message is submitted with -odi,
which causes the submitting Exim not to exit until the delivery is
complete. So every message should be delivered before the next one is
submitted.

Wait, wait, wait! I'm right after all, I think.

> 1133279114.H450345P17289.myhost.test.ex
> 1133279114.H846792P17297.myhost.test.ex:S370
> 1133279114.H94773P17285.myhost.test.ex
> 1133279116.H196585P17301.myhost.test.ex,S=370
> 1133279117.H537130P17305.myhost.test.ex
> 1133279119.H921081P17314.myhost.test.ex
> 1133279121.H262283P17318.myhost.test.ex,S=10694953:2,S
>
> The Messages are out of order.


In a different order, yes. The problem is the H part of the name. The
number that follows H is the microseconds of the time. However, it
doesn't come with leading zeros, which is why you get

> 1133279114.H846792P17297.myhost.test.ex:S370
> 1133279114.H94773P17285.myhost.test.ex


The second one should be sorted first because 94773 is less than 846792.
I can fix this by using a correct sorting algorithm. Please try the
patch below.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book




*** Releases/exim-testsuite-0.00/runtest    Thu Nov 24 09:03:40 2005
--- runtest    Wed Nov 30 14:50:17 2005
***************
*** 195,200 ****
--- 199,216 ----
  }



+ # This is a subroutine to sort maildir files into time-order. The second field
+ # is the microsecond field, and may vary in length, so must be compared
+ # numerically.
+
+ sub maildirsort {
+ return $a cmp $b if ($a !~ /^\d/ || $b !~ /^\d/);
+ my($x1,$y1) = $a =~ /^(\d+)\.H(\d+)/;
+ my($x2,$y2) = $b =~ /^(\d+)\.H(\d+)/;
+ return ($x1 != $x2)? ($x1 <=> $x2) : ($y1 <=> $y2);
+ }
+
+

  ##################################################
  #         Munge a file before comparing          #
***************
*** 964,970 ****
        {
        opendir(DIR, "test-mail/$mail") ||
          tests_exit(-1, "Failed to opendir test-mail/$mail: $!");
!       @submails = sort readdir(DIR);
        closedir(DIR);


        my($msgno) = 0;
--- 980,986 ----
        {
        opendir(DIR, "test-mail/$mail") ||
          tests_exit(-1, "Failed to opendir test-mail/$mail: $!");
!       @submails = sort maildirsort readdir(DIR);
        closedir(DIR);


        my($msgno) = 0;