[Libreoffice-commits] .: solenv/gbuild unotest/source

Bjoern Michaelsen bmichaelsen at kemper.freedesktop.org
Thu Nov 24 19:19:11 PST 2011


 solenv/gbuild/platform/IOS_ARM_GCC.mk                         |    1 
 solenv/gbuild/platform/macosx.mk                              |    1 
 solenv/gbuild/platform/solaris.mk                             |    1 
 solenv/gbuild/platform/unxgcc.mk                              |    2 
 solenv/gbuild/platform/unxgcc_gdbforjunit.sh                  |   52 ++++++
 unotest/source/java/org/openoffice/test/OfficeConnection.java |   81 ++++++----
 6 files changed, 110 insertions(+), 28 deletions(-)

New commits:
commit 74f44646ba5b400cc39d78940677f136711459b5
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Nov 25 04:16:28 2011 +0100

    gdb stacktraces for subsequentchecks

diff --git a/solenv/gbuild/platform/IOS_ARM_GCC.mk b/solenv/gbuild/platform/IOS_ARM_GCC.mk
index 8f013fb..f8d4454 100644
--- a/solenv/gbuild/platform/IOS_ARM_GCC.mk
+++ b/solenv/gbuild/platform/IOS_ARM_GCC.mk
@@ -302,6 +302,7 @@ $(call gb_JunitTest_get_target,$(1)) : DEFS := \
 	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(OUTDIR)/installation/opt/LibreOffice.app/Contents/MacOS/soffice}" \
 	-Dorg.openoffice.test.arg.env=DYLD_LIBRARY_PATH \
 	-Dorg.openoffice.test.arg.user=file://$(call gb_JunitTest_get_userdir,$(1)) \
+	-Dorg.openoffice.test.arg.workdir=$(call gb_JunitTest_get_userdir,$(1)) \
 
 endef
 
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index 4b84db4..3beb093 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -383,6 +383,7 @@ $(call gb_JunitTest_get_target,$(1)) : DEFS := \
 	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(OUTDIR)/installation/opt/LibreOffice.app/Contents/MacOS/soffice}" \
 	-Dorg.openoffice.test.arg.env=DYLD_LIBRARY_PATH \
 	-Dorg.openoffice.test.arg.user=file://$(call gb_JunitTest_get_userdir,$(1)) \
+	-Dorg.openoffice.test.arg.workdir=$(call gb_JunitTest_get_userdir,$(1)) \
 
 endef
 
diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk
index 28dbba8..a51edbf 100644
--- a/solenv/gbuild/platform/solaris.mk
+++ b/solenv/gbuild/platform/solaris.mk
@@ -367,6 +367,7 @@ $(call gb_JunitTest_get_target,$(1)) : DEFS := \
 	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(OUTDIR)/installation/opt/program/soffice}" \
 	-Dorg.openoffice.test.arg.env=LD_LIBRARY_PATH \
 	-Dorg.openoffice.test.arg.user=file://$(call gb_JunitTest_get_userdir,$(1)) \
+	-Dorg.openoffice.test.arg.workdir=$(call gb_JunitTest_get_userdir,$(1)) \
 
 endef
 
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 7df93f0..8c8380c 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -382,6 +382,8 @@ $(call gb_JunitTest_get_target,$(1)) : DEFS := \
 	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(OUTDIR)/installation/opt/program/soffice}" \
 	-Dorg.openoffice.test.arg.env=$(gb_Helper_LIBRARY_PATH_VAR) \
 	-Dorg.openoffice.test.arg.user=file://$(call gb_JunitTest_get_userdir,$(1)) \
+	-Dorg.openoffice.test.arg.workdir=$(call gb_JunitTest_get_userdir,$(1)) \
+	-Dorg.openoffice.test.arg.postprocesscommand=$(GBUILDDIR)/platform/unxgcc_gdbforjunit.sh \
 
 endef
 
