You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Antoine Levy Lambert <an...@gmx.de> on 2010/03/02 01:23:43 UTC

errors running the ant test suite on Windows

Hi,

I have just built ant from trunk and ran the test suite on Windows 
XP/Cygwin/JDK 1.6.

I got this error :

Build File: 
C:\dev\asf\ant-core\src\tests\antunit\taskdefs\import-url-test.xml

Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.313 sec

Target: testImportOfNestedFile took 0 sec

 caused an ERROR

                at line 25, column 30

                Message: Unable to delete file 
C:\DOCUME~1\alambert\LOCALS~1\Temp\testoutput\test.jar

              
This made a lot of other antunit tests fail, in some mysterious way 
(maybe because they wanted all to cleanup the testoutput directory).

I wonder whether a recent change in our code base could cause this file 
test.jar to remain open/locked ? Some unclosed Stream/Reader/... ?

Regards,

Antoine



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: errors running the ant test suite on Windows

Posted by Antoine Levy Lambert <an...@gmx.de>.
Stefan Bodewig wrote:
>
> I've modified the guard to actually try a file on the disk and it works
> for 1.4.1 and 1.6 - and the test is not skipped and passes if you insert
> a CD on both JDKs.
>   
Thanks Stefan.
> Stefan
>
>   
Regards,

Antoine

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: errors running the ant test suite on Windows

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-03-02, Stefan Bodewig <bo...@apache.org> wrote:

> On 2010-03-02, Antoine Levy Lambert <an...@gmx.de> wrote:

>>    [junit] Testcase:
>> testDifferentWindowsDrive(org.apache.tools.ant.taskdefs.ManifestClassPathTest):
>> FAILED

> Fails for me as well when using JDK 1.6 but not when using JDK 1.4 - I'm
> currently running the full testsuite with 1.6 to see whether there is
> anything else.

No, only the usual jspc errors that I see with 1.4 as well.

> It shouldn't matter whether there is any drive in D: or not, the test
> is supposed to see it cannot create a relative path from a file on C:
> to a drive on D: - no matter what those drives are.

That's wrong.  It uses getCanonicalPath and Windows may throw an
exception if you try this for a file on a drive that is not ready.

Because of this the test contains a guard

            try {
                new java.io.File("D:/").getCanonicalPath();
            } catch (java.io.IOException e) {
                System.out.println("drive d: doesn't exist or is not ready,"
                                   + " skipping test");
                return;
            }

which is triggered on Java 1.4.1 but not on Java 1.6.

If you insert a CD the test will pass.

I've modified the guard to actually try a file on the disk and it works
for 1.4.1 and 1.6 - and the test is not skipped and passes if you insert
a CD on both JDKs.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: errors running the ant test suite on Windows

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-03-02, Antoine Levy Lambert <an...@gmx.de> wrote:

> Stefan Bodewig wrote:

>> This is what made me add the CloseResources task and I have never seen
>> this after svn revision 890827 (but I only run JDK 1.4.1 regularly when
>> working on Ant).  I haven't tried it after your stream handler changes,
>> will do so later today.

>> Stefan


> Thanks for having fixed this issue Stefan.

> We have another failing test also under Windows XP/Java 1.6/Cygwin

> On my computer the D drive is a CD/DVD drive with nothing on it.
> Maybe this test assumes that if there is a D drive it is also a
> writable disk unit ?

>    [junit] Testcase:
> testDifferentWindowsDrive(org.apache.tools.ant.taskdefs.ManifestClassPathTest):
> FAILED

Fails for me as well when using JDK 1.6 but not when using JDK 1.4 - I'm
currently running the full testsuite with 1.6 to see whether there is
anything else.

It shouldn't matter whether there is any drive in D: or not, the test is
supposed to see it cannot create a relative path from a file on C: to a
drive on D: - no matter what those drives are.

I might be able to spare a few minutes for this.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: errors running the ant test suite on Windows

