perl-test-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steve...@apache.org
Subject svn commit: r1365031 - in /perl/Apache-Test/trunk: Changes lib/Apache/TestUtil.pm t/log_watch.t
Date Tue, 24 Jul 2012 13:05:20 GMT
Author: stevehay
Date: Tue Jul 24 13:05:20 2012
New Revision: 1365031

URL: http://svn.apache.org/viewvc?rev=1365031&view=rev
Log:
Fix Apache::TestUtil functions which make use of Win32::GetLongPathName() on Windows: the
Win32 function returns the undefined value for non-existent files.
Also fix log_watch.t on Windows, where it is necessary to close a file before deleting it.

Modified:
    perl/Apache-Test/trunk/Changes
    perl/Apache-Test/trunk/lib/Apache/TestUtil.pm
    perl/Apache-Test/trunk/t/log_watch.t

Modified: perl/Apache-Test/trunk/Changes
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/Changes?rev=1365031&r1=1365030&r2=1365031&view=diff
==============================================================================
--- perl/Apache-Test/trunk/Changes (original)
+++ perl/Apache-Test/trunk/Changes Tue Jul 24 13:05:20 2012
@@ -8,6 +8,13 @@ Changes - Apache::Test change logfile
 
 =item 1.38-dev
 
+Fix log_watch.t on Windows, which can't (naturally) delete open files.
+[Steve Hay]
+
+Fix t_filepath_cmp, t_catfile and t_catfile_apache in Apache::TestUtil on
+Windows: their use of Win32::GetLongPathName() was broken for non-existent
+files. [Steve Hay]
+
 Remove use of Nullsv as per modperl commit 1362399. [Steve Hay]
 
 have Apache::TestConfigPerl::configure_inc set up @INC to include

Modified: perl/Apache-Test/trunk/lib/Apache/TestUtil.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestUtil.pm?rev=1365031&r1=1365030&r2=1365031&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestUtil.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestUtil.pm Tue Jul 24 13:05:20 2012
@@ -222,8 +222,8 @@ sub t_cmp ($$;$) {
 sub t_filepath_cmp ($$;$) {
     my @a = (shift, shift);
     if (Apache::TestConfig::WIN32) {
-        $a[0] = Win32::GetLongPathName($a[0]) if defined $a[0];
-        $a[1] = Win32::GetLongPathName($a[1]) if defined $a[1];
+        $a[0] = Win32::GetLongPathName($a[0]) if defined $a[0] && -e $a[0];
+        $a[1] = Win32::GetLongPathName($a[1]) if defined $a[1] && -e $a[1];
     }
     return @_ == 1 ? t_cmp($a[0], $a[1], $_[0]) : t_cmp($a[0], $a[1]);
 }
@@ -477,7 +477,7 @@ END {
 sub t_catfile {
     my $f = catfile(@_);
     return $f unless file_name_is_absolute($f);
-    return Apache::TestConfig::WIN32 ?
+    return Apache::TestConfig::WIN32 && -e $f ?
         Win32::GetLongPathName($f) : $f;
 }
 
@@ -488,7 +488,7 @@ sub t_catfile {
 sub t_catfile_apache {
     my $f = File::Spec::Unix->catfile(@_);
     return $f unless file_name_is_absolute($f);
-    return Apache::TestConfig::WIN32 ?
+    return Apache::TestConfig::WIN32 && -e $f ?
         Win32::GetLongPathName($f) : $f;
 }
 

Modified: perl/Apache-Test/trunk/t/log_watch.t
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/t/log_watch.t?rev=1365031&r1=1365030&r2=1365031&view=diff
==============================================================================
--- perl/Apache-Test/trunk/t/log_watch.t (original)
+++ perl/Apache-Test/trunk/t/log_watch.t Tue Jul 24 13:05:20 2012
@@ -57,6 +57,9 @@ t_start_file_watch 'watch';
 ok t_cmp [t_read_file_watch 'watch'], [],
     "t_read_file_watch at EOF";
 
+# Make sure the file is closed before deleting it on Windows.
+t_finish_file_watch 'watch' if $^O eq 'MSWin32';
+
 unlink $fn;
 t_start_file_watch 'watch';
 



Mime
View raw message