diff options
author | sb <sb@openoffice.org> | 2010-02-23 16:53:18 +0100 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-02-23 16:53:18 +0100 |
commit | e1977fb86913114bfb8720d024762cdfed947b21 (patch) | |
tree | 42a889f6bc2c144c118a77ef6d0eb485c5127de3 /test | |
parent | d57250a10c3b80ecedf4485285435ae4351c8956 (diff) |
sb118: removed timeouts and forced process termination from test code (to make failures better debuggable)
Diffstat (limited to 'test')
-rw-r--r-- | test/source/cpp/officeconnection.cxx | 50 | ||||
-rw-r--r-- | test/source/java/OfficeConnection.java | 13 |
2 files changed, 23 insertions, 40 deletions
diff --git a/test/source/cpp/officeconnection.cxx b/test/source/cpp/officeconnection.cxx index 210989f10..7940a327b 100644 --- a/test/source/cpp/officeconnection.cxx +++ b/test/source/cpp/officeconnection.cxx @@ -100,38 +100,26 @@ void OfficeConnection::setUp() { toAbsoluteFileUrl(argPath).pData, args, sizeof args / sizeof args[0], 0, 0, 0, envs, envs == 0 ? 0 : 1, &process_)); - try { - css::uno::Reference< css::bridge::XUnoUrlResolver > resolver( - css::bridge::UnoUrlResolver::create( - cppu::defaultBootstrap_InitialComponentContext())); - for (int i = 0;; ++i) { - try { - factory_ = - css::uno::Reference< css::lang::XMultiServiceFactory >( - resolver->resolve( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:")) + - desc + - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - ";StarOffice.ServiceManager"))), - css::uno::UNO_QUERY_THROW); - break; - } catch (css::connection::NoConnectException &) { - if (i == 600) { // 600 sec - throw; - } - } - TimeValue delay = { 1, 0 }; // 1 sec - CPPUNIT_ASSERT_EQUAL( - osl_Process_E_TimedOut, - osl_joinProcessWithTimeout(process_, &delay)); - } - } catch (...) { + css::uno::Reference< css::bridge::XUnoUrlResolver > resolver( + css::bridge::UnoUrlResolver::create( + cppu::defaultBootstrap_InitialComponentContext())); + for (int i = 0;; ++i) { + try { + factory_ = + css::uno::Reference< css::lang::XMultiServiceFactory >( + resolver->resolve( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno:")) + + desc + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ";StarOffice.ServiceManager"))), + css::uno::UNO_QUERY_THROW); + break; + } catch (css::connection::NoConnectException &) {} + TimeValue delay = { 1, 0 }; // 1 sec CPPUNIT_ASSERT_EQUAL( - osl_Process_E_None, osl_terminateProcess(process_)); - osl_freeProcessHandle(process_); - process_ = 0; - throw; + osl_Process_E_TimedOut, + osl_joinProcessWithTimeout(process_, &delay)); } } diff --git a/test/source/java/OfficeConnection.java b/test/source/java/OfficeConnection.java index f28e385e6..d4d7d7a70 100644 --- a/test/source/java/OfficeConnection.java +++ b/test/source/java/OfficeConnection.java @@ -74,11 +74,7 @@ public final class OfficeConnection { "uno:" + description + ";urp;StarOffice.ServiceManager")); break; - } catch (NoConnectException e) { - if (i == 600) { // 600 sec - throw e; - } - } + } catch (NoConnectException e) {} assertNull(waitForProcess(process, 1000)); // 1 sec } } @@ -99,15 +95,14 @@ public final class OfficeConnection { // receiving the response of the terminate call desktop = null; } - Integer code = 0; + int code = 0; if (process != null) { - code = waitForProcess(process, 600000); // 600 sec - process.destroy(); + code = process.waitFor(); } boolean outTerminated = outForward == null || outForward.terminated(); boolean errTerminated = errForward == null || errForward.terminated(); assertTrue(desktopTerminated); - assertEquals(new Integer(0), code); + assertEquals(0, code); assertTrue(outTerminated); assertTrue(errTerminated); } |