Posted by Antoine Levy Lambert <an...@gmx.de>.
Stefan Bodewig wrote:
>
> This is what made me add the CloseResources task and I have never seen
> this after svn revision 890827 (but I only run JDK 1.4.1 regularly when
> working on Ant).  I haven't tried it after your stream handler changes,
> will do so later today.
>
> Stefan
>
>   
Thanks for having fixed this issue Stefan.

We have another failing test also under Windows XP/Java 1.6/Cygwin

 On my computer the D drive is a CD/DVD drive with nothing on it.
Maybe this test assumes that if there is a D drive it is also a writable 
disk unit ?

    [junit] Testcase: 
testDifferentWindowsDrive(org.apache.tools.ant.taskdefs.ManifestClassPathTest): 
FAILED
    [junit] Should throw BuildException because 'different drive' with 
message containing 'No suitable relative path from ' (actual message 
'error trying to get the relative path from C:\Temp to D:\a\b\x.jar' 
instead)
    [junit] junit.framework.AssertionFailedError: Should throw 
BuildException because 'different drive' with message containing 'No 
suitable relative path from ' (actual message 'error trying to get the 
relative path from C:\Temp to D:\a\b\x.jar' instead)
    [junit]               at junit.framework.Assert.fail(Assert.java:47)
    [junit]               at 
org.apache.tools.ant.BuildFileTest.expectBuildExceptionContaining(BuildFileTest.java:387)
    [junit]               at 
org.apache.tools.ant.taskdefs.ManifestClassPathTest.testDifferentWindowsDrive(ManifestClassPathTest.java:178)
    [junit]
    [junit]     [junit] Test 
org.apache.tools.ant.taskdefs.ManifestClassPathTest FAILED

Regards,

Antoine

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: errors running the ant test suite on Windows

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-03-02, Stefan Bodewig <bo...@apache.org> wrote:

> On 2010-03-02, Antoine Levy Lambert <an...@gmx.de> wrote:

>> I have just built ant from trunk and ran the test suite on Windows
>> XP/Cygwin/JDK 1.6.

>> I got this error :

>> Build File:
>> C:\dev\asf\ant-core\src\tests\antunit\taskdefs\import-url-test.xml

>> Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.313 sec

>> Target: testImportOfNestedFile took 0 sec

>> caused an ERROR

>>                at line 25, column 30

>>                Message: Unable to delete file
>> C:\DOCUME~1\alambert\LOCALS~1\Temp\testoutput\test.jar

> This is what made me add the CloseResources task and I have never seen
> this after svn revision 890827 (but I only run JDK 1.4.1 regularly when
> working on Ant).

It's Java 1.6.  Fails for me as well.

The root problem is that <import> in this test reads from a jar via a
classloader you don't have access to and the jar doesn't get closed
until that classloader is garbage collected at an unknown point in the
future.

With Java 1.4 my CloseResource hack got a handle to the JarFile the
imported file was read from and closed it - this doesn't seem to work on
Java 1.6, most likely the close() doesn't work or you get a different
JarFile than the one that is keeping a lock on the jar.

I'll try to fix the issue by moving the jar out of ${output} (so it
doesn't disturb other tests) and hoping that File.deleteOnExit() works
on it.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: errors running the ant test suite on Windows

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-03-02, Antoine Levy Lambert <an...@gmx.de> wrote:

> I have just built ant from trunk and ran the test suite on Windows
> XP/Cygwin/JDK 1.6.

> I got this error :

> Build File:
> C:\dev\asf\ant-core\src\tests\antunit\taskdefs\import-url-test.xml

> Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.313 sec

> Target: testImportOfNestedFile took 0 sec

> caused an ERROR

>                at line 25, column 30

>                Message: Unable to delete file
> C:\DOCUME~1\alambert\LOCALS~1\Temp\testoutput\test.jar

This is what made me add the CloseResources task and I have never seen
this after svn revision 890827 (but I only run JDK 1.4.1 regularly when
working on Ant).  I haven't tried it after your stream handler changes,
will do so later today.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org