summaryrefslogtreecommitdiff
path: root/testtools
diff options
context:
space:
mode:
authorCaolán McNamara <cmc@openoffice.org>2009-10-08 09:55:10 +0000
committerCaolán McNamara <cmc@openoffice.org>2009-10-08 09:55:10 +0000
commit52da3422e45f201a06aad88dfef80ee8d155750d (patch)
treeaa45750d28cf63b58756f892e4d5e5482067b8dd /testtools
parentd5c2cf42ec4f20ffebb7832f572af7f225ef4ec8 (diff)
#i105680# add struct returning bridge tests and run them during the build
Diffstat (limited to 'testtools')
-rw-r--r--testtools/com/sun/star/comp/bridge/TestComponent.java21
-rw-r--r--testtools/source/bridgetest/bridgetest.cxx22
-rw-r--r--testtools/source/bridgetest/cppobj.cxx9
-rw-r--r--testtools/source/bridgetest/idl/bridgetest.idl62
-rw-r--r--testtools/source/bridgetest/makefile.mk9
-rw-r--r--testtools/source/bridgetest/pyuno/makefile.mk9
6 files changed, 123 insertions, 9 deletions
diff --git a/testtools/com/sun/star/comp/bridge/TestComponent.java b/testtools/com/sun/star/comp/bridge/TestComponent.java
index aaaa2cb8ae10..3a3c60b8146d 100644
--- a/testtools/com/sun/star/comp/bridge/TestComponent.java
+++ b/testtools/com/sun/star/comp/bridge/TestComponent.java
@@ -47,12 +47,17 @@ import test.testtools.bridgetest.TestEnum;
import test.testtools.bridgetest.TestPolyStruct;
import test.testtools.bridgetest.TestPolyStruct2;
import test.testtools.bridgetest.TestStruct;
+import test.testtools.bridgetest.SmallStruct;
+import test.testtools.bridgetest.MediumStruct;
+import test.testtools.bridgetest.BigStruct;
+import test.testtools.bridgetest.AllFloats;
import test.testtools.bridgetest.XBridgeTest;
import test.testtools.bridgetest.XBridgeTest2;
import test.testtools.bridgetest.XCurrentContextChecker;
import test.testtools.bridgetest.XMulti;
import test.testtools.bridgetest.XRecursiveCall;
+
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
@@ -474,6 +479,22 @@ public class TestComponent {
return _testDataElements;
}
+ public SmallStruct echoSmallStruct( SmallStruct i_Struct) throws com.sun.star.uno.RuntimeException {
+ return i_Struct;
+ }
+
+ public MediumStruct echoMediumStruct( MediumStruct i_Struct) throws com.sun.star.uno.RuntimeException {
+ return i_Struct;
+ }
+
+ public BigStruct echoBigStruct( BigStruct i_Struct) throws com.sun.star.uno.RuntimeException {
+ return i_Struct;
+ }
+
+ public AllFloats echoAllFloats( AllFloats i_Struct) throws com.sun.star.uno.RuntimeException {
+ return i_Struct;
+ }
+
// Attributes
public boolean getBool() throws com.sun.star.uno.RuntimeException {
return _bool;
diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx
index d8b3a120bf68..97227fa5d2e7 100644
--- a/testtools/source/bridgetest/bridgetest.cxx
+++ b/testtools/source/bridgetest/bridgetest.cxx
@@ -32,6 +32,7 @@
#include "precompiled_testtools.hxx"
#include <stdio.h>
+#include <string.h>
#include <osl/diagnose.h>
#include "osl/diagnose.hxx"
#include <osl/time.h>
@@ -533,6 +534,27 @@ static sal_Bool performTest(
bRet = check( equals( aData, aRet ) && equals( aData, aRet2 ) , "struct comparison test") && bRet;
+ {
+ SmallStruct aIn(1, 2);
+ SmallStruct aOut = xLBT->echoSmallStruct(aIn);
+ bRet = check( memcmp(&aIn, &aOut, sizeof(SmallStruct)) == 0, "small struct test" ) && bRet;
+ }
+ {
+ MediumStruct aIn(1, 2, 3, 4);
+ MediumStruct aOut = xLBT->echoMediumStruct(aIn);
+ bRet = check( memcmp(&aIn, &aOut, sizeof(MediumStruct)) == 0, "medium struct test" ) && bRet;
+ }
+ {
+ BigStruct aIn(1, 2, 3, 4, 5, 6, 7, 8);
+ BigStruct aOut = xLBT->echoBigStruct(aIn);
+ bRet = check( memcmp(&aIn, &aOut, sizeof(BigStruct)) == 0, "big struct test" ) && bRet;
+ }
+ {
+ AllFloats aIn(1.1, 2.2, 3.3, 4.4);
+ AllFloats aOut = xLBT->echoAllFloats(aIn);
+ bRet = check( memcmp(&aIn, &aOut, sizeof(AllFloats)) == 0, "all floats struct test" ) && bRet;
+ }
+
// Test extended attributes that raise exceptions:
try {
xLBT->getRaiseAttr1();
diff --git a/testtools/source/bridgetest/cppobj.cxx b/testtools/source/bridgetest/cppobj.cxx
index eedbf54454f3..acfd6b8e21d5 100644
--- a/testtools/source/bridgetest/cppobj.cxx
+++ b/testtools/source/bridgetest/cppobj.cxx
@@ -217,6 +217,15 @@ public:
TestData& rStruct )
throw(com::sun::star::uno::RuntimeException);
+ virtual SmallStruct echoSmallStruct(const SmallStruct& rStruct) throw(com::sun::star::uno::RuntimeException)
+ { return rStruct; }
+ virtual MediumStruct echoMediumStruct(const MediumStruct& rStruct) throw(com::sun::star::uno::RuntimeException)
+ { return rStruct; }
+ virtual BigStruct echoBigStruct(const BigStruct& rStruct) throw(com::sun::star::uno::RuntimeException)
+ { return rStruct; }
+ virtual AllFloats echoAllFloats(const AllFloats& rStruct) throw(com::sun::star::uno::RuntimeException)
+ { return rStruct; }
+
virtual sal_Bool SAL_CALL getBool() throw(com::sun::star::uno::RuntimeException)
{ return _aData.Bool; }
virtual sal_Int8 SAL_CALL getByte() throw(com::sun::star::uno::RuntimeException)
diff --git a/testtools/source/bridgetest/idl/bridgetest.idl b/testtools/source/bridgetest/idl/bridgetest.idl
index fce8c1a21adc..206956755ee1 100644
--- a/testtools/source/bridgetest/idl/bridgetest.idl
+++ b/testtools/source/bridgetest/idl/bridgetest.idl
@@ -72,6 +72,48 @@ struct TestSimple
TestEnum Enum;
};
/**
+ * equal to max size returned in registers on x86_64
+ */
+struct SmallStruct
+{
+ hyper a;
+ hyper b;
+};
+/**
+ * equal to max size returned in registers on ia64
+ */
+struct MediumStruct
+{
+ hyper a;
+ hyper b;
+ hyper c;
+ hyper d;
+};
+/**
+ * bigger than max size returned in registers on ia64
+ */
+struct BigStruct
+{
+ hyper a;
+ hyper b;
+ hyper c;
+ hyper d;
+ hyper e;
+ hyper f;
+ hyper g;
+ hyper h;
+};
+/**
+ * all floats, ia64 handles them specially
+ */
+struct AllFloats
+{
+ float a;
+ float b;
+ float c;
+ float d;
+};
+/**
* complex types adding string, inteface, any
*/
struct TestElement : TestSimple
@@ -207,6 +249,26 @@ interface XBridgeTestBase : com::sun::star::uno::XInterface
[out] sequence< TestElement > aSequence,
[out] TestData aStruct );
+ /**
+ * register return test 1
+ */
+ SmallStruct echoSmallStruct( [in] SmallStruct aStruct );
+
+ /**
+ * register return test 2
+ */
+ MediumStruct echoMediumStruct( [in] MediumStruct aStruct );
+
+ /**
+ * register return test 3
+ */
+ BigStruct echoBigStruct( [in] BigStruct aStruct );
+
+ /**
+ * register return test 4
+ */
+ AllFloats echoAllFloats( [in] AllFloats aStruct );
+
[attribute] boolean Bool;
[attribute] byte Byte;
[attribute] char Char;
diff --git a/testtools/source/bridgetest/makefile.mk b/testtools/source/bridgetest/makefile.mk
index 6c475fd8ee3c..da2ed1cbc4b1 100644
--- a/testtools/source/bridgetest/makefile.mk
+++ b/testtools/source/bridgetest/makefile.mk
@@ -134,7 +134,7 @@ JAVATARGETS=\
.INCLUDE : target.mk
.IF "$(L10N_framework)"==""
ALLTAR: \
- test \
+ runtest \
$(DLLDEST)$/uno_types.rdb \
$(DLLDEST)$/uno_services.rdb \
$(DLLDEST)$/bridgetest_inprocess$(BATCH_SUFFIX) \
@@ -144,8 +144,11 @@ ALLTAR: \
#################################################################
-test:
- echo $(compcheck)
+runtest : $(DLLDEST)$/uno_types.rdb $(DLLDEST)$/uno_services.rdb makefile.mk
+ cd $(DLLDEST) && $(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/uno \
+ -ro uno_services.rdb -ro uno_types.rdb \
+ -s com.sun.star.test.bridge.BridgeTest -- \
+ com.sun.star.test.bridge.CppTestObject
$(DLLDEST)$/uno_types.rdb : $(SOLARBINDIR)$/udkapi.rdb
echo $(DLLDEST)
diff --git a/testtools/source/bridgetest/pyuno/makefile.mk b/testtools/source/bridgetest/pyuno/makefile.mk
index 4ee8768ff466..e0ebad0c1eb3 100644
--- a/testtools/source/bridgetest/pyuno/makefile.mk
+++ b/testtools/source/bridgetest/pyuno/makefile.mk
@@ -92,7 +92,7 @@ PYCOMPONENTS = \
ALL : \
$(PYFILES) \
$(DLLDEST)$/pyuno_regcomp.rdb \
- doc \
+ runtest \
ALLTAR
.ENDIF # L10N_framework
@@ -111,11 +111,8 @@ $(DLLDEST)$/pyuno_regcomp.rdb: $(DLLDEST)$/uno_types.rdb $(SOLARBINDIR)$/pyuno_s
-rm -f $@
$(WRAPCMD) $(REGMERGE) $(DLLDEST)$/pyuno_regcomp.rdb / $(DLLDEST)$/uno_types.rdb $(SOLARBINDIR)$/pyuno_services.rdb
-doc .PHONY:
- @echo start test with dmake runtest
-
-runtest : ALL
- cd $(DLLDEST) && $(TEST_ENV) && python main.py
+runtest : $(DLLDEST)$/pyuno_regcomp.rdb $(PYFILES)
+ cd $(DLLDEST) && $(TEST_ENV) && $(PYTHON) main.py
cd $(DLLDEST) && $(TEST_ENV) && $(WRAPCMD) $(REGCOMP) -register -br pyuno_regcomp.rdb -r dummy.rdb \
-l com.sun.star.loader.Python $(foreach,i,$(PYCOMPONENTS) -c vnd.openoffice.pymodule:$(i))
cd $(DLLDEST) && $(TEST_ENV) && $(WRAPCMD) $(REGCOMP) -register -br pyuno_regcomp.rdb -r dummy2.rdb \