[exim-cvs] Testsuite: better sorting for exim_dumpdb output

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Exim Git Commits Mailing List
Ημερομηνία:  
Προς: exim-cvs
Αντικείμενο: [exim-cvs] Testsuite: better sorting for exim_dumpdb output
Gitweb: https://git.exim.org/exim.git/commitdiff/3b90b1d1cde55d00590193db15fd6c7dd87f34c8
Commit:     3b90b1d1cde55d00590193db15fd6c7dd87f34c8
Parent:     90d0db05230b351bc6252f2b64df2e8966e6a203
Author:     Heiko Schlittermann (HS12-RIPE) <hs@???>
AuthorDate: Sat Nov 16 21:37:00 2019 +0800
Committer:  Heiko Schlittermann (HS12-RIPE) <hs@???>
CommitDate: Sun Nov 17 08:07:11 2019 +0800


    Testsuite: better sorting for exim_dumpdb output
---
 test/runtest | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)


diff --git a/test/runtest b/test/runtest
index d41e3c9..e8a3e8e 100755
--- a/test/runtest
+++ b/test/runtest
@@ -2168,16 +2168,15 @@ if (/^dump\s+(\S+)/)

   if ($which eq "retry")
     {
-    $/ = "\n  ";
-    @temp = <IN>;
-    $/ = "\n";
-
-    @temp = sort {
-                   my($aa) = split(' ', $a);
-                   my($bb) = split(' ', $b);
-                   return $aa cmp $bb;
-                 } @temp;
-
+    # the sort key is the first part of the retry db dump line, but for
+    # sorting we (temporarly) replace the own hosts ipv4 with a munged
+    # version, which matches the munging that is done later
+    # Why? We must ensure sure, that 127.0.0.1 always sorts first
+    # map-sort-map: Schwartz's transformation
+    my @temp = map  { $_->[1] }
+               sort { $a->[0] cmp $b->[0] }
+               map  { [ (split)[0] =~ s/\Q$parm_ipv4/ip4.ip4.ip4.ip4/gr, $_ ] }
+               do { local $/ = "\n  "; <$in> };
     foreach $item (@temp)
       {
       $item =~ s/^\s*(.*)\n(.*)\n?\s*$/$1\n$2/m;