You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2022/05/31 03:10:28 UTC

svn commit: r1901434 - in /spamassassin/trunk/t: SATest.pm spamc_cf.t spamd_client.t spamd_plugin.t spamd_unix.t spamd_unix_and_tcp.t

Author: sidney
Date: Tue May 31 03:10:28 2022
New Revision: 1901434

URL: http://svn.apache.org/viewvc?rev=1901434&view=rev
Log:
bug 7986 - Fix by using File::Temp::tempdir() for socketpath in tests

Modified:
    spamassassin/trunk/t/SATest.pm
    spamassassin/trunk/t/spamc_cf.t
    spamassassin/trunk/t/spamd_client.t
    spamassassin/trunk/t/spamd_plugin.t
    spamassassin/trunk/t/spamd_unix.t
    spamassassin/trunk/t/spamd_unix_and_tcp.t

Modified: spamassassin/trunk/t/SATest.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/SATest.pm?rev=1901434&r1=1901433&r2=1901434&view=diff
==============================================================================
--- spamassassin/trunk/t/SATest.pm (original)
+++ spamassassin/trunk/t/SATest.pm Tue May 31 03:10:28 2022
@@ -25,7 +25,7 @@ use vars qw($RUNNING_ON_WINDOWS $SSL_AVA
             $SKIP_SPAMD_TESTS $SKIP_SPAMC_TESTS $NO_SPAMC_EXE
             $SKIP_SETUID_NOBODY_TESTS $SKIP_DNSBL_TESTS
             $have_inet4 $have_inet6 $spamdhost $spamdport
-            $workdir $siterules $localrules $userrules $userstate
+            $workdir $socketdir $siterules $localrules $userrules $userstate
             $keep_workdir $mainpid);
 
 my $sa_code_dir;
@@ -174,11 +174,16 @@ sub sa_t_init {
       rmtree($workdir);
     }
   }
+  if (defined $socketdir) {
+    rmtree($socketdir);
+  }
 
   # individual work directory to make parallel tests possible
   $workdir = tempdir("$tname.XXXXXX", DIR => "log");
   die "FATAL: failed to create workdir: $!" unless -d $workdir;
   $keep_workdir = 0;
+  $socketdir = tempdir(CLEANUP => 1);
+  die "FATAL: failed to create workdir: $!" unless -d $workdir;
   # $siterules contains all stock *.pre files
   $siterules = "$workdir/siterules";
   # $localrules contains all stock *.cf files
@@ -1201,6 +1206,9 @@ END {
   if (defined $workdir && !$keep_workdir && $$ == $mainpid) {
     rmtree($workdir);
   }
+  if (defined $socketdir && $$ == $mainpid) {
+    rmtree($socketdir);
+  }
 }
 
 1;

Modified: spamassassin/trunk/t/spamc_cf.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamc_cf.t?rev=1901434&r1=1901433&r2=1901434&view=diff
==============================================================================
--- spamassassin/trunk/t/spamc_cf.t (original)
+++ spamassassin/trunk/t/spamc_cf.t Tue May 31 03:10:28 2022
@@ -15,7 +15,7 @@ plan tests => 4;
   q{ X-Spam-Flag: YES}, 'flag',
 );
 
-my $sockpath = $workdir."/spamd.sock";
+my $sockpath = $socketdir."/spamd.sock";
 start_spamd("-D -L --socketpath=$sockpath");
 
 open (OUT, ">$workdir/spamc_cf.cf");

Modified: spamassassin/trunk/t/spamd_client.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_client.t?rev=1901434&r1=1901433&r2=1901434&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_client.t (original)
+++ spamassassin/trunk/t/spamd_client.t Tue May 31 03:10:28 2022
@@ -97,7 +97,7 @@ if (!$RUNNING_ON_WINDOWS) {
 
   %anti_patterns = ();
 
-  my $sockpath = $workdir."/spamd.sock";
+  my $sockpath = $socketdir."/spamd.sock";
   ok(start_spamd("-L --socketpath=$sockpath"));
 
   $client = create_clientobj({

Modified: spamassassin/trunk/t/spamd_plugin.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_plugin.t?rev=1901434&r1=1901433&r2=1901434&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_plugin.t (original)
+++ spamassassin/trunk/t/spamd_plugin.t Tue May 31 03:10:28 2022
@@ -24,7 +24,7 @@ print COUNTER "0";
 close COUNTER;
 chmod (0666, "$workdir/spamd_plugin.tmp");
 
-my $sockpath = $workdir."/spamd.sock";
+my $sockpath = $socketdir."/spamd.sock";
 start_spamd("-D -L --socketpath=$sockpath");
 
 %patterns = (

Modified: spamassassin/trunk/t/spamd_unix.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_unix.t?rev=1901434&r1=1901433&r2=1901434&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_unix.t (original)
+++ spamassassin/trunk/t/spamd_unix.t Tue May 31 03:10:28 2022
@@ -20,7 +20,7 @@ tstprefs("
   use_auto_whitelist 0
 ");
 
-my $sockpath = $workdir."/spamd.sock";
+my $sockpath = $socketdir."/spamd.sock";
 start_spamd("-D -L --socketpath=$sockpath");
 ok (spamcrun ("-U $sockpath < data/spam/001", \&patterns_run_cb));
 ok_all_patterns();

Modified: spamassassin/trunk/t/spamd_unix_and_tcp.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_unix_and_tcp.t?rev=1901434&r1=1901433&r2=1901434&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_unix_and_tcp.t (original)
+++ spamassassin/trunk/t/spamd_unix_and_tcp.t Tue May 31 03:10:28 2022
@@ -10,7 +10,7 @@ plan tests => 10;
 
 # ---------------------------------------------------------------------------
 
-my $sockpath = $workdir."/spamd.sock";
+my $sockpath = $socketdir."/spamd.sock";
 start_spamd("-D -L --socketpath=$sockpath --port $spamdport -A $spamdhost -i $spamdhost");
 %patterns = (
   q{ Subject: There yours for FREE!}, 'subj',