diff options
author | Tor Lillqvist <tml@collabora.com> | 2020-11-12 21:46:06 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2020-11-15 10:46:43 +0100 |
commit | 83e42396f45ff542a8b19747583d015347ddc22b (patch) | |
tree | 692d5f1a0758750b96b09164529d374e006cd333 /testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx | |
parent | f228db3e47bbb18f1560e4d118d57d00e46eaf6f (diff) |
Make bridgetest exercise parameter passing in the C++/UNO bridge harder
The C++/UNO bridge for macOS on arm64 currently uses the Linux code.
Apple's ABI uses slightly different parameter passing on the stack,
though. See
https://developer.apple.com/documentation/xcode/writing_arm64_code_for_apple_platforms?language=objc
That has not been taken into account yet in the bridge code. The
bridgetest, when run on macOS on arm64, didn't notice, sadly, but
succeeded. With this change it crashes, as one would expect it to do.
Add one more byte and short parameter to the setValues(), setValues2()
and getValues() calls in the XBridgeTestBase interface. The stack
allocation for those [in] parameters to setValues() differ between the
Linux and Apple ABIs. Add corresponding attributes to the interface,
and members to the SimpleTest struct.
The changes to the source files in the cli subdirectory (C++/CLI,
VB.NET, and C#) are done blindly as they aren't compiled even on
Windows currently. Most likely the changes to them are incomplete and
erroneous.
Change-Id: I6f689a130d89b23cad9918829107d7da49a79c55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105770
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105888
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx')
-rw-r--r-- | testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx b/testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx index cec2a2a4038d..847e04cf93ad 100644 --- a/testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx +++ b/testtools/source/bridgetest/cli/cli_cpp_bridgetest.cxx @@ -194,6 +194,8 @@ public __gc class BridgeTest : public WeakBase, public XMain check( rData1->Double == rData2->Double, "### double does not match!" ); check( rData1->Enum == rData2->Enum, "### enum does not match!" ); check( rData1->String == rData2->String, "### string does not match!" ); + check( rData1->Byte2 == rData2->Byte2, "### byte2 does not match!" ); + check( rData1->Short2 == rData2->Short2, "### short2 does not match!" ); check( rData1->Interface == rData2->Interface, "### interface does not match!" ); check( compareData(__box(rData1->Any), __box(rData2->Any)), "### any does not match!" ); @@ -210,6 +212,8 @@ public __gc class BridgeTest : public WeakBase, public XMain rData1->Double == rData2->Double && rData1->Enum == rData2->Enum && rData1->String == rData2->String && + rData1->Byte2 == rData2->Byte2 && + rData1->Short2 == rData2->Short2 && rData1->Interface == rData2->Interface && compareData(__box(rData1->Any), __box(rData2->Any))); } @@ -221,6 +225,7 @@ static void assign( TestElement* rData, Int64 nHyper, UInt64 nUHyper, float fFloat, double fDouble, TestEnum eEnum, String* rStr, + Byte nByte2, Int16 nShort2, Object* xTest, uno::Any rAny ) { @@ -237,6 +242,8 @@ static void assign( TestElement* rData, rData->Double = fDouble; rData->Enum = eEnum; rData->String = rStr; + rData->Byte2 = nByte2; + rData->Short2 = nShort2; rData->Interface = xTest; rData->Any = rAny; } @@ -248,13 +255,14 @@ static void assign( TestDataElements* rData, Int64 nHyper, UInt64 nUHyper, float fFloat, double fDouble, TestEnum eEnum, String* rStr, + Byte nByte2, Int16 nShort2, Object* xTest, Any rAny, TestElement* rSequence[]) { assign( static_cast<TestElement*>(rData), bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble, - eEnum, rStr, xTest, rAny ); + eEnum, rStr, nByte2, nShort2, xTest, rAny ); rData->Sequence = rSequence; } @@ -291,6 +299,8 @@ static bool performAnyTest(XBridgeTest* xLBT, TestDataElements* data) bReturn = testAny( 0, __box(data->Double),xLBT ) && bReturn; bReturn = testAny( 0, __box(data->Enum), xLBT ) && bReturn; bReturn = testAny( 0, data->String,xLBT ) && bReturn; + bReturn = testAny( 0, data->Byte2,xLBT ) && bReturn; + bReturn = testAny( 0, data->Short2,xLBT ) && bReturn; bReturn = testAny(__typeof(XWeak), data->Interface,xLBT ) && bReturn; bReturn = testAny(0, data, xLBT ) && bReturn; @@ -382,6 +392,7 @@ static bool performTest(XBridgeTest* xLBT) aData->UShort, aData->Long, aData->ULong, aData->Hyper, aData->UHyper, aData->Float, aData->Double, aData->Enum, aData->String, + aData->Byte2, aData->Short2, aData->Interface, aData->Any); //(TestElement) aData; aData->Sequence[1] = new TestElement(); //is empty @@ -399,6 +410,8 @@ static bool performTest(XBridgeTest* xLBT) aData->Long, aData->ULong, aData->Hyper, aData->UHyper, aData->Float, aData->Double, aData->Enum, aData->String, + aData->Byte2, + aData->Short2, xI, aAnySet); @@ -408,6 +421,7 @@ static bool performTest(XBridgeTest* xLBT) aSetData->UShort, aSetData->Long, aSetData->ULong, aSetData->Hyper, aSetData->UHyper, aSetData->Float, aSetData->Double, aSetData->Enum, aSetData->String, + aSetData->Byte2, aSetData->Short2, aSetData->Interface, aSetData->Any); //TestElement) aSetData; aSetData->Sequence[1] = new TestElement(); // empty struct @@ -425,6 +439,8 @@ static bool performTest(XBridgeTest* xLBT) aSetData->Double, aSetData->Enum, aSetData->String, + aSetData->Byte2, + aSetData->Short2, aSetData->Interface, aSetData->Any, aSetData->Sequence, @@ -447,6 +463,8 @@ static bool performTest(XBridgeTest* xLBT) & aRet->Double, & aRet->Enum, & aRet->String, + & aRet->Byte2, + & aRet->Short2, & aRet->Interface, & aRet->Any, & aRet->Sequence, @@ -469,6 +487,8 @@ static bool performTest(XBridgeTest* xLBT) & aRet->Double, & aRet->Enum, & aRet->String, + & aRet->Byte2, + & aRet->Short2, & aRet->Interface, & aRet->Any, & aRet->Sequence, @@ -501,6 +521,8 @@ static bool performTest(XBridgeTest* xLBT) & aRet->Double, & aRet->Enum, & aRet->String, + & aRet->Byte2, + & aRet->Short2, & aRet->Interface, & aRet->Any, & aRet->Sequence, @@ -522,6 +544,8 @@ static bool performTest(XBridgeTest* xLBT) xLBT->Double = aRet->Double; xLBT->Enum = aRet->Enum; xLBT->String = aRet->String; + xLBT->Byte2 = aRet->Byte2; + xLBT->Short2 = aRet->Short2; xLBT->Interface = aRet->Interface; xLBT->Any = aRet->Any; xLBT->Sequence = aRet->Sequence; @@ -543,6 +567,8 @@ static bool performTest(XBridgeTest* xLBT) aRet->ULong = xLBT->ULong; aRet->Enum = xLBT->Enum; aRet->String = xLBT->String; + aRet->Byte2 = xLBT->Byte2; + aRet->Short2 = xLBT->Short2; aRet->Interface = xLBT->Interface; aRet->Any = xLBT->Any; aRet->Sequence = xLBT->Sequence; @@ -629,15 +655,15 @@ static bool performSequenceTest(XBridgeTest* xBT) arStruct[2] = new TestElement(); assign( arStruct[0], true, '@', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, - TestEnum::LOLA, Constants::STRING_TEST_CONSTANT, arObject[0], + TestEnum::LOLA, Constants::STRING_TEST_CONSTANT, 18, 0x5678, arObject[0], Any( __typeof(Object), arObject[0]) ); assign( arStruct[1], true, 'A', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, - TestEnum::TWO, Constants::STRING_TEST_CONSTANT, arObject[1], + TestEnum::TWO, Constants::STRING_TEST_CONSTANT, 18, 0x5678, arObject[1], Any( __typeof(Object), arObject[1]) ); assign( arStruct[2], true, 'B', 17, 0x1234, 0xfedc, 0x12345678, 0xfedcba98, 0x123456789abcdef0, 0xfedcba9876543210, 17.0815f, 3.1415926359, - TestEnum::CHECK, Constants::STRING_TEST_CONSTANT, arObject[2], + TestEnum::CHECK, Constants::STRING_TEST_CONSTANT, 18, 0x5678, arObject[2], Any( __typeof(Object), arObject[2] ) ); { Any seqAnyRet[] = xBT2->setSequenceAny(arAny); |