https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7181

            Bug ID: 7181
           Summary: t/sa_compile.t fails make disttest but passes with
                    prove -v t/sa_compile.t
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: PC
                OS: Windows 7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Regression Tests
          Assignee: [email protected]
          Reporter: [email protected]

So I decided to test the release with re2c.  That led to an error with make
disttest for the sa_compile.t, specifically:

cannot write
/usr/src/Mail-SpamAssassin/trunk/Mail-SpamAssassin-3.4.1/t/log/d.sa_compile/inst.basic/foo/share/spamassassin/20_testrules.cf
at t/sa_compile.t line 78.

I added a bit more error checking and path creation:

Index: SATest.pm
===================================================================
--- SATest.pm   (revision 1676407)
+++ SATest.pm   (working copy)
@@ -166,7 +166,9 @@
   # do not remove prior test results!
   # rmtree ("log");

-  mkdir ("log", 0755);
+  unless (-d "log") {
+    mkdir ("log", 0755) or die ("Error creating log dir: $!");
+  }
   chmod (0755, "log"); # set in case log already exists with wrong permissions
   system("chacl -B log 2>/dev/null || setfacl -b log 2>/dev/null"); # remove
acls that confuse test

Index: sa_compile.t
===================================================================
--- sa_compile.t        (revision 1676407)
+++ sa_compile.t        (working copy)
@@ -5,6 +5,8 @@
 use SATest; sa_t_init("sa_compile");
 use Test;
 use Config;
+use File::Basename;
+use File::Path qw/mkpath/;

 my $temp_binpath = $Config{sitebinexp};
 $temp_binpath =~ s/^\Q$Config{prefix}\E//;
@@ -75,8 +77,14 @@

 sub set_rules {
   my $rules = shift;
-  open RULES, ">$instdir/foo/share/spamassassin/20_testrules.cf"
-          or die "cannot write
$instdir/foo/share/spamassassin/20_testrules.cf";
+
+  #Create the dir for the cf file
+  my $file = "$instdir/foo/share/spamassassin/20_testrules.cf";
+  my $dir = dirname($file);
+  mkpath($dir);
+
+  open RULES, ">$file"
+          or die "cannot write $file - $!";
   print RULES qq{

     use_bayes 0
@@ -86,8 +94,13 @@
   };
   close RULES or die;

-  open RULES, ">$instdir/foo/etc/mail/spamassassin/v330.pre"
-          or die "cannot write $instdir/foo/etc/mail/spamassassin/v330.pre";
+  #Create the dir for the pre file
+  $file = "$instdir/foo/etc/mail/spamassassin/v330.pre";
+  $dir = dirname($file);
+  mkpath($dir);
+
+  open RULES, ">$file"
+          or die "cannot write $file - $!";
   print RULES qq{

     loadplugin Mail::SpamAssassin::Plugin::MIMEHeader

However, that still left me with this:

t/sa_compile.t .................... 1/? # Failed test 1 in t/sa_compile.t at
line 149
        Not found: FOO =  check: tests=FOO  at t/sa_compile.t line 150.
# Failed test 2 in t/SATest.pm at line 755
Can't exec
"/usr/src/Mail-SpamAssassin/trunk/Mail-SpamAssassin-3.4.1/t/log/d.sa_compile/inst.basic/foo//bin/sa-compile":
No such file or directory at t/SATest.pm line 990.
'/usr/src/Mail-SpamAssassin/trunk/Mail-SpamAssassin-3.4.1/t/log/d.sa_compile/inst.basic/foo//bin/sa-compile
--keep-tmps' failed: DIED, signal 127 (ffffffff) at t/SATest.pm line 991.
t/sa_compile.t .................... Dubious, test returned 2 (wstat 512, 0x200)
Failed 5/5 subtests 

Since sa_compile.t still passes otherwise with make test or prove -t
t/sa_compile, I'm pushing this to 3.4.2 since it's likely been in this state
for ages.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to