diff --git a/solenv/gbuild/platform/unxgcc_gdbforjunit.sh b/solenv/gbuild/platform/unxgcc_gdbforjunit.sh
new file mode 100755
index 0000000..ced0444
--- /dev/null
+++ b/solenv/gbuild/platform/unxgcc_gdbforjunit.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Initial Developer of the Original Code is
+#       Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
+# Portions created by the Initial Developer are Copyright (C) 2010 Canonical,
+# Ltd. . All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+#
+
+# we expect our work directory to be where soffice had been started
+# $(1) should be the path to the executable
+
+OFFICEFILE=${1}
+WORKDIR=${2}
+
+if test -e ${WORKDIR}/core
+then
+    STORELOCATION=`mktemp --tmpdir=${WORKDIR} core.XXXX`
+    echo "Found a core dump at ${WORKDIR}, moving it to ${STORELOCATION}"
+    mv ${WORKDIR}/core ${STORELOCATION}
+    echo "Stacktrace:"
+    GDBCOMMANDFILE=`mktemp`
+    echo "bt" > ${GDBCOMMANDFILE}
+    gdb -x $GDBCOMMANDFILE --batch ${OFFICEFILE}.bin ${STORELOCATION}
+    rm ${GDBCOMMANDFILE}
+    exit 1
+else
+    exit 0
+fi
+
+# vim: set et sw=4 sts=4:
diff --git a/unotest/source/java/org/openoffice/test/OfficeConnection.java b/unotest/source/java/org/openoffice/test/OfficeConnection.java
index b05c34b..54a412d 100644
--- a/unotest/source/java/org/openoffice/test/OfficeConnection.java
+++ b/unotest/source/java/org/openoffice/test/OfficeConnection.java
@@ -34,6 +34,7 @@ import com.sun.star.lang.DisposedException;
 import com.sun.star.lang.XMultiComponentFactory;
 import com.sun.star.uno.UnoRuntime;
 import com.sun.star.uno.XComponentContext;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
@@ -60,6 +61,7 @@ public final class OfficeConnection {
                 "--accept=" + description + ";urp",
                 "-env:UserInstallation=" + Argument.get("user"),
                 "-env:UNO_JAVA_JFW_ENV_JREHOME=true");
+            pb.directory(new File(Argument.get("workdir")));
             String envArg = Argument.get("env");
             if (envArg != null) {
                 Map<String, String> env = pb.environment();
@@ -110,36 +112,58 @@ public final class OfficeConnection {
     public void tearDown()
         throws InterruptedException, com.sun.star.uno.Exception
     {
-        boolean desktopTerminated = true;
-        if (process != null) {
-            if (context != null) {
-                XMultiComponentFactory factory = context.getServiceManager();
-                assertNotNull(factory);
-                XDesktop desktop = UnoRuntime.queryInterface(
-                    XDesktop.class,
-                    factory.createInstanceWithContext(
-                        "com.sun.star.frame.Desktop", context));
-                context = null;
-                try {
-                    desktopTerminated = desktop.terminate();
-                } catch (DisposedException e) {}
-                    // it appears that DisposedExceptions can already happen
-                    // while receiving the response of the terminate call
-                desktop = null;
-            } else {
-                process.destroy();
+        try {
+            boolean desktopTerminated = true;
+            if (process != null) {
+                if (context != null) {
+                    XMultiComponentFactory factory = context.getServiceManager();
+                    assertNotNull(factory);
+                    XDesktop desktop = UnoRuntime.queryInterface(
+                        XDesktop.class,
+                        factory.createInstanceWithContext(
+                            "com.sun.star.frame.Desktop", context));
+                    context = null;
+                    try {
+                        desktopTerminated = desktop.terminate();
+                    } catch (DisposedException e) {}
+                        // it appears that DisposedExceptions can already happen
+                        // while receiving the response of the terminate call
+                    desktop = null;
+                } else {
+                    process.destroy();
+                }
             }
+            int code = 0;
+            if (process != null) {
+                code = process.waitFor();
+            }
+            boolean outTerminated = outForward == null || outForward.terminated();
+            boolean errTerminated = errForward == null || errForward.terminated();
+            assertTrue(desktopTerminated);
+            assertEquals(0, code);
+            assertTrue(outTerminated);
+            assertTrue(errTerminated);
+        } finally {
+            try {
+                String sofficeArg = Argument.get("soffice");
+                String workdir = Argument.get("workdir");
+                String postprocesscommand = Argument.get("postprocesscommand");
+                if(sofficeArg.startsWith("path:") && workdir != null && postprocesscommand != null) {
+                    ProcessBuilder pb = new ProcessBuilder(
+                        postprocesscommand,
+                        sofficeArg.substring("path:".length()),
+                        workdir);
+                    Process postprocess = pb.start();
+                    Forward ppoutForward = new Forward(postprocess.getInputStream(), System.out);
+                    ppoutForward.start();
+                    Forward pperrForward = new Forward(postprocess.getErrorStream(), System.err);
+                    pperrForward.start();
+                    postprocess.waitFor();
+                    assertEquals(0, postprocess.exitValue());
+                }
+            }
+            catch(IOException e) {}
         }
-        int code = 0;
-        if (process != null) {
-            code = process.waitFor();
-        }
-        boolean outTerminated = outForward == null || outForward.terminated();
-        boolean errTerminated = errForward == null || errForward.terminated();
-        assertTrue(desktopTerminated);
-        assertEquals(0, code);
-        assertTrue(outTerminated);
-        assertTrue(errTerminated);
     }
 
     /** Obtain the component context of the running OOo instance.
@@ -227,3 +251,4 @@ public final class OfficeConnection {
     private Forward errForward = null;
     private XComponentContext context = null;
 }
+// vim:set et sw=4 sts=4:


More information about the Libreoffice-commits mailing list