You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by ms...@apache.org on 2004/01/14 00:05:16 UTC

svn commit: rev 6156 - incubator/spamassassin/trunk/t

Author: mss
Date: Tue Jan 13 15:05:15 2004
New Revision: 6156

Modified:
   incubator/spamassassin/trunk/t/SATest.pm
   incubator/spamassassin/trunk/t/spamc_B.t
   incubator/spamassassin/trunk/t/spamc_c.t
   incubator/spamassassin/trunk/t/spamc_c_stdout_closed.t
   incubator/spamassassin/trunk/t/spamd.t
   incubator/spamassassin/trunk/t/spamd_allow_user_rules.t
   incubator/spamassassin/trunk/t/spamd_hup.t
   incubator/spamassassin/trunk/t/spamd_maxchildren.t
   incubator/spamassassin/trunk/t/spamd_maxsize.t
   incubator/spamassassin/trunk/t/spamd_parallel.t
   incubator/spamassassin/trunk/t/spamd_port.t
   incubator/spamassassin/trunk/t/spamd_protocol_10.t
   incubator/spamassassin/trunk/t/spamd_report.t
   incubator/spamassassin/trunk/t/spamd_report_ifspam.t
   incubator/spamassassin/trunk/t/spamd_stop.t
   incubator/spamassassin/trunk/t/spamd_symbols.t
   incubator/spamassassin/trunk/t/spamd_unix.t
   incubator/spamassassin/trunk/t/spamd_utf8.t
Log:
Skip spamd regression tests on Windows (based on patches by Sidney Markowitz).


Modified: incubator/spamassassin/trunk/t/SATest.pm
==============================================================================
--- incubator/spamassassin/trunk/t/SATest.pm	(original)
+++ incubator/spamassassin/trunk/t/SATest.pm	Tue Jan 13 15:05:15 2004
@@ -1,6 +1,5 @@
 # common functionality for tests.
 # imported into main for ease of use.
-
 package main;
 
 use Cwd;
@@ -9,6 +8,16 @@
 use File::Copy;
 use File::Basename;
 
+
+BEGIN {
+  # No spamd test in Windows unless env override says user figured out a way
+  # If you want to know why these are vars and no constants, read this thread:
+  #   <http://www.mail-archive.com/dev%40perl.apache.org/msg05466.html>
+  #  -- mss, 2004-01-13
+  our $RUNNING_ON_WINDOWS = ($^O =~ /^(mswin|dos|os2)/oi);
+  our $SKIP_SPAMD_TESTS   = ($RUNNING_ON_WINDOWS && !$ENV{'SPAMD_SCRIPT'}); 
+}
+
 # Set up for testing. Exports (as global vars):
 # out: $home: $HOME env variable
 # out: $cwd: here
