lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <>
Subject RE: Unit test help
Date Sat, 21 Dec 2013 09:59:20 GMT

keep in mind, that the Lucene Test Framework inserts a SecurityManager into the JVM, so tests
cannot write outside their working directory or open ports to the internet and do other crazy
stuff. This is to ensure, tests don't overwrite any file in the distribution and that a failing/buggy
test cannot "rm -rf" your harddisk. This SecurityManager is only enabled when running tests
with ANT. Mybe that’s the reason for the failure. You have to place the temp directory below
the build/.../test/J0,J1,... directories, which are the CWDs of the JVMs.


Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen

> -----Original Message-----
> From: Scott Schneider []
> Sent: Saturday, December 21, 2013 12:52 AM
> To:
> Subject: Unit test help
> Hello, all.  I'm hoping this message gets a response...
> I am running Lucene's unit tests against a custom Directory subclass (from
> Lucene Transform) using "-
> uceneTestWrapper".  I've been banging my head against this one failure for a
> few hours.  It happens from the command line ("ant test"), but not eclipse.
> I've narrowed it down using printf debugging.  I am using the same random
> seed in both cases, though I've run it a lot without specifying the seed and I
> always find that it passes in eclipse and fails from the command line.
> The failure is in TestIndexWriterCommit.testPrepareCommitRollback().  The
> second commit fails, because FSDirectory.ensureCanWrite() fails on the
> segment_2 file, because File.delete() fails on this file, causing FSDirectory to
> throw IOException.  (I've checked that MockDirectoryWrapper isn't inserting
> a failure.)  Also, I can see that during the test's rollback call, there are 3
> attempts made to delete the file, which fail in the same way.  I checked that
> Lucene Transform closes its handle to this file, so that shouldn't be blocking
> the deletion.  And I don't see how any other code could open a handle to this
> file, since it's created in a temp directory created by Lucene Transform.  I
> can't think of any reason for the difference between ant and eclipse!
> Please help!
> Thanks,
> Scott

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message