multithreaded JunitTest
Lionel Elie Mamane
lionel at mamane.lu
Sat May 30 07:47:56 PDT 2015
Hi,
I'm reenabling some disabled JUnitTests in dbaccess/JunitTest_dbaccess_complex.mk
And finding (and fixing) several bugs on the way.
In particular, in dbaccess/qa/complex/dbaccess/RowSet.java:
void testConcurrentAccess(XResultSet _resultSet)
{
(...)
for (int i = 0; i < numberOfThreads; ++i)
{
threads[i] = new Thread(new ResultSetMovementStress(createClone(), i));
System.out.println("starting thread " + (i + 1) + " of " + (numberOfThreads));
threads[i].start();
}
for (int i = 0; i < numberOfThreads; ++i)
{
threads[i].join();
}
}
My problem is that the launched threads fail in this way:
public void run()
{
try
{
}
catch (Exception e)
{
fail("ResultSetMovementStress(" + m_id + ") failed " + e);
}
}
But the test as a whole still succeeds! The subthread failure is just
ignored.
I fixed the underlying bug, but I would like to fix the test so that
it fails when one of the threads fails. I tried to not catch the
Exception, but that does not help. (I noticed the thread failure by
looking at workdir/JunitTest/dbaccess_complex/done.log )
How do I fix this?
Thanks in advance for any help,
--
Lionel
More information about the LibreOffice
mailing list