diff options
author | sb <sb@openoffice.org> | 2010-01-27 16:23:59 +0100 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-01-27 16:23:59 +0100 |
commit | 947441fda5c7a99ec42afa3b94961d05356c04d8 (patch) | |
tree | e9099396bc1a92ce08d94da088451256b37f0add /smoketestoo_native | |
parent | 3dab44e4086e96cbdbcf5692091a82ef1fdebe55 (diff) |
sb118: changed tools/debug to never fall back from writing to shell to writing to file, and read DBGSV_INIT from rtl::Bootstrap; the latter causes problems if tools/debug is called from static code executing before SAL_MAIN has called osl_setCommandArgs -> removed statics from code and added assertions to osl/process; various improvements to smoketests.cxx (incl. passing an appropriate dbgsv.ini for non-pro builds)
Diffstat (limited to 'smoketestoo_native')
-rw-r--r-- | smoketestoo_native/dbgsv.ini | 27 | ||||
-rw-r--r-- | smoketestoo_native/makefile.mk | 4 | ||||
-rw-r--r-- | smoketestoo_native/smoketest.cxx | 68 |
3 files changed, 71 insertions, 28 deletions
diff --git a/smoketestoo_native/dbgsv.ini b/smoketestoo_native/dbgsv.ini new file mode 100644 index 000000000000..86e525645e27 --- /dev/null +++ b/smoketestoo_native/dbgsv.ini @@ -0,0 +1,27 @@ +=************************************************************************* += DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. += += Copyright 2010 by Sun Microsystems, Inc. += += OpenOffice.org - a multi-platform office productivity suite += += This file is part of OpenOffice.org. += += OpenOffice.org is free software: you can redistribute it and/or modify += it under the terms of the GNU Lesser General Public License version 3 += only, as published by the Free Software Foundation. += += OpenOffice.org is distributed in the hope that it will be useful, += but WITHOUT ANY WARRANTY; without even the implied warranty of += MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the += GNU Lesser General Public License version 3 for more details += (a copy is included in the LICENSE file that accompanied this code). += += You should have received a copy of the GNU Lesser General Public License += version 3 along with OpenOffice.org. If not, see += <http://www.openoffice.org/license.html> += for a copy of the LGPLv3 License. +=***********************************************************************/ + +[output] +error=shell diff --git a/smoketestoo_native/makefile.mk b/smoketestoo_native/makefile.mk index 541cfea9aa46..e104f5feb648 100644 --- a/smoketestoo_native/makefile.mk +++ b/smoketestoo_native/makefile.mk @@ -71,8 +71,8 @@ smoketest .PHONY: $(MISC)/installation.flag $(SHL1TARGETN) \ -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/services.rdb \ -env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/types.rdb \ -env:arg-path=$(my_path) -env:arg-user=$(MISC)/user \ - -env:arg-doc=$(BIN)/smoketestdoc.sxw \ - -env:arg-env=$(OOO_LIBRARY_PATH_VAR)"$${{$(OOO_LIBRARY_PATH_VAR)+=$$$(OOO_LIBRARY_PATH_VAR)}}" + -env:arg-env=$(OOO_LIBRARY_PATH_VAR)"$${{$(OOO_LIBRARY_PATH_VAR)+=$$$(OOO_LIBRARY_PATH_VAR)}}" \ + -env:arg-dbgsv=$(PWD)/dbgsv.ini -env:arg-doc=$(BIN)/smoketestdoc.sxw .IF "$(OS)" == "WNT" $(RM) -r $(MISC)/installation.flag `cat $(MISC)/installation.flag` .ENDIF diff --git a/smoketestoo_native/smoketest.cxx b/smoketestoo_native/smoketest.cxx index c3a9c7edb518..e9a3227ae34f 100644 --- a/smoketestoo_native/smoketest.cxx +++ b/smoketestoo_native/smoketest.cxx @@ -65,7 +65,6 @@ #include "osl/diagnose.h" #include "osl/file.hxx" #include "osl/process.h" -#include "osl/thread.hxx" #include "osl/time.h" #include "rtl/bootstrap.hxx" #include "rtl/string.hxx" @@ -157,6 +156,8 @@ void Listener::dispatchFinished(css::frame::DispatchResultEvent const & Result) class Test: public CppUnit::TestFixture { public: + Test(): process_(0) {} + virtual void setUp(); virtual void tearDown(); @@ -183,17 +184,25 @@ void Test::setUp() { RTL_CONSTASCII_USTRINGPARAM("pipe,name=oootest")) + rtl::OUString::valueOf(static_cast< sal_Int64 >(info.Ident)) + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";urp"))); - rtl::OUString userArg( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-env:UserInstallation=")) + - toUrl(getArgument(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"))))); rtl::OUString noquickArg( RTL_CONSTASCII_USTRINGPARAM("-quickstart=no")); rtl::OUString nofirstArg( RTL_CONSTASCII_USTRINGPARAM("-nofirststartwizard")); rtl::OUString acceptArg( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-accept=")) + desc); + rtl::OUString userArg( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-env:UserInstallation=")) + + toUrl(getArgument(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user"))))); + rtl::OUString jreArg( + RTL_CONSTASCII_USTRINGPARAM("-env:UNO_JAVA_JFW_ENV_JREHOME=true")); + rtl::OUString classpathArg( + RTL_CONSTASCII_USTRINGPARAM("-env:UNO_JAVA_JFW_ENV_CLASSPATH=true")); + rtl::OUString dbgsvArg( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-env:DBGSV_INIT=")) + + getArgument(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dbgsv")))); rtl_uString * args[] = { - noquickArg.pData, nofirstArg.pData, userArg.pData, acceptArg.pData }; + noquickArg.pData, nofirstArg.pData, acceptArg.pData, userArg.pData, + jreArg.pData, classpathArg.pData, dbgsvArg.pData }; rtl_uString ** envs = 0; rtl::OUString argEnv; if (getOptionalArgument( @@ -233,37 +242,44 @@ void Test::setUp() { } } TimeValue delay = { 1, 0 }; // 1 sec - osl::Thread::wait(delay); + CPPUNIT_ASSERT_EQUAL( + osl_Process_E_TimedOut, + osl_joinProcessWithTimeout(process_, &delay)); } } catch (...) { CPPUNIT_ASSERT_EQUAL( osl_Process_E_None, osl_terminateProcess(process_)); osl_freeProcessHandle(process_); + process_ = 0; throw; } } void Test::tearDown() { - css::uno::Reference< css::frame::XDesktop > desktop( - factory_->createInstance( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), - css::uno::UNO_QUERY_THROW); - factory_.clear(); - try { - CPPUNIT_ASSERT(desktop->terminate()); - desktop.clear(); - } catch (css::lang::DisposedException &) {} - // it appears that DisposedExceptions can already happen while receiving - // the response of the terminate call - CPPUNIT_ASSERT_EQUAL(osl_Process_E_None, osl_joinProcess(process_)); - oslProcessInfo info; - info.Size = sizeof info; - CPPUNIT_ASSERT_EQUAL( - osl_Process_E_None, - osl_getProcessInfo(process_, osl_Process_EXITCODE, &info)); - CPPUNIT_ASSERT_EQUAL(oslProcessExitCode(0), info.Code); - osl_freeProcessHandle(process_); + if (factory_.is()) { + css::uno::Reference< css::frame::XDesktop > desktop( + factory_->createInstance( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), + css::uno::UNO_QUERY_THROW); + factory_.clear(); + try { + CPPUNIT_ASSERT(desktop->terminate()); + desktop.clear(); + } catch (css::lang::DisposedException &) {} + // it appears that DisposedExceptions can already happen while + // receiving the response of the terminate call + } + if (process_ != 0) { + CPPUNIT_ASSERT_EQUAL(osl_Process_E_None, osl_joinProcess(process_)); + oslProcessInfo info; + info.Size = sizeof info; + CPPUNIT_ASSERT_EQUAL( + osl_Process_E_None, + osl_getProcessInfo(process_, osl_Process_EXITCODE, &info)); + CPPUNIT_ASSERT_EQUAL(oslProcessExitCode(0), info.Code); + osl_freeProcessHandle(process_); + } } void Test::test() { |