[Libreoffice-commits] core.git: Branch 'feature/liblibo' - Repository.mk smoketest/CppunitTest_liblibreoffice.mk smoketest/Executable_libtest.mk smoketest/libtest.cxx smoketest/Module_smoketest.mk

Michael Meeks michael.meeks at suse.com
Tue Mar 5 14:23:05 PST 2013


 Repository.mk                           |    1 
 smoketest/CppunitTest_liblibreoffice.mk |   33 ----------------
 smoketest/Executable_libtest.mk         |   36 +++++++++++++++++
 smoketest/Module_smoketest.mk           |    2 
 smoketest/libtest.cxx                   |   65 ++++++--------------------------
 5 files changed, 52 insertions(+), 85 deletions(-)

New commits:
commit 1b83b0c2aa5c9cbe3bb0b4292c0349a6f4a54849
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Mar 5 22:21:57 2013 +0000

    liblibo: abandon CppunitTest for custom rules avoiding linking issues.
    
    Change-Id: I2017075bf3b3c7198bde53b9fe85585089e5ab6c

diff --git a/Repository.mk b/Repository.mk
index d1f1956..76ee6f5 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_Helper_register_executables,NONE, \
     gsicheck \
     helpex \
     idxdict \
+	libtest \
     lngconvex \
     localize \
     makedepend \
diff --git a/smoketest/CppunitTest_liblibreoffice.mk b/smoketest/CppunitTest_liblibreoffice.mk
deleted file mode 100644
index e784a3a..0000000
--- a/smoketest/CppunitTest_liblibreoffice.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- Mode: makefile-gmake; 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,liblibreoffice))
-
-$(eval $(call gb_CppunitTest_abort_on_assertion,liblibreoffice))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,liblibreoffice,\
-	smoketest/libtest \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,liblibreoffice,\
-	libreoffice \
-))
-
-ifeq ($(OS),MACOSX)
-liblibreoffice_SOFFICE_INST := $(DEVINSTALLDIR)/opt/LibreOffice.app/Contents/MacOS
-else
-liblibreoffice_SOFFICE_INST := $(DEVINSTALLDIR)/opt/program
-endif
-
-$(eval $(call gb_CppunitTest_add_arguments,liblibreoffice,\
-	-env:arg-soffice=$(liblibreoffice_SOFFICE_INST) \
-	-env:arg-testarg.smoketest.doc=$(OUTDIR)/bin/smoketestdoc.sxw \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/smoketest/Executable_libtest.mk b/smoketest/Executable_libtest.mk
new file mode 100644
index 0000000..75c534c
--- /dev/null
+++ b/smoketest/Executable_libtest.mk
@@ -0,0 +1,36 @@
+# -*- Mode: makefile-gmake; 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_Executable_Executable,libtest))
+
+$(eval $(call gb_Executable_set_include,libtest,\
+	$$(INCLUDE) \
+	-I$(SRCDIR)/desktop/inc \
+))
+
+$(eval $(call gb_Executable_use_libraries,libtest,\
+	libreoffice \
+	$(gb_UWINAPI) \
+))
+
+$(eval $(call gb_Executable_add_exception_objects,libtest,\
+	smoketest/libtest \
+))
+
+ifeq ($(OS),MACOSX)
+liblibreoffice_SOFFICE_INST := $(DEVINSTALLDIR)/opt/LibreOffice.app/Contents/MacOS
+else
+liblibreoffice_SOFFICE_INST := $(DEVINSTALLDIR)/opt/program
+endif
+
+run_libtest:
+	$(call gb_LinkTarget_get_target,Executable/libtest) \
+		$(liblibreoffice_SOFFICE_INST) $(OUTDIR)/bin/smoketestdoc.sxw \
+
+# vim: set noet sw=4 ts=4:
diff --git a/smoketest/Module_smoketest.mk b/smoketest/Module_smoketest.mk
index 9a2aa72..b82a037 100644
--- a/smoketest/Module_smoketest.mk
+++ b/smoketest/Module_smoketest.mk
@@ -43,7 +43,7 @@ $(eval $(call gb_Module_add_targets,smoketest,\
 endif
 
 $(eval $(call gb_Module_add_check_targets,smoketest,\
-	CppunitTest_liblibreoffice \
+	Executable_libtest \
 ))
 
 $(eval $(call gb_Module_add_subsequentcheck_targets,smoketest,\
diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx
index 4e452a7..86e2abc 100644
--- a/smoketest/libtest.cxx
+++ b/smoketest/libtest.cxx
@@ -7,60 +7,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-// yuck / FIXME ...
-#include "../desktop/inc/liblibreoffice.hxx"
-
 #include <assert.h>
+#include <liblibreoffice.hxx>
 
-#include <sal/types.h>
-#include <rtl/ustring.hxx>
-#include <rtl/bootstrap.hxx>
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
-
-class Test: public CppUnit::TestFixture {
-public:
-    virtual void setUp();
-    virtual void tearDown();
-
-private:
-    CPPUNIT_TEST_SUITE(Test);
-    CPPUNIT_TEST(test);
-    CPPUNIT_TEST_SUITE_END();
-
-    void test();
-};
-
-void Test::setUp()
-{
-}
-void Test::tearDown()
-{
-}
-
-void Test::test()
+int main (int argc, char **argv)
 {
-    rtl::OUString aArgSoffice;
-    rtl::Bootstrap::get( rtl::OUString( "arg-soffice" ), aArgSoffice );
-    OString aInstall = OUStringToOString( aArgSoffice, RTL_TEXTENCODING_UTF8 );
-    fprintf( stderr, "liblibreoffice test: '%s'\n", aInstall.getStr() );
-    LibLibreOffice *pOffice = lo_init( aInstall.getStr() );
-    CPPUNIT_ASSERT( pOffice != NULL );
-
-    bool bInited = pOffice->initialize( aInstall.getStr() );
-    CPPUNIT_ASSERT( bInited );
-
-    rtl::OUString aArgDoc;
-    rtl::Bootstrap::get( rtl::OUString( "arg-testarg.smoketest.doc" ), aArgDoc );
-    OString aDoc = OUStringToOString ( aArgDoc, RTL_TEXTENCODING_UTF8 );
-    fprintf ( stderr, "liblibreoffice doc arg: '%s'\n", aDoc.getStr() );
-    pOffice->documentLoad ( aDoc.getStr() );
+    if( argc < 2 )
+        return -1;
+    LibLibreOffice *pOffice = lo_init( argv[1] );
+    if( !pOffice )
+        return -1;
+    // This separate init is lame I think.
+    if( !pOffice->initialize( argv[1] ) )
+        return -1;
+    LODocument *pDocument = pOffice->documentLoad( argv[2] );
+    if( !pDocument )
+        return -1;
+    return 0;
 }
 
-CPPUNIT_TEST_SUITE_REGISTRATION(Test);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list