diff options
author | Tor Lillqvist <tml@iki.fi> | 2012-02-22 14:04:28 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2012-02-22 22:35:55 +0200 |
commit | 59dfa5518097138f1c1864cd3b6d7f5072572e74 (patch) | |
tree | b6c6564f7444b9df105a672045921a5760138b02 /sal/cppunittester | |
parent | 6239540d7d1ea0c9fa83fede64c6ce10f00dba71 (diff) |
cppunittester hacks for iOS, intermediate commit
For iOS cppunit plugins aren't really "plugins" (shared libraries),
but just static archives. In the real main program of a cppunit app
(such are not yet written), which calls the lo_main() (the
SAL_IMPLEMENT_MAIN() in cppunittester.cxx) we specifically will call
the initialize methods of the CppUnitTestPlugIns that we statically
link to the app executable. Hopefully that will work out as expected.
Diffstat (limited to 'sal/cppunittester')
-rw-r--r-- | sal/cppunittester/cppunittester.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index d422613e5c19..a34ea6142a79 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -128,9 +128,17 @@ public: } bool run() const { +#ifdef IOS + // For iOS cppunit plugins aren't really "plugins" (shared + // libraries), but just static archives. In the real main + // program of a cppunit app, which calls the lo_main() that + // the SAL_IMPLEMENT_MAIN() below expands to, we specifically + // call the initialize methods of the CppUnitTestPlugIns that + // we statically link to the app executable. +#else CppUnit::PlugInManager manager; manager.load(testlib, args); - +#endif CppUnit::TestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); @@ -198,10 +206,18 @@ SAL_IMPLEMENT_MAIN() { if (rtl_getAppCommandArgCount() - index < 3) { usageFailure(); } +#ifndef IOS rtl::OUString lib(getArgument(index + 1)); rtl::OUString sym(getArgument(index + 2)); modules.push_back(new osl::Module(lib, SAL_LOADMODULE_GLOBAL)); oslGenericFunction fn = modules.back().getFunctionSymbol(sym); +#else + // The only "protector" we ever use is the unoexceptionprotector... + // Oh the joys of over-engineering. + rtl::OUString lib(RTL_CONSTASCII_USTRINGPARAM("<static>")); + rtl::OUString sym(RTL_CONSTASCII_USTRINGPARAM("unoexceptionprotector")); + oslGenericFunction fn = (oslGenericFunction) unoexceptionprotector; +#endif throw_protector = fn == 0 ? 0 : (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))(); |