On Sat, 10 Jul 2004, Stas Bekman wrote:

> Randy Kobes wrote:
> > I noticed on Win32 there's a problem (what else is new :)
> > occasionally with the ModPerl-Registry/t/closure.t test;
> > subtest 4 fails, although not in a reliable manner. I think
> > this is due to the use of utime in the test to change the
> > access and modification time; in perlport, it mentions that
> > utime is unpredictable on Win32. Is using touch() of
> > ExtUtils::Command:
[ ... ]
> > equivalent? The doc for utime says it's equivalent to
> > touch() if the file exists, but is this enough for the test?
>
> It looks like it, but I don't like the use of $^X and
> external shell calls. How about we simply open the file
> for append or readwrite and then close it right away? That
> should be the most portable touch, no?

That's true - how about the following (borrowed from
ExtUtils::Command::touch(), where they open the file and
also use utime)? Also, I changed the wait time in the select
to 2 s, which perlport for utime suggests would work better
on Win32.
============================================================
Index: ModPerl-Registry/t/closure.t
===================================================================
RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/closure.t,v
retrieving revision 1.12
diff -u -r1.12 closure.t
--- ModPerl-Registry/t/closure.t        11 Jul 2004 04:29:26 -0000      1.12
+++ ModPerl-Registry/t/closure.t        11 Jul 2004 17:28:11 -0000
@@ -5,6 +5,7 @@
 use Apache::TestUtil;
 use Apache::TestRequest;
 use File::Spec::Functions;
+use Symbol ();

 # this test tests how various registry packages cache and flush the
 # scripts their run, and whether they check modification on the disk
@@ -127,8 +128,11 @@
     # difference. select() has better resolution than 1 sec as in
     # sleep() so we are more likely to have the minimal waiting time,
     # while fulfilling the purpose
-    select undef, undef, undef, 1.00; # sure 1 sec
+    select undef, undef, undef, 2.00; # sure 2 sec
     my $now = time;
+    my $fh = Symbol::gensym();
+    open $fh, ">>$file" or die "Cannot append to $file: $!";
+    close $fh;
     utime $now, $now, $file;
 }

=================================================================

-- 
best regards,
randy

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

Reply via email to