@@ -230,6 +239,10 @@
 sub start_spamd {
   my $sdargs = shift;
 
+  if ($SKIP_SPAMD_TESTS) {
+    warn "spamd tests cannot be run on this platform\n";
+    return;
+  }
   return if (defined($spamd_pid) && $spamd_pid > 0);
 
   rmtree ("log/outputdir.tmp"); # some tests use this
@@ -251,7 +264,7 @@
   {
     $spamdargs = "$spamd -D $sdargs";
   }
-  $spamdargs =~ s!/!\\!g if ($^O =~ /^MS(DOS|Win)/i);
+  $spamdargs =~ tr,/,\\, if $RUNNING_ON_WINDOWS;
 
   if ($set_test_prefs) {
     warn "oops! SATest.pm: a test prefs file was created, but spamd isn't reading it\n";

Modified: incubator/spamassassin/trunk/t/spamc_B.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamc_B.t	(original)
+++ incubator/spamassassin/trunk/t/spamc_B.t	Tue Jan 13 15:05:15 2004
@@ -2,8 +2,10 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamc_B");
-use Test; BEGIN { plan tests => 8 };
 
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 8 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 # ---------------------------------------------------------------------------
 
 %patterns = (

Modified: incubator/spamassassin/trunk/t/spamc_c.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamc_c.t	(original)
+++ incubator/spamassassin/trunk/t/spamc_c.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamc_c");
-use Test; BEGIN { plan tests => 2 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 2 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamc_c_stdout_closed.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamc_c_stdout_closed.t	(original)
+++ incubator/spamassassin/trunk/t/spamc_c_stdout_closed.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamc_c_stdout_closed");
-use Test; BEGIN { plan tests => 2 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 2 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamd.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd.t	(original)
+++ incubator/spamassassin/trunk/t/spamd.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd");
-use Test; BEGIN { plan tests => 7 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 7 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamd_allow_user_rules.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_allow_user_rules.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_allow_user_rules.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_allow_user_rules");
-use Test; BEGIN { plan tests => 5 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 5 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 
@@ -20,8 +22,8 @@
 	allow_user_rules 1
 ");
 
-system ("rm -rf log/virtualconfig/testuser");
-system ("mkdir -p log/virtualconfig/testuser");
+rmtree ("log/virtualconfig/testuser", 0, 1);
+mkpath ("log/virtualconfig/testuser", 0, 0755);
 open (OUT, ">log/virtualconfig/testuser/user_prefs");
 print OUT "
 	header MYFOO Content-Transfer-Encoding =~ /quoted-printable/

Modified: incubator/spamassassin/trunk/t/spamd_hup.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_hup.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_hup.t	Tue Jan 13 15:05:15 2004
@@ -2,8 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_hup");
-use constant TEST_ENABLED => ($] >= 5.006);
-use Test; BEGIN { plan tests => (TEST_ENABLED ? 8 : 0) };
+use constant TEST_ENABLED => !$SKIP_SPAMD_TESTS && !$RUNNING_ON_WINDOWS && ($] >= 5.006);
+
+use Test; BEGIN { plan tests => (TEST_ENABLED? 8 : 0) };
 
 use File::Spec;
 

Modified: incubator/spamassassin/trunk/t/spamd_maxchildren.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_maxchildren.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_maxchildren.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_maxchildren");
-use Test; BEGIN { plan tests => 22 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 22 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamd_maxsize.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_maxsize.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_maxsize.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_maxsize");
-use Test; BEGIN { plan tests => 1 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 1 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamd_parallel.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_parallel.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_parallel.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_parallel");
-use Test; BEGIN { plan tests => 20 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 20 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamd_port.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_port.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_port.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_port");
-use Test; BEGIN { plan tests => 4 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 4 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamd_protocol_10.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_protocol_10.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_protocol_10.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_protocol_10");
-use Test; BEGIN { plan tests => 10 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 10 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 use File::Path;
 use IO::Socket;

Modified: incubator/spamassassin/trunk/t/spamd_report.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_report.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_report.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_report");
-use Test; BEGIN { plan tests => 8 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 8 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamd_report_ifspam.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_report_ifspam.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_report_ifspam.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_report_ifspam");
-use Test; BEGIN { plan tests => 10 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 10 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamd_stop.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_stop.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_stop.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_stop");
-use Test; BEGIN { plan tests => 2 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 2 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamd_symbols.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_symbols.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_symbols.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_symbols");
-use Test; BEGIN { plan tests => 3 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 3 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamd_unix.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_unix.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_unix.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,10 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_unix");
-use Test; BEGIN { plan tests => 4 };
+
+use Test; BEGIN { plan tests => ((!$SKIP_SPAMD_TESTS && !RUNNING_IN_WINDOWS)? 4 : 0) };
+
+exit unless (!$SKIP_SPAMD_TESTS && !RUNNING_IN_WINDOWS);
 
 # ---------------------------------------------------------------------------
 

Modified: incubator/spamassassin/trunk/t/spamd_utf8.t
==============================================================================
--- incubator/spamassassin/trunk/t/spamd_utf8.t	(original)
+++ incubator/spamassassin/trunk/t/spamd_utf8.t	Tue Jan 13 15:05:15 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamd_utf8");
-use Test; BEGIN { plan tests => 3 };
+use Test; BEGIN { plan tests => (!$SKIP_SPAMD_TESTS? 3 : 0) };
+
+exit if $SKIP_SPAMD_TESTS;
 
 $ENV{'LANG'} = 'en_US.UTF-8';	# ensure we test in UTF-8 locale