lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Schneider <Scott_Schnei...@symantec.com>
Subject RE: Unit test help
Date Sun, 22 Dec 2013 22:05:30 GMT
Thanks for the response!  Many of the tests ran fine and those were creating subfolders in
the temp dir.

I got the unit tests all passing in eclipse by changing the eclipse text encoding of the test
project from the default (Cp1252) to UTF-8.  To get testLuceneConstantVersion to pass, I had
to set -Dlucene.version=3.3-SNAPSHOT.  When running the test through ant, I think common-build.xml
sets that property.

My other problem running the tests on my own Directory subclass was a noob mistake.  I had
to specify -Dtests.directory=foo in VM arguments, rather than program arguments.

Scott


> -----Original Message-----
> From: Uwe Schindler [mailto:uwe@thetaphi.de]
> Sent: Saturday, December 21, 2013 1:59 AM
> To: java-user@lucene.apache.org
> Subject: RE: Unit test help
> 
> Hi,
> 
> 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
> 
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
> 
> 
> > -----Original Message-----
> > From: Scott Schneider [mailto:Scott_Schneider@symantec.com]
> > Sent: Saturday, December 21, 2013 12:52 AM
> > To: java-user@lucene.apache.org
> > 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 "-
> >
> Dtests.directory=org.apache.lucene.store.transform.TransformedDirectory
> L
> > 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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org

Mime
View raw message