summaryrefslogtreecommitdiffstats
path: root/smoketest
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2016-02-12 11:46:37 -0500
committerTor Lillqvist <tml@collabora.com>2016-02-15 16:17:53 +0200
commitdf5f7c6abab820070771c5304514faf2a07bc588 (patch)
tree274fd4813096c4db8911eaf84d0124ad08208be8 /smoketest
parentAvoid deadlock between sd::ToolBarManager::Implementation::maMutex... (diff)
downloadcore-df5f7c6abab820070771c5304514faf2a07bc588.tar.gz
core-df5f7c6abab820070771c5304514faf2a07bc588.zip
Introduce lok_preinit() to preload all registered UNO implementations
Intended to be used from an application like the LibreOffice On-Line server so that it can be called in a process that then will call fork() several times, and much space consuming data will end up being shared. Change-Id: I65341c57d00308d246ec90deab8050b2c4bb3e61
Diffstat (limited to 'smoketest')
-rw-r--r--smoketest/libtest.cxx24
1 files changed, 23 insertions, 1 deletions
diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx
index 29959b07654d..98607fbd9609 100644
--- a/smoketest/libtest.cxx
+++ b/smoketest/libtest.cxx
@@ -82,7 +82,29 @@ int main (int argc, char **argv)
return 1;
// coverity[tainted_string] - build time test tool
- Office *pOffice = lok_cpp_init( argv[1] );
+ char *install_path = argv[1];
+
+ if( argc > 4 )
+ {
+ fprintf( stderr, "testing preinit\n");
+ char *imp_lib;
+ void *dlhandle;
+ dlhandle = lok_dlopen( install_path, &imp_lib );
+ if( !dlhandle )
+ {
+ fprintf( stderr, "Failed to link '%s'\n", lok_dlerror() );
+ return -1;
+ }
+ LokHookPreInit *preinit = (LokHookPreInit *) lok_dlsym( dlhandle, "lok_preinit" );
+ if( !preinit )
+ {
+ fprintf( stderr, "Failed to find pre-init symbol: %s\n", lok_dlerror() );
+ return -1;
+ }
+ preinit( install_path, NULL );
+ }
+
+ Office *pOffice = lok_cpp_init( install_path );
if( !pOffice )
{
fprintf( stderr, "Failed to initialize\n" );