summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-11-25 04:16:28 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-11-25 04:16:28 +0100
commit74f44646ba5b400cc39d78940677f136711459b5 (patch)
tree34e3f946ee8184fc70580b78e1f412ecf9acac95
parent31012ab9d7035f942486c87ecc1a79b4d6579975 (diff)
gdb stacktraces for subsequentchecks
-rw-r--r--solenv/gbuild/platform/IOS_ARM_GCC.mk1
-rw-r--r--solenv/gbuild/platform/macosx.mk1
-rw-r--r--solenv/gbuild/platform/solaris.mk1
-rw-r--r--solenv/gbuild/platform/unxgcc.mk2
-rwxr-xr-xsolenv/gbuild/platform/unxgcc_gdbforjunit.sh52
-rw-r--r--unotest/source/java/org/openoffice/test/OfficeConnection.java81
6 files changed, 110 insertions, 28 deletions
diff --git a/solenv/gbuild/platform/IOS_ARM_GCC.mk b/solenv/gbuild/platform/IOS_ARM_GCC.mk
index 8f013fbc6341..f8d44546aded 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 4b84db4f14d4..3beb09365ece 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 28dbba8c8517..a51edbfb63ed 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 7df93f02151f..8c8380c5acda 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 000000000000..ced044404f54
--- /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@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 b05c34bc3996..54a412d8ce21 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: