From fd2e631d587fb9dc9260cbcb6ca5f40512cd15a7 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 11 Jul 2011 00:40:49 +0300 Subject: Make iOS sal unit testing actually work We must call the initialize() methods of the plugins which for iOS aren't actually plugins in the sense of being dynamically loaded, but still. Unfortunately this means we have to list the plugin interface getter functions explicitly in the sal_cppunittester_all source. --- sal/osl/unx/module.c | 3 ++- sal/osl/unx/system.h | 1 + sal/qa/static/makefile.mk | 1 - sal/qa/static/sal_cppunittester_all.cxx | 27 +++++++++++++++++++++++++-- 4 files changed, 28 insertions(+), 4 deletions(-) (limited to 'sal') diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c index 63634c7bd4a2..5076138cdd75 100644 --- a/sal/osl/unx/module.c +++ b/sal/osl/unx/module.c @@ -208,7 +208,8 @@ osl_getFunctionSymbol(oslModule module, rtl_uString *puFunctionSymbolName) sal_Bool SAL_CALL osl_getModuleURLFromAddress(void * addr, rtl_uString ** ppLibraryUrl) { sal_Bool result = sal_False; -#ifndef NO_DL_FUNCTIONS +/* Bah, we do want to use dladdr here also on iOS, I think? */ +#if !defined(NO_DL_FUNCTIONS) || defined(IOS) #if defined(AIX) int i; int size = 4 * 1024; diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h index a9aaeb60e740..ef6d884b89c8 100644 --- a/sal/osl/unx/system.h +++ b/sal/osl/unx/system.h @@ -354,6 +354,7 @@ int macxp_resolveAlias(char *path, int buflen); # ifndef ETIME # define ETIME ETIMEDOUT # endif +# include # include # include # include diff --git a/sal/qa/static/makefile.mk b/sal/qa/static/makefile.mk index c76cf40bee8a..0762e73378ce 100644 --- a/sal/qa/static/makefile.mk +++ b/sal/qa/static/makefile.mk @@ -54,7 +54,6 @@ APP1LIBS += \ $(SLB)/qa_ostringbuffer.lib \ $(SLB)/qa_osl_condition.lib \ $(SLB)/qa_osl_file.lib \ - $(SLB)/qa_osl_process.lib \ $(SLB)/qa_osl_security.lib APP1STDLIBS = $(CPPUNITLIB) $(SALLIB) diff --git a/sal/qa/static/sal_cppunittester_all.cxx b/sal/qa/static/sal_cppunittester_all.cxx index b5ead718d733..b5fb89b49bf9 100644 --- a/sal/qa/static/sal_cppunittester_all.cxx +++ b/sal/qa/static/sal_cppunittester_all.cxx @@ -49,6 +49,8 @@ #include "cppunit/TestResult.h" #include "cppunit/TestResultCollector.h" #include "cppunit/TestRunner.h" +#include "cppunit/plugin/TestPlugIn.h" +#include "cppunit/plugin/PlugInParameters.h" #include "cppunit/extensions/TestFactoryRegistry.h" #include "cppunit/portability/Stream.h" @@ -111,12 +113,33 @@ public: }; } +extern "C" CppUnitTestPlugIn *cppunitTest_qa_ByteSequence(void), + *cppunitTest_qa_ostringbuffer(void), + *cppunitTest_qa_osl_condition(void), + *cppunitTest_qa_osl_File(void), + *cppunitTest_tcwf(void), + *cppunitTest_osl_old_test_file(void), + *cppunitTest_qa_osl_security(void); + SAL_IMPLEMENT_MAIN() { + TestPlugInSignature plugs[] = { + cppunitTest_qa_ByteSequence, + cppunitTest_qa_ostringbuffer, + cppunitTest_qa_osl_condition, + cppunitTest_qa_osl_File, + cppunitTest_tcwf, + cppunitTest_osl_old_test_file, + cppunitTest_qa_osl_security, + NULL + }; CppUnit::TestResult result; - cppunittester::LibreOfficeProtector *throw_protector = 0; std::string args; - sal_uInt32 index = 0; bool ok = false; + for (TestPlugInSignature *plug = plugs; *plug != NULL; plug++) { + CppUnitTestPlugIn *iface; + iface = (*plug)(); + iface->initialize(&CppUnit::TestFactoryRegistry::getRegistry(), CppUnit::PlugInParameters()); + } ProtectedFixtureFunctor tests(args, result); ok = tests.run(); -- cgit