Skip Menu |

This queue is for tickets about the Log-Log4perl CPAN distribution.

Report information
The Basics
Id: 17436
Status: resolved
Priority: 0/
Queue: Log-Log4perl

People
Owner: MSCHILLI [...] cpan.org
Requestors: BARBIE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.02
Fixed in: (no value)



Subject: Windows and 017Watch.t file unlink errors
Running the test suite on Windows 2000 Pro with Perl 5.6.1, the following occurs: # Failed test 'Before recreate' # in t\017Watch.t at line 176. # got: 'INFO - info message # ' # expected: 'INFO - test1 # ' # Failed test 'After recreate' # in t\017Watch.t at line 181. # got: 'INFO - info message # ' # expected: 'INFO - test2 # ' # Looks like you failed 2 tests of 21. The reason being that at the end of the test script, you are attempting to unlink an active file. Windows will not let you do that. The attached patch looks to see whether the unlink actually deleted anything, and skips if it doesn't.
Subject: watch.patch
--- Log-Log4perl-1.02/t/017Watch.t Sat Dec 10 17:08:58 2005 +++ Log-Log4perl-1.02-barbie/t/017Watch.t Thu Feb 2 11:03:13 2006 @@ -156,8 +156,11 @@ # *************************************************************** # Check the 'recreate' feature -unlink $testfile if (-e $testfile); -my $conf3 = <<EOL; +my $cnt = unlink $testfile; +SKIP: { + skip "Unable to delete testfiles", 2 unless($cnt); + + my $conf3 = <<EOL; log4j.category.animal.dog = INFO, myAppender log4j.appender.myAppender = Log::Log4perl::Appender::File @@ -168,17 +171,17 @@ log4j.appender.myAppender.mode = append EOL -Log::Log4perl->init(\$conf3); + Log::Log4perl->init(\$conf3); -$logger = Log::Log4perl::get_logger('animal.dog'); -$logger->info("test1"); -open (LOG, $testfile) or die "can't open $testfile $!"; -is(scalar <LOG>, "INFO - test1\n", "Before recreate"); + $logger = Log::Log4perl::get_logger('animal.dog'); + $logger->info("test1"); + open (LOG, $testfile) or die "can't open $testfile $!"; + is(scalar <LOG>, "INFO - test1\n", "Before recreate"); -unlink $testfile; -$logger->info("test2"); -open (LOG, $testfile) or die "can't open $testfile $!"; -is(scalar <LOG>, "INFO - test2\n", "After recreate"); + $logger->info("test2"); + open (LOG, $testfile) or die "can't open $testfile $!"; + is(scalar <LOG>, "INFO - test2\n", "After recreate"); -unlink $testfile if (-e $testfile); + unlink $testfile if (-e $testfile); -unlink $testconf if (-e $testconf); + unlink $testconf if (-e $testconf); +}
On Thu Feb 02 06:07:27 2006, BARBIE wrote: Show quoted text
> Running the test suite on Windows 2000 Pro with Perl 5.6.1, the > following occurs: > > # Failed test 'Before recreate' > # in t\017Watch.t at line 176.
Instead of deleting a file still in use by an appender (which Windows doesn't like), the file gets now truncated. Will be in Log::Log4perl 1.03. Thanks for reporting this!