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 2004/10/13 02:36:58 UTC

svn commit: rev 54712 - spamassassin/branches/3.0/t

Author: jm
Date: Tue Oct 12 17:36:58 2004
New Revision: 54712

Modified:
   spamassassin/branches/3.0/t/dnsbl.t
   spamassassin/branches/3.0/t/spf.t
Log:
bug 3806: do not run DNSBL and SPF tests as root on non-linux UNIX platforms, due to a stupid bug in Sys::Hostname::Long that renames the hostname

Modified: spamassassin/branches/3.0/t/dnsbl.t
==============================================================================
--- spamassassin/branches/3.0/t/dnsbl.t	(original)
+++ spamassassin/branches/3.0/t/dnsbl.t	Tue Oct 12 17:36:58 2004
@@ -5,14 +5,22 @@
 
 use constant TEST_ENABLED => (-e 't/do_net' || -e 'do_net');
 use constant HAS_NET_DNS => eval { require Net::DNS; };
+# Do not run this test on non-Linux unices as root, due to a bug
+# in Sys::Hostname::Long (which Net::DNS uses.)
+# See <http://bugzilla.spamassassin.org/show_bug.cgi?id=3806>
+use constant IS_LINUX   => $^O eq 'linux';
+use constant AM_ROOT    => $< == 0;
+
+use constant DO_RUN     => TEST_ENABLED && HAS_SPFQUERY &&
+                                        !(AM_ROOT && !IS_LINUX);
 
 use Test;
 
 BEGIN {
-  plan tests => ((TEST_ENABLED && HAS_NET_DNS) ? 22 : 0),
+  plan tests => (DO_RUN ? 22 : 0),
 };
 
-exit unless (TEST_ENABLED && HAS_NET_DNS);
+exit unless (DO_RUN);
 
 # ---------------------------------------------------------------------------
 # bind configuration currently used to support this test

Modified: spamassassin/branches/3.0/t/spf.t
==============================================================================
--- spamassassin/branches/3.0/t/spf.t	(original)
+++ spamassassin/branches/3.0/t/spf.t	Tue Oct 12 17:36:58 2004
@@ -6,14 +6,21 @@
 
 use constant TEST_ENABLED => (-e 't/do_net');
 use constant HAS_SPFQUERY => eval { require Mail::SPF::Query; };
+# Do not run this test on non-Linux unices as root, due to a bug
+# in Sys::Hostname::Long (which Mail::Query::SPF uses.)
+use constant IS_LINUX   => $^O eq 'linux';
+use constant AM_ROOT    => $< == 0;
+
+use constant DO_RUN     => TEST_ENABLED && HAS_SPFQUERY &&
+                                        !(AM_ROOT && !IS_LINUX);
 
 BEGIN {
   
-  plan tests => ((TEST_ENABLED && HAS_SPFQUERY) ? 2 : 0);
+  plan tests => (DO_RUN ? 2 : 0);
 
 };
 
-exit unless (TEST_ENABLED && HAS_SPFQUERY);
+exit unless (DO_RUN);
 
 # ---------------------------------------------------------------------------