Randy Kobes wrote:
Hi,
   The t/hooks/cleanup2.t test in mp2 uses an explicit
value for the size of a file, which isn't the right value
for Win32, due to crlf differences. This diff:
==========================================================
Index: cleanup2.t
===================================================================
RCS file: /home/cvs/modperl-2.0/t/hooks/cleanup2.t,v
retrieving revision 1.1
diff -u -r1.1 cleanup2.t
--- cleanup2.t  30 May 2003 02:09:57 -0000      1.1
+++ cleanup2.t  5 Jun 2003 16:17:40 -0000
@@ -4,6 +4,7 @@
 use Apache::Test;
 use Apache::TestUtil;
 use Apache::TestRequest;
+require Apache::TestConfig;

use File::Spec::Functions qw(catfile catdir);

@@ -33,9 +34,13 @@
     # since Apache destroys the request rec after the logging has been
     # finished, we have to give it some time  to get there
     # and remove in the file. (wait 0.25 .. 5 sec)
-    my $t = 0;
+    my $t = 0;
+    my $s = 0;
+    if (-e $file) {
+        $s = Apache::TestConfig::WIN32 ? 14 : 10;
+    }
     select undef, undef, undef, 0.25
-        while -e $file && -s _ == 10 || $t++ == 20;
+        while -e $file && -s _ == $s || $t++ == 20;

     if (-e $file) {
         t_debug("$file wasn't removed by the cleanup phase");
=================================================================
allows the test to pass.


+1, but may I suggest to abstract the OS-specific logistics away from the testing code?


Index: t/hooks/cleanup2.t
===================================================================
RCS file: /home/cvs/modperl-2.0/t/hooks/cleanup2.t,v
retrieving revision 1.1
diff -u -r1.1 cleanup2.t
--- t/hooks/cleanup2.t  30 May 2003 02:09:57 -0000      1.1
+++ t/hooks/cleanup2.t  6 Jun 2003 00:08:04 -0000
@@ -4,9 +4,13 @@
 use Apache::Test;
 use Apache::TestUtil;
 use Apache::TestRequest;
+use Apache::TestConfig;

use File::Spec::Functions qw(catfile catdir);

+use constant SIZE  => Apache::TestConfig::WIN32 ? 14 : 10;
+use constant TRIES => 20;
+
 my $vars = Apache::Test::config->{vars};
 my $dir  = catdir $vars->{documentroot}, "hooks";
 my $file = catfile $dir, "cleanup2";
@@ -35,7 +39,7 @@
     # and remove in the file. (wait 0.25 .. 5 sec)
     my $t = 0;
     select undef, undef, undef, 0.25
-        while -e $file && -s _ == 10 || $t++ == 20;
+        while -e $file && -s _ == SIZE || $t++ == TRIES;

     if (-e $file) {
         t_debug("$file wasn't removed by the cleanup phase");


__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com


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



Reply via email to