summaryrefslogtreecommitdiff
path: root/smoketest
diff options
context:
space:
mode:
authorChristoph Lutz <christoph.lutz@cib.de>2013-11-05 23:34:37 +0100
committerMichael Meeks <michael.meeks@collabora.com>2013-11-07 11:50:00 +0000
commit49112ec909ef465ecb1aa2786a283b57034e6af4 (patch)
tree87940088328b4ad1e96d74f9996972a82e926c4c /smoketest
parent67311738157bced7b49e94b24845091995edb142 (diff)
liblibo: fixes and improvements for liblibreoffice
fixes for liblibreoffice-Impl (init.cxx): determine outputfilter from file suffix if no filter is provided; ensure that url provided to XStorable.storeToUrl is really an url; improved error handling small improvements in somektest/libtest.cxx: output times required for init, load and save. Change-Id: Ic8b2c0d34cbeae3250c43cac02690e6ec1954ed7
Diffstat (limited to 'smoketest')
-rw-r--r--smoketest/libtest.cxx30
1 files changed, 29 insertions, 1 deletions
diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx
index 4b9d1b3c884d..ffacd188307e 100644
--- a/smoketest/libtest.cxx
+++ b/smoketest/libtest.cxx
@@ -10,10 +10,18 @@
#include <stdio.h>
#include <malloc.h>
#include <assert.h>
+#include <math.h>
+#include <time.h>
#include <liblibreoffice.hxx>
+long getTimeMS();
+
int main (int argc, char **argv)
{
+ long start, end;
+
+ start = getTimeMS();
+
if( argc < 2 )
return -1;
LibLibreOffice *pOffice = lo_init( argv[1] );
@@ -25,6 +33,11 @@ int main (int argc, char **argv)
fprintf( stderr, "failed to initialize\n" );
return -1;
}
+
+ end = getTimeMS();
+ fprintf( stderr, "init time: %ld ms\n", (end-start) );
+ start = end;
+
fprintf( stderr, "start to load document '%s'\n", argv[2] );
LODocument *pDocument = pOffice->documentLoad( argv[2] );
if( !pDocument )
@@ -36,6 +49,10 @@ int main (int argc, char **argv)
return -1;
}
+ end = getTimeMS();
+ fprintf( stderr, "load time: %ld ms\n", (end-start) );
+ start = end;
+
if( argc > 3 )
{
const char *pFilter = NULL;
@@ -49,9 +66,13 @@ int main (int argc, char **argv)
free (pError);
}
else
+ {
fprintf( stderr, "Save succeeded\n" );
+ end = getTimeMS();
+ fprintf( stderr, "save time: %ld ms\n", (end-start) );
+ }
}
- fprintf( stderr, "all tests passed." );
+ fprintf( stderr, "all tests passed.\n" );
delete pDocument;
delete pOffice;
@@ -59,4 +80,11 @@ int main (int argc, char **argv)
return 0;
}
+long getTimeMS() {
+ struct timespec t;
+ clock_gettime(CLOCK_MONOTONIC, &t);
+ long ms = round(t.tv_nsec / 1.0e6) + t.tv_sec * 1000;
+ return ms;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */