On Mon, 17 Nov 2003, Geoffrey Young wrote:

>
> > I dunno, but I am afraid that stuff like device, inode,
> > nlink and such might not work similarly on non-Unixes..
> > These tests most likely need to be a bit more
> > OS-specific to avoid failures on those OSes
>
> yes, I meant to follow this up with an email saying that I
> would quickly fix any os related issues once randy et al
> get the chance to play with them and expose where APR is
> different than perl.  but I didn't want to just skip them
> on win32 before I knew where the issues were, and testing
> checked in stuff is just easier :)

That's true ... On Win32, inode, device, user, and group are
all defined, but these tests fail as written, as the
returned values are different ... The same thing goes for
the test involving WEXECUTE. Probably one might come up with
what these returned values would be on Win32, but I'm
wondering if it's worth it - from what I gather, some of
these might depend on the Win32 flavour being used (eg, on
Win9?, any readable file is [almost always] executable).
Perhaps we could just skip these tests on Win32:
===============================================================
Index: t/response/TestAPR/finfo.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/finfo.pm,v
retrieving revision 1.1
diff -u -r1.1 finfo.pm
--- t/response/TestAPR/finfo.pm 17 Nov 2003 23:31:02 -0000      1.1
+++ t/response/TestAPR/finfo.pm 18 Nov 2003 06:24:43 -0000
@@ -6,6 +6,8 @@
 use Apache::Test;
 use Apache::TestUtil;
 use Apache::TestTrace;
+use Apache::TestConfig;
+use constant WIN32 => Apache::TestConfig::WIN32;

 use Apache::RequestRec ();
 use APR::Finfo ();
@@ -54,15 +56,23 @@
         our ($device, $inode, $protection, $nlink, $user, $group,
              undef, $size, $atime, $mtime, $ctime) = stat $file;

+        # skip certain tests on Win32 (and others?)
+        my %skip =  WIN32 ?
+            (map {$_ => 1} qw(device inode user group) ) : ();
+
         # compare stat fields between perl and apr_stat
         {
             no strict qw(refs);
             foreach my $method (qw(device inode nlink user group
                                    size atime mtime ctime)) {
-
-                ok t_cmp(${$method},
-                         $r->finfo->$method(),
-                         "\$r->finfo->$method()");
+                if ($skip{$method}) {
+                    skip "different file semantics";
+                }
+                else {
+                    ok t_cmp(${$method},
+                             $r->finfo->$method(),
+                             "\$r->finfo->$method()");
+                }
             }
         }

@@ -76,9 +86,14 @@
                  $r->finfo->protection & APR::WWRITE,
                  '$r->finfo->protection() & APR::WWRITE');

-        ok t_cmp($protection & S_IXOTH,
-                 $r->finfo->protection & APR::WEXECUTE,
-                 '$r->finfo->protection() & APR::WEXECUTE');
+        if (WIN32) {
+            skip "different file semantics";
+        }
+        else {
+            ok t_cmp($protection & S_IXOTH,
+                     $r->finfo->protection & APR::WEXECUTE,
+                     '$r->finfo->protection() & APR::WEXECUTE');
+        }
     }

     # tests for stuff not in perl's stat
@@ -90,7 +105,7 @@
         ok t_cmp(APR::REG,
                  $r->finfo->filetype,
                  '$r->finfo->filetype()');
-    }
+    }

     Apache::OK;
 }
===================================================================

With the above, the tests that do run all pass on Win32,
except the one calling $r->finfo->fname, which returns
undef. I'll look into this further ....

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to