postprocess/rebase/coffbase.txt | 1 sal/cppunittester/cppunittester.cxx | 148 ------------- sal/cppunittester/makefile.mk | 49 ---- sal/inc/cppunittester/protectorfactory.hxx | 41 --- sal/inc/sal/cppunit.h | 38 --- sal/prj/build.lst | 15 - sal/prj/d.lst | 5 sal/qa/OStringBuffer/rtl_OStringBuffer.cxx | 2 sal/qa/inc/valueequal.hxx | 18 + sal/qa/rtl/logfile/rtl_logfile.cxx | 2 sal/qa/rtl/random/makefile.add | 19 - sal/workben/makefile.mk | 8 sal/workben/t_osl_getVolInfo.cxx | 85 +++---- sal/workben/t_osl_joinProcess.cxx | 309 ++++++++++++----------------- solenv/gbuild/templates/CppunitTest.mk | 37 --- solenv/gbuild/templates/GoogleTest.mk | 36 +++ 16 files changed, 233 insertions(+), 580 deletions(-)
New commits: commit d6c6b7026065ac5ffb92ceb199b4a84695c0cf02 Author: Damjan Jovanovic <[email protected]> Date: Tue Oct 6 17:59:46 2015 +0000 #i125003# delete the obsolete CppunitTest.mk diff --git a/solenv/gbuild/templates/CppunitTest.mk b/solenv/gbuild/templates/CppunitTest.mk deleted file mode 100644 index 48500e7..0000000 --- a/solenv/gbuild/templates/CppunitTest.mk +++ /dev/null @@ -1,37 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -$(eval $(call gb_CppunitTest_CppunitTest,MODULE_NAME)) - -$(eval $(call gb_CppunitTest_add_exception_objects,MODULE_NAME, \ -)) - -$(eval $(call gb_CppunitTest_add_linked_libs,MODULE_NAME, \ - $(gb_STDLIBS) \ -)) - -$(eval $(call gb_CppunitTest_set_include,MODULE_NAME,\ - $$(INCLUDE) \ -)) - -# vim: set noet sw=4 ts=4: commit 9d785996a8a9f843076410df075fbe91b5e6bab4 Author: Damjan Jovanovic <[email protected]> Date: Tue Oct 6 17:58:55 2015 +0000 #i125003# add sample GoogleTest.mk to main/solenv/gbuild/templates diff --git a/solenv/gbuild/templates/GoogleTest.mk b/solenv/gbuild/templates/GoogleTest.mk new file mode 100644 index 0000000..aaf215d --- /dev/null +++ b/solenv/gbuild/templates/GoogleTest.mk @@ -0,0 +1,36 @@ +#************************************************************** +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +#************************************************************** + + +$(eval $(call gb_GoogleTest_GoogleTest,MODULE_NAME)) + +$(eval $(call gb_GoogleTest_add_exception_objects,MODULE_NAME, \ +)) + +$(eval $(call gb_GoogleTest_add_linked_libs,MODULE_NAME, \ + $(gb_STDLIBS) \ +)) + +$(eval $(call gb_GoogleTest_set_include,MODULE_NAME,\ + $$(INCLUDE) \ +)) + +# vim: set noet sw=4 ts=4: commit 839f74c611851b02d3f7f5eeaf9bbb0778e414f2 Author: Damjan Jovanovic <[email protected]> Date: Tue Oct 6 17:55:27 2015 +0000 #i125003# fix a cppunit comment diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx index 9035006..4bf1718 100644 --- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx +++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx @@ -2823,7 +2823,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix, delete arrOUS[3]; delete arrOUS[4]; } - // For some bizarre reason, only odd numbered tests were set up to run with cppunit + // For some bizarre reason, only odd numbered tests were set up to run }; TEST_F(append_006_Int32, append_001) commit 8fee1a1f471f5ceb29cb6c63e4a682fba3be3ea2 Author: Damjan Jovanovic <[email protected]> Date: Tue Oct 6 17:51:44 2015 +0000 #i125003# no more cppunit diff --git a/postprocess/rebase/coffbase.txt b/postprocess/rebase/coffbase.txt index 862e2b4..92a6577 100644 --- a/postprocess/rebase/coffbase.txt +++ b/postprocess/rebase/coffbase.txt @@ -320,7 +320,6 @@ migrationoo2.uno.dll 0x000000005b080000 0x00020000 inprocserv.dll 0x000000005b060000 0x00010000 lngmi.dll 0x000000005af50000 0x00100000 adomi.dll 0x000000005aea0000 0x00080000 -cppunit_dll.dll 0x000000005ad60000 0x00040000 drawinglayermi.dll 0x000000005ac00000 0x00100000 editengmi.dll 0x000000005aa80000 0x00170000 formi.dll 0x000000005aa30000 0x00020000 commit fa23243e0213afbb26e800442098a4b4cd7318ac Author: Damjan Jovanovic <[email protected]> Date: Tue Oct 6 17:47:36 2015 +0000 #i125003# eliminate cppunittester, include files, and all cppunit usage in ported tests from from main/sal. diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx deleted file mode 100644 index 02818c5..0000000 --- a/sal/cppunittester/cppunittester.cxx +++ /dev/null @@ -1,148 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#include "precompiled_sal.hxx" -#include "sal/config.h" - -#include <cstdlib> -#include <iostream> -#include <limits> -#include <string> - -#include "cppunittester/protectorfactory.hxx" -#include "osl/module.h" -#include "osl/module.hxx" -#include "osl/thread.h" -#include "rtl/process.h" -#include "rtl/string.h" -#include "rtl/string.hxx" -#include "rtl/textcvt.h" -#include "rtl/ustring.hxx" -#include "sal/main.h" -#include "sal/types.h" - -#include "preextstl.h" -#include "cppunit/CompilerOutputter.h" -#include "cppunit/TestResult.h" -#include "cppunit/TestResultCollector.h" -#include "cppunit/TestRunner.h" -#include "cppunit/extensions/TestFactoryRegistry.h" -#include "cppunit/plugin/PlugInManager.h" -#include "cppunit/portability/Stream.h" -#include "cppunit/plugin/DynamicLibraryManagerException.h" -#include "postextstl.h" - -namespace { - -void usageFailure() { - std::cerr - << ("Usage: cppunittester (--protector <shared-library-path>" - " <function-symbol>)* <shared-library-path>") - << std::endl; - std::exit(EXIT_FAILURE); -} - -rtl::OUString getArgument(sal_Int32 index) { - rtl::OUString arg; - rtl_getAppCommandArg(index, &arg.pData); - return arg; -} - -std::string convertLazy(rtl::OUString const & s16) { - rtl::OString s8(rtl::OUStringToOString(s16, osl_getThreadTextEncoding())); - return std::string( - s8.getStr(), - ((static_cast< sal_uInt32 >(s8.getLength()) - > std::numeric_limits< std::string::size_type >::max()) - ? std::numeric_limits< std::string::size_type >::max() - : static_cast< std::string::size_type >(s8.getLength()))); -} - -std::string convertStrict(rtl::OUString const & s16) { - rtl::OString s8; - if (!s16.convertToString( - &s8, osl_getThreadTextEncoding(), - (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR - | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)) - || (static_cast< sal_uInt32 >(s8.getLength()) - > std::numeric_limits< std::string::size_type >::max())) - { - std::cerr - << "Failure converting argument from UTF-16 back to system encoding" - << std::endl; - std::exit(EXIT_FAILURE); - } - return std::string( - s8.getStr(), static_cast< std::string::size_type >(s8.getLength())); -} - -} - -SAL_IMPLEMENT_MAIN() { - CppUnit::TestResult result; - sal_uInt32 index = 0; - for (; index < rtl_getAppCommandArgCount(); index += 3) { - if (!getArgument(index).equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM("--protector"))) - { - break; - } - if (rtl_getAppCommandArgCount() - index < 3) { - usageFailure(); - } - rtl::OUString lib(getArgument(index + 1)); - rtl::OUString sym(getArgument(index + 2)); - oslGenericFunction fn = (new osl::Module(lib, SAL_LOADMODULE_GLOBAL)) - ->getFunctionSymbol(sym); - CppUnit::Protector * p = fn == 0 - ? 0 - : (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))(); - if (p == 0) { - std::cerr - << "Failure instantiating protector \"" << convertLazy(lib) - << "\", \"" << convertLazy(sym) << '"' << std::endl; - std::exit(EXIT_FAILURE); - } - result.pushProtector(p); - } - if (rtl_getAppCommandArgCount() - index != 1) { - usageFailure(); - } - - bool bSuccess = false; - try { - CppUnit::PlugInManager manager; - manager.load(convertStrict(getArgument(index))); - CppUnit::TestRunner runner; - runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); - CppUnit::TestResultCollector collector; - result.addListener(&collector); - runner.run(result); - CppUnit::CompilerOutputter(&collector, CppUnit::stdCErr()).write(); - bSuccess = collector.wasSuccessful(); - } catch( CppUnit::DynamicLibraryManagerException& e) { - std::cerr << "DynamicLibraryManagerException: \"" << e.what() << "\"\n"; - } - - return bSuccess ? EXIT_SUCCESS : EXIT_FAILURE; -} diff --git a/sal/cppunittester/makefile.mk b/sal/cppunittester/makefile.mk deleted file mode 100644 index 3e03321..0000000 --- a/sal/cppunittester/makefile.mk +++ /dev/null @@ -1,49 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -PRJ = .. -PRJNAME = sal -TARGET = cppunittester - -ENABLE_EXCEPTIONS = TRUE - -.INCLUDE: settings.mk - -.IF "$(WITH_CPPUNIT)" != "YES" -all: - @echo cppunit disabled. nothing to do. - -.ELSE - -CFLAGSCXX += $(CPPUNIT_CFLAGS) - -OBJFILES = $(APP1OBJS) - -APP1OBJS = $(OBJ)/cppunittester.obj -APP1RPATH = NONE -APP1STDLIBS = $(CPPUNITLIB) $(SALLIB) -APP1TARGET = cppunittester - -.INCLUDE: target.mk - -.ENDIF diff --git a/sal/inc/cppunittester/protectorfactory.hxx b/sal/inc/cppunittester/protectorfactory.hxx deleted file mode 100644 index bdc08de..0000000 --- a/sal/inc/cppunittester/protectorfactory.hxx +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef INCLUDED_CPPUNITTESTER_PROTECTORFACTORY_HXX -#define INCLUDED_CPPUNITTESTER_PROTECTORFACTORY_HXX - -#include "sal/config.h" - -#include "sal/types.h" - -namespace CppUnit { class Protector; } - -namespace cppunittester { - -// The type of CppUnit::Protector factory functions that can be plugged into -// cppunittester: -extern "C" typedef CppUnit::Protector * SAL_CALL ProtectorFactory(); - -} - -#endif diff --git a/sal/inc/sal/cppunit.h b/sal/inc/sal/cppunit.h deleted file mode 100644 index 01587a7..0000000 --- a/sal/inc/sal/cppunit.h +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef _SAL_CPPUNIT_H_ -#define _SAL_CPPUNIT_H_ - -#include <sal/types.h> - -#include "preextstl.h" -#include <cppunit/TestAssert.h> -#include <cppunit/TestFixture.h> -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/plugin/TestPlugIn.h> -#undef CPPUNIT_PLUGIN_EXPORT -#define CPPUNIT_PLUGIN_EXPORT extern "C" SAL_DLLPUBLIC_EXPORT -#include "postextstl.h" - -#endif diff --git a/sal/prj/build.lst b/sal/prj/build.lst index d8d03b8..4212078 100644 --- a/sal/prj/build.lst +++ b/sal/prj/build.lst @@ -18,11 +18,10 @@ sa sal\qa\sal nmake - all sa_qa_sal sa_util sa_cpprt.u NULL sa sal\qa\osl\condition nmake - all sa_qa_osl_condition sa_util sa_cpprt.u NULL sa sal\qa\osl\pipe nmake - all sa_qa_osl_pipe sa_util sa_cpprt.u NULL -sa sal\cppunittester nmake - all sa_cppunittester sa_cpprt.u sa_util NULL -sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_cppunittester sa_util NULL -sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util NULL -sa sal\qa\osl\mutex nmake - all sa_qa_osl_mutex sa_cppunittester sa_util NULL -sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_cppunittester sa_util NULL -sa sal\qa\osl\setthreadname nmake - all sa_qa_osl_setthreadname sa_cppunittester sa_util NULL -sa sal\qa\osl\thread nmake - all sa_qa_osl_thread sa_cppunittester sa_util NULL -sa sal\qa\rtl\math nmake - all sa_qa_rtl_math sa_cppunittester sa_util NULL +sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_util NULL +sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_util NULL +sa sal\qa\osl\mutex nmake - all sa_qa_osl_mutex sa_util NULL +sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_util NULL +sa sal\qa\osl\setthreadname nmake - all sa_qa_osl_setthreadname sa_util NULL +sa sal\qa\osl\thread nmake - all sa_qa_osl_thread sa_util NULL +sa sal\qa\rtl\math nmake - all sa_qa_rtl_math sa_util NULL diff --git a/sal/prj/d.lst b/sal/prj/d.lst index 253d7ea..0a22cda 100644 --- a/sal/prj/d.lst +++ b/sal/prj/d.lst @@ -1,11 +1,9 @@ -mkdir: %_DEST%\inc%_EXT%\cppunittester mkdir: %_DEST%\inc%_EXT%\sal mkdir: %_DEST%\inc%_EXT%\osl mkdir: %_DEST%\inc%_EXT%\rtl mkdir: %_DEST%\inc%_EXT%\systools mkdir: %_DEST%\inc%_EXT%\systools\win32 -..\inc\cppunittester\protectorfactory.hxx %_DEST%\inc%_EXT%\protectorfactory.hxx ..\%__SRC%\inc\rtlbootstrap.mk %_DEST%\inc%_EXT%\rtlbootstrap.mk ..\inc\sal\*.h %_DEST%\inc%_EXT%\sal\*.h ..\%__SRC%\inc\sal\typesizes.h %_DEST%\inc%_EXT%\sal\typesizes.h @@ -35,6 +33,3 @@ symlink: %_DEST%\lib%_EXT%\libuno_sal.dylib.3 %_DEST%\lib%_EXT%\libuno_sal.dylib ..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res ..\%__SRC%\inc\udkversion.h %_DEST%\inc%_EXT%\sal\udkversion.h - -..\%__SRC%\bin\cppunittester %_DEST%\bin%_EXT%\cppunittester -..\%__SRC%\bin\cppunittester.exe %_DEST%\bin%_EXT%\cppunittester.exe diff --git a/sal/qa/rtl/logfile/rtl_logfile.cxx b/sal/qa/rtl/logfile/rtl_logfile.cxx index 4ef2b66..eee2977 100644 --- a/sal/qa/rtl/logfile/rtl_logfile.cxx +++ b/sal/qa/rtl/logfile/rtl_logfile.cxx @@ -160,7 +160,7 @@ namespace rtl_logfile nError1 = osl::File::remove( suFilePath ); printError( nError1 ); - CPPUNIT_ASSERT_MESSAGE( "In deleteTestFile Function: remove ", ( ::osl::FileBase::E_None == nError1 ) || ( nError1 == ::osl::FileBase::E_NOENT ) ); + ASSERT_TRUE( ( ::osl::FileBase::E_None == nError1 ) || ( nError1 == ::osl::FileBase::E_NOENT ) ) << "In deleteTestFile Function: remove "; */ } diff --git a/sal/qa/rtl/random/makefile.add b/sal/qa/rtl/random/makefile.add deleted file mode 100644 index eb45c31..0000000 --- a/sal/qa/rtl/random/makefile.add +++ /dev/null @@ -1,19 +0,0 @@ -# BEGIN ---------------------------------------------------------------- -# auto generated Target:job by codegen.pl -SHL1OBJS= \ - $(SLO)$/rtl_random.obj - -SHL1TARGET= job -SHL1STDLIBS=\ - $(SALLIB) \ - $(CPPUNITLIB) - -SHL1IMPLIB= i$(SHL1TARGET) -# SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME =$(SHL1TARGET) -# DEF1EXPORTFILE= export.exp -SHL1VERSIONMAP= export.map -# auto generated Target:job -# END ------------------------------------------------------------------ - commit b8333c13688572c031e00df950e86748aa5b37b0 Author: Damjan Jovanovic <[email protected]> Date: Tue Oct 6 17:45:40 2015 +0000 #i125003# migrate main/sal/workben from cppunit to Google Test. diff --git a/sal/workben/makefile.mk b/sal/workben/makefile.mk index 622a47e..5637fe417 100644 --- a/sal/workben/makefile.mk +++ b/sal/workben/makefile.mk @@ -70,12 +70,12 @@ SHL1TARGET=togvi .IF "$(GUI)" == "WNT" APP1STDLIBS=$(KERNEL32LIB) SHL1STDLIBS=$(LB)$/isal.lib -SHL1STDLIBS+=$(SOLARLIBDIR)$/cppunit.lib +SHL1STDLIBS+=$(SOLARLIBDIR)$/gtest.lib .ENDIF .IF "$(GUI)" == "UNX" SHL1STDLIBS=$(LB)$/libsal.so -SHL1STDLIBS+=$(SOLARLIBDIR)$/libcppunit$(DLLPOSTFIX).a +SHL1STDLIBS+=$(SOLARLIBDIR)$/libgtest$(DLLPOSTFIX).a .ENDIF SHL1IMPLIB=i$(SHL1TARGET) @@ -99,12 +99,12 @@ SHL1TARGET=tojp .IF "$(GUI)" == "WNT" APP1STDLIBS=$(KERNEL32LIB) SHL1STDLIBS=$(LB)$/isal.lib -SHL1STDLIBS+=$(SOLARLIBDIR)$/cppunit.lib +SHL1STDLIBS+=$(SOLARLIBDIR)$/gtest.lib .ENDIF .IF "$(GUI)" == "UNX" SHL1STDLIBS=$(LB)$/libsal.so -SHL1STDLIBS+=$(SOLARLIBDIR)$/libcppunit$(DLLPOSTFIX).a +SHL1STDLIBS+=$(SOLARLIBDIR)$/libgtest$(DLLPOSTFIX).a .ENDIF SHL1IMPLIB=i$(SHL1TARGET) diff --git a/sal/workben/t_osl_getVolInfo.cxx b/sal/workben/t_osl_getVolInfo.cxx index b39455b..3d17648 100644 --- a/sal/workben/t_osl_getVolInfo.cxx +++ b/sal/workben/t_osl_getVolInfo.cxx @@ -24,7 +24,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sal.hxx" -#include <cppunit/simpleheader.hxx> +#include "gtest/gtest.h" #include <osl/file.h> #include <rtl/ustring.hxx> @@ -67,62 +67,55 @@ void test_getVolumeInformation(const rtl::OUString& path_url) osl_VolumeInfo_Mask_FileSystemName | osl_VolumeInfo_Mask_DeviceHandle); - CPPUNIT_ASSERT_MESSAGE - ( - "osl_getVolumeInformation failed", - err == osl_File_E_None - ); + ASSERT_TRUE( err == osl_File_E_None ) << "osl_getVolumeInformation failed"; } //------------------------------ // //------------------------------ -class TestClass_osl_getVolumeInformation : public CppUnit::TestFixture +class TestClass_osl_getVolumeInformation : public ::testing::Test { public: +}; - /*------------------------------------- - Start a process and join with this - process specify a timeout so that - osl_joinProcessWithTimeout returns - osl_Process_E_TimedOut - -------------------------------------*/ +/*------------------------------------- + Start a process and join with this + process specify a timeout so that + osl_joinProcessWithTimeout returns + osl_Process_E_TimedOut + -------------------------------------*/ - void test_osl_getVolumeInformation() - { - rtl::OUString path = rtl::OUString::createFromAscii(TEST_PATH_1); - rtl::OUString path_url; - osl_getFileURLFromSystemPath(path.pData, &path_url.pData); - test_getVolumeInformation(path_url); - - path = rtl::OUString::createFromAscii(TEST_PATH_2); - osl_getFileURLFromSystemPath(path.pData, &path_url.pData); - test_getVolumeInformation(path_url); - - path = rtl::OUString::createFromAscii(TEST_PATH_3); - osl_getFileURLFromSystemPath(path.pData, &path_url.pData); - test_getVolumeInformation(path_url); - - path = rtl::OUString::createFromAscii(TEST_PATH_4); - osl_getFileURLFromSystemPath(path.pData, &path_url.pData); - test_getVolumeInformation(path_url); - - path = rtl::OUString::createFromAscii(TEST_PATH_5); - osl_getFileURLFromSystemPath(path.pData, &path_url.pData); - test_getVolumeInformation(path_url); - - path = rtl::OUString::createFromAscii(TEST_PATH_6); - osl_getFileURLFromSystemPath(path.pData, &path_url.pData); - test_getVolumeInformation(path_url); - } +void test_osl_getVolumeInformation() +{ + rtl::OUString path = rtl::OUString::createFromAscii(TEST_PATH_1); + rtl::OUString path_url; + osl_getFileURLFromSystemPath(path.pData, &path_url.pData); + test_getVolumeInformation(path_url); - CPPUNIT_TEST_SUITE( TestClass_osl_getVolumeInformation ); - CPPUNIT_TEST( test_osl_getVolumeInformation ); - CPPUNIT_TEST_SUITE_END( ); -}; + path = rtl::OUString::createFromAscii(TEST_PATH_2); + osl_getFileURLFromSystemPath(path.pData, &path_url.pData); + test_getVolumeInformation(path_url); + + path = rtl::OUString::createFromAscii(TEST_PATH_3); + osl_getFileURLFromSystemPath(path.pData, &path_url.pData); + test_getVolumeInformation(path_url); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestClass_osl_getVolumeInformation, "Test osl_getVolumeInformation"); + path = rtl::OUString::createFromAscii(TEST_PATH_4); + osl_getFileURLFromSystemPath(path.pData, &path_url.pData); + test_getVolumeInformation(path_url); -NOADDITIONAL; + path = rtl::OUString::createFromAscii(TEST_PATH_5); + osl_getFileURLFromSystemPath(path.pData, &path_url.pData); + test_getVolumeInformation(path_url); + path = rtl::OUString::createFromAscii(TEST_PATH_6); + osl_getFileURLFromSystemPath(path.pData, &path_url.pData); + test_getVolumeInformation(path_url); +} + +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/sal/workben/t_osl_joinProcess.cxx b/sal/workben/t_osl_joinProcess.cxx index 7fc00e4..fd761d0 100644 --- a/sal/workben/t_osl_joinProcess.cxx +++ b/sal/workben/t_osl_joinProcess.cxx @@ -24,7 +24,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sal.hxx" -#include <cppunit/simpleheader.hxx> +#include "gtest/gtest.h" #include <osl/process.h> #include <rtl/ustring.hxx> #include <unistd.h> @@ -42,183 +42,142 @@ const rtl::OUString CWD = rtl::OUString::createFromAscii("."); // //------------------------------ -class Test_osl_Process : public CppUnit::TestFixture +class Test_osl_Process : public ::testing::Test { public: - - /*------------------------------------- - Start a process and join with this - process specify a timeout so that - osl_joinProcessWithTimeout returns - osl_Process_E_TimedOut - -------------------------------------*/ - - void test_osl_joinProcessWithTimeout_timeout_failure() - { - oslProcess process; - oslProcessError osl_error = osl_executeProcess( - IMAGE_NAME.pData, - NULL, - 0, - osl_Process_NORMAL, - osl_getCurrentSecurity(), - CWD.pData, - NULL, - 0, - &process); - - CPPUNIT_ASSERT_MESSAGE - ( - "osl_createProcess failed", - osl_error == osl_Process_E_None - ); - - TimeValue timeout; - timeout.Seconds = 1; - timeout.Nanosec = 0; - - osl_error = osl_joinProcessWithTimeout(process, &timeout); - - CPPUNIT_ASSERT_MESSAGE - ( - "osl_joinProcessWithTimeout returned without timeout failure", - osl_Process_E_TimedOut == osl_error - ); - - osl_error = osl_terminateProcess(process); - - CPPUNIT_ASSERT_MESSAGE - ( - "osl_terminateProcess failed", - osl_error == osl_Process_E_None - ); - - osl_freeProcessHandle(process); - } - - /*------------------------------------- - Start a process and join with this - process specify a timeout so that - osl_joinProcessWithTimeout returns - osl_Process_E_None - -------------------------------------*/ - - void test_osl_joinProcessWithTimeout_without_timeout_failure() - { - oslProcess process; - oslProcessError osl_error = osl_executeProcess( - IMAGE_NAME.pData, - NULL, - 0, - osl_Process_NORMAL, - osl_getCurrentSecurity(), - CWD.pData, - NULL, - 0, - &process); - - CPPUNIT_ASSERT_MESSAGE - ( - "osl_createProcess failed", - osl_error == osl_Process_E_None - ); - - TimeValue timeout; - timeout.Seconds = 10; - timeout.Nanosec = 0; - - osl_error = osl_joinProcessWithTimeout(process, &timeout); - - CPPUNIT_ASSERT_MESSAGE - ( - "osl_joinProcessWithTimeout returned with failure", - osl_Process_E_None == osl_error - ); - - osl_freeProcessHandle(process); - } - - /*------------------------------------- - Start a process and join with this - process specify an infinite timeout - -------------------------------------*/ - - void test_osl_joinProcessWithTimeout_infinite() - { - oslProcess process; - oslProcessError osl_error = osl_executeProcess( - IMAGE_NAME.pData, - NULL, - 0, - osl_Process_NORMAL, - osl_getCurrentSecurity(), - CWD.pData, - NULL, - 0, - &process); - - CPPUNIT_ASSERT_MESSAGE - ( - "osl_createProcess failed", - osl_error == osl_Process_E_None - ); - - osl_error = osl_joinProcessWithTimeout(process, NULL); - - CPPUNIT_ASSERT_MESSAGE - ( - "osl_joinProcessWithTimeout returned with failure", - osl_Process_E_None == osl_error - ); - - osl_freeProcessHandle(process); - } - - /*------------------------------------- - Start a process and join with this - process using osl_joinProcess - -------------------------------------*/ - - void test_osl_joinProcess() - { - oslProcess process; - oslProcessError osl_error = osl_executeProcess( - IMAGE_NAME.pData, - NULL, - 0, - osl_Process_NORMAL, - osl_getCurrentSecurity(), - CWD.pData, - NULL, - 0, - &process); - - CPPUNIT_ASSERT_MESSAGE - ( - "osl_createProcess failed", - osl_error == osl_Process_E_None - ); - - osl_error = osl_joinProcess(process); - - CPPUNIT_ASSERT_MESSAGE - ( - "osl_joinProcess returned with failure", - osl_Process_E_None == osl_error - ); - - osl_freeProcessHandle(process); - } - - CPPUNIT_TEST_SUITE(Test_osl_Process); - CPPUNIT_TEST(test_osl_joinProcessWithTimeout_timeout_failure); - CPPUNIT_TEST(test_osl_joinProcessWithTimeout_without_timeout_failure); - CPPUNIT_TEST(test_osl_joinProcessWithTimeout_infinite); - CPPUNIT_TEST(test_osl_joinProcess); - CPPUNIT_TEST_SUITE_END(); }; -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test_osl_Process, "Test_osl_Process"); +/*------------------------------------- + Start a process and join with this + process specify a timeout so that + osl_joinProcessWithTimeout returns + osl_Process_E_TimedOut + -------------------------------------*/ + +TEST_F(Test_osl_Process, test_osl_joinProcessWithTimeout_timeout_failure) +{ + oslProcess process; + oslProcessError osl_error = osl_executeProcess( + IMAGE_NAME.pData, + NULL, + 0, + osl_Process_NORMAL, + osl_getCurrentSecurity(), + CWD.pData, + NULL, + 0, + &process); + + ASSERT_TRUE(osl_error == osl_Process_E_None) << "osl_createProcess failed"; + + TimeValue timeout; + timeout.Seconds = 1; + timeout.Nanosec = 0; + + osl_error = osl_joinProcessWithTimeout(process, &timeout); + + ASSERT_TRUE(osl_Process_E_TimedOut == osl_error) << "osl_joinProcessWithTimeout returned without timeout failure"; + + osl_error = osl_terminateProcess(process); + + ASSERT_TRUE(osl_error == osl_Process_E_None) << "osl_terminateProcess failed"; + + osl_freeProcessHandle(process); +} + +/*------------------------------------- + Start a process and join with this + process specify a timeout so that + osl_joinProcessWithTimeout returns + osl_Process_E_None + -------------------------------------*/ + +TEST_F(Test_osl_Process, test_osl_joinProcessWithTimeout_without_timeout_failure) +{ + oslProcess process; + oslProcessError osl_error = osl_executeProcess( + IMAGE_NAME.pData, + NULL, + 0, + osl_Process_NORMAL, + osl_getCurrentSecurity(), + CWD.pData, + NULL, + 0, + &process); + + ASSERT_TRUE(osl_error == osl_Process_E_None) << "osl_createProcess failed"; + + TimeValue timeout; + timeout.Seconds = 10; + timeout.Nanosec = 0; + + osl_error = osl_joinProcessWithTimeout(process, &timeout); + + ASSERT_TRUE(osl_Process_E_None == osl_error) << "osl_joinProcessWithTimeout returned with failure"; -NOADDITIONAL; + osl_freeProcessHandle(process); +} + +/*------------------------------------- + Start a process and join with this + process specify an infinite timeout + -------------------------------------*/ + +TEST_F(Test_osl_Process, test_osl_joinProcessWithTimeout_infinite) +{ + oslProcess process; + oslProcessError osl_error = osl_executeProcess( + IMAGE_NAME.pData, + NULL, + 0, + osl_Process_NORMAL, + osl_getCurrentSecurity(), + CWD.pData, + NULL, + 0, + &process); + + ASSERT_TRUE(osl_error == osl_Process_E_None) << "osl_createProcess failed"; + + osl_error = osl_joinProcessWithTimeout(process, NULL); + + ASSERT_TRUE(osl_Process_E_None == osl_error) << "osl_joinProcessWithTimeout returned with failure"; + + osl_freeProcessHandle(process); +} + + /*------------------------------------- + Start a process and join with this + process using osl_joinProcess + -------------------------------------*/ + +TEST_F(Test_osl_Process, test_osl_joinProcess) +{ + oslProcess process; + oslProcessError osl_error = osl_executeProcess( + IMAGE_NAME.pData, + NULL, + 0, + osl_Process_NORMAL, + osl_getCurrentSecurity(), + CWD.pData, + NULL, + 0, + &process); + + ASSERT_TRUE(osl_error == osl_Process_E_None) << "osl_createProcess failed"; + + osl_error = osl_joinProcess(process); + + ASSERT_TRUE(osl_Process_E_None == osl_error) << "osl_joinProcess returned with failure"; + + osl_freeProcessHandle(process); +} + +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} commit 862bf0c6bed25d2edc1145c0b0d734c1deac9546 Author: Damjan Jovanovic <[email protected]> Date: Tue Oct 6 17:43:41 2015 +0000 #i125003# Commit leftover changes from some unit test. diff --git a/sal/qa/inc/valueequal.hxx b/sal/qa/inc/valueequal.hxx index 5e1e7f5..952c439 100644 --- a/sal/qa/inc/valueequal.hxx +++ b/sal/qa/inc/valueequal.hxx @@ -63,8 +63,8 @@ bool is_equal(T x, T y, sal_Int16 _nPrec) if (_nPrec != PREC_long_double) { - t_print(T_VERBOSE, "double equal: %.20f\n", x); - t_print(T_VERBOSE, " %.20f\n", y); + //t_print(T_VERBOSE, "double equal: %.20f\n", x); + //t_print(T_VERBOSE, " %.20f\n", y); } //here nPrecOfN is the number after dot sal_Int32 nBeforeDot = sal_Int32( log10(x) ); @@ -76,20 +76,24 @@ bool is_equal(T x, T y, sal_Int16 _nPrec) sal_Int32 nPrecOfN = -nPRECISION + nBeforeDot; if (_nPrec != PREC_long_double) - t_print(T_VERBOSE, "nPrecOfN is %d\n", nPrecOfN); + { + //t_print(T_VERBOSE, "nPrecOfN is %d\n", nPrecOfN); + } long double nPrec = pow(0.1, -nPrecOfN); if (_nPrec != PREC_long_double) - t_print(T_VERBOSE, " prec: %.20f\n", nPrec); + { + //t_print(T_VERBOSE, " prec: %.20f\n", nPrec); + } long double nDelta = fabs( x - y ) ; if (_nPrec != PREC_long_double) { - t_print(T_VERBOSE, " delta: %.20f\n", nDelta); - t_print(T_VERBOSE, " nPrec: %.20f\n", nPrec); - t_print(T_VERBOSE, "delta must be less or equal to prec!\n\n"); + //t_print(T_VERBOSE, " delta: %.20f\n", nDelta); + //t_print(T_VERBOSE, " nPrec: %.20f\n", nPrec); + //t_print(T_VERBOSE, "delta must be less or equal to prec!\n\n"); } if (nDelta > nPrec) _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
