diff options
author | Jelle van der Waa <jelle@vdwaa.nl> | 2013-09-10 20:01:23 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-11 15:50:41 +0000 |
commit | 550b275e634a5a16bf55cbb716f21608fa211e3e (patch) | |
tree | b704d133d84e5911dde8ed6a87c43278a9e926bb | |
parent | ac26b103af987f080ca14ad243033e5e0acda189 (diff) |
fdo#39625 Make existing cppunittests work
Change-Id: Ia3a59456fe82926141ccb2921aa47df4183ead86
Reviewed-on: https://gerrit.libreoffice.org/5905
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sal/CppunitTest_sal_rtl_process.mk | 22 | ||||
-rw-r--r-- | sal/Module_sal.mk | 1 | ||||
-rw-r--r-- | sal/qa/rtl/process/rtl_Process.cxx | 28 |
3 files changed, 36 insertions, 15 deletions
diff --git a/sal/CppunitTest_sal_rtl_process.mk b/sal/CppunitTest_sal_rtl_process.mk new file mode 100644 index 000000000000..177879892f04 --- /dev/null +++ b/sal/CppunitTest_sal_rtl_process.mk @@ -0,0 +1,22 @@ +# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- +# +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,sal_rtl_process)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sal_rtl_process,\ + sal/qa/rtl/process/rtl_Process \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sal_rtl_process,\ + sal \ + $(gb_UWINAPI) \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/sal/Module_sal.mk b/sal/Module_sal.mk index 8a23832df7e2..18db4b7ad815 100644 --- a/sal/Module_sal.mk +++ b/sal/Module_sal.mk @@ -43,6 +43,7 @@ $(eval $(call gb_Module_add_check_targets,sal,\ CppunitTest_sal_osl_security \ CppunitTest_sal_osl_thread \ CppunitTest_sal_rtl_alloc \ + CppunitTest_sal_rtl_process \ CppunitTest_sal_rtl_bootstrap \ CppunitTest_sal_rtl_cipher \ CppunitTest_sal_rtl_crc32 \ diff --git a/sal/qa/rtl/process/rtl_Process.cxx b/sal/qa/rtl/process/rtl_Process.cxx index 6f4826a429ef..fdc9f1998757 100644 --- a/sal/qa/rtl/process/rtl_Process.cxx +++ b/sal/qa/rtl/process/rtl_Process.cxx @@ -23,7 +23,10 @@ #include <string.h> #include <sal/types.h> -#include <testshl/simpleheader.hxx> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + #include <rtl/ustring.hxx> #include <rtl/string.hxx> #include <rtl/process.h> @@ -44,14 +47,13 @@ inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = NU { if ( msg != NULL ) { - t_print("#%s #printUString_u# ", msg ); + printf("#%s #printUString_u# ", msg ); } rtl::OString aString; aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ); - t_print("%s\n", (char *)aString.getStr( ) ); + printf("%s\n", (char *)aString.getStr( ) ); } -// ----------------------------------------------------------------------------- inline ::rtl::OUString getModulePath( void ) { ::rtl::OUString suDirPath; @@ -65,8 +67,6 @@ inline ::rtl::OUString getModulePath( void ) return suDirPath; } -// ----------------------------------------------------------------------------- - namespace rtl_Process { class getAppCommandArg : public CppUnit::TestFixture @@ -142,7 +142,7 @@ public: osl_Process_E_None == osl_error ); - t_print("the exit code is %d.\n", pInfo->Code ); + printf("the exit code is %d.\n", pInfo->Code ); CPPUNIT_ASSERT_MESSAGE("rtl_getAppCommandArg or rtl_getAppCommandArgCount error.", pInfo->Code == 2); delete pInfo; } @@ -262,11 +262,11 @@ public: sal_Char pUUID2[33]; pUUID2[32] = '\0'; - sal_uInt64 nRead = 0; - osl_readFile( *pChildOutputRead, pUUID2, 32, &nRead ); - t_print("read buffer is %s, nRead is %d \n", pUUID2, nRead ); - OUString suUUID2 = OUString::createFromAscii( pUUID2 ); - CPPUNIT_ASSERT_MESSAGE("getGlobalProcessId: got two same ProcessIds.", suUUID2.equalsAsciiL( pUUID1, 32) == sal_False ); + sal_uInt64 nRead = 0; + osl_readFile( *pChildOutputRead, pUUID2, 32, &nRead ); + printf("read buffer is %s, nRead is %" SAL_PRIdINT64 "\n", pUUID2, nRead ); + OUString suUUID2 = OUString::createFromAscii( pUUID2 ); + CPPUNIT_ASSERT_MESSAGE("getGlobalProcessId: got two same ProcessIds.", suUUID2.equalsAsciiL( pUUID1, 32) == sal_False ); } CPPUNIT_TEST_SUITE(getGlobalProcessId); @@ -282,10 +282,8 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Process::getAppCommandArg, "rtl_Proces CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Process::getGlobalProcessId, "rtl_Process"); -// ----------------------------------------------------------------------------- - // this macro creates an empty function, which will called by the RegisterAllFunctions() // to let the user the possibility to also register some functions by hand. -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |