Re: [exim-dev] New Test Suite in CVS

Top Page
Delete this message
Reply to this message
Author: Daniel Tiefnig
Date:  
To: exim-dev
Subject: Re: [exim-dev] New Test Suite in CVS
Philip Hazel wrote:
> I believe that I have now successfully committed the files of the new
> test suite to the CVS repository, under the directory
> exim/exim-test.


Hmm, AFAIK there is no public (anonymous) CVS access, is there?

> They will be updated as the tests evolve along with the code, and I
> will no longer be running the old test suite.


I assume "old" is "ftp://.../exim/Testing/exim-testsuite-0.00.tar.bz2"?
I prepared a patch to the latest snapshot that adds support for ClamAV
via TCP sockets. The patch is attached to this mail, but now I'm not
sure whether it applies to the CVS version cleanly. Should not be very
tricky, though.

lg,
daniel

PS: I didn't find any problems with the latest snapshot of the test
suite on my debian/sid box.

PPS: There are still the OpenSSL/GnuTLS error messages that bother me.
Might it be possible to just ignore everything after
"TLS error on connection to ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4] "
in the mainlogs? I know this is documented in the README, but I just
can't get it off my mind. :o)
--- exim-testsuite-0.00/runtest    2006-02-03 17:36:33.000000000 +0100
+++ exim-testsuite-0.00.patched/runtest    2006-02-07 12:04:31.000000000 +0100
@@ -2098,28 +2098,71 @@


     if ($clamconf ne "")
       {
+      my $socket_domain;
       open(IN, "$clamconf") || die "\n** Unable to open $clamconf: $!\n";
       while (<IN>)
         {
         if (/^LocalSocket\s+(.*)/)
           {
           $parm_clamsocket = $1;
+          $socket_domain = AF_UNIX;
           last;
           }
+        if (/^TCPSocket\s+(\d+)/)
+          {
+          if(defined $parm_clamsocket)
+            {
+            $parm_clamsocket .= " $1";
+            $socket_domain = AF_INET;
+            last;
+            }
+          else
+            {
+            $parm_clamsocket = " $1";
+            }
+          }
+        elsif (/^TCPAddr\s+(\S+)/)
+          {
+          if(defined $parm_clamsocket)
+            {
+            $parm_clamsocket = $1 . $parm_clamsocket;
+            $socket_domain = AF_INET;
+            last;
+            }
+          else
+            {
+            $parm_clamsocket = $1;
+            }
+          }
         }
+
       close(IN);
-      if (-e $parm_clamsocket)
+      if (defined $socket_domain)
         {
         print ":\n  The clamd socket is $parm_clamsocket\n";
         # This test for an active ClamAV is courtesy of Daniel Tiefnig.
         eval
           {
-          my $sun = sockaddr_un($parm_clamsocket) or die "** Failed packing '$parm_clamsocket'\n";
-          socket(SOCK, AF_UNIX, SOCK_STREAM, 0) or die "** Unable to open socket '$parm_clamsocket'\n";
+          my $socket;
+          if ($socket_domain == AF_UNIX)
+            {
+            $socket = sockaddr_un($parm_clamsocket) or die "** Failed packing '$parm_clamsocket'\n";
+            }
+          elsif ($socket_domain == AF_INET)
+            {
+            my ($ca_host, $ca_port) = split(/\s+/,$parm_clamsocket);
+            my $ca_hostent = gethostbyname($ca_host) or die "** Failed to get raw address for host '$ca_host'\n";
+            $socket = sockaddr_in($ca_port, $ca_hostent) or die "** Failed packing '$parm_clamsocket'\n";
+            }
+          else
+            {
+            die "** Unknown socket domain '$socket_domain' (should not happen)\n";
+            }
+          socket(SOCK, $socket_domain, SOCK_STREAM, 0) or die "** Unable to open socket '$parm_clamsocket'\n";


           local $SIG{ALRM} = sub { die "** Timeout while connecting to socket '$parm_clamsocket'\n"; };
           alarm(5);
-          connect(SOCK, $sun) or die "** Unable to connect to socket '$parm_clamsocket'\n";
+          connect(SOCK, $socket) or die "** Unable to connect to socket '$parm_clamsocket'\n";
           alarm(0);


           my $ofh = select SOCK; $| = 1; select $ofh;
@@ -2147,7 +2190,7 @@
         }
       else
         {
-        print ", but the socket for clamd does not exist\n";
+        print ", but the socket for clamd could not be determined\n";
         print "Assume ClamAV is not running\n";
         }
       }