Skip to content

Commit 5f5e631

Browse files
author
Sergey Andreenko
committed
add a pinvoke test with many small stack arguments.
It will fail on arm64 apple.
1 parent d888195 commit 5f5e631

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/tests/Interop/PInvoke/Primitives/Int/PInvokeIntNative.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,26 @@ extern "C" DLL_EXPORT int STDMETHODCALLTYPE Marshal_In(/*[in]*/int intValue)
3030
return intReturn;
3131
}
3232

33+
extern "C" DLL_EXPORT int STDMETHODCALLTYPE Marshal_InMany(/*[in]*/short i1, short i2, short i3, short i4, short i5, short i6, short i7, short i8, short i9, short i10, short i11, unsigned char i12, unsigned char i13, int i14, short i15)
34+
{
35+
//Check the input
36+
if(i1 != 1 || i2 != 2 || i3 != 3 || i4 != 4 || i5 != 5 || i6 != 6 || i7 != 7 || i8 != 8 || i9 != 9 || i10 != 10 || i11 != 11 || i12 != 12 || i13 != 13 || i14 != 14 || i15 != 15)
37+
{
38+
printf("Error in Function Marshal_InMany(Native Client)\n");
39+
40+
//Expected
41+
printf("Expected: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15\n");
42+
43+
//Actual
44+
printf("Actual: %hi, %hi, %hi, %hi, %hi, %hi, %hi, %hi, %hi, %hi, %hi, %i, %i, %i, %hi\n", i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, (int)i12, (int)i13, i14, i15);
45+
46+
//Return the error value instead if verification failed
47+
return intErrReturn;
48+
}
49+
50+
return i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9 + i10 + i11 + i12 + i13 + i14 + i15;
51+
}
52+
3353
extern "C" DLL_EXPORT int STDMETHODCALLTYPE Marshal_InOut(/*[In,Out]*/int intValue)
3454
{
3555
//Check the input

src/tests/Interop/PInvoke/Primitives/Int/PInvokeIntTest.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class ClientPInvokeIntNativeTest
2424
[DllImport("PInvokeIntNative")]
2525
private static extern int MarshalPointer_Out(out int pintValue);
2626

27+
[DllImport("PInvokeIntNative")]
28+
private static extern int Marshal_InMany([In]short i1, [In]short i2, [In]short i3, [In]short i4, [In]short i5, [In]short i6, [In]short i7, [In]short i8, [In]short i9, [In]short i10, [In]short i11, [In]byte i12, [In]byte i13, [In]int i14, [In]short i15);
29+
2730

2831
public static int Main(string[] args)
2932
{
@@ -99,6 +102,12 @@ public static int Main(string[] args)
99102
Console.WriteLine("Out byref value is wrong.");
100103
}
101104

105+
if(120 != Marshal_InMany(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15))
106+
{
107+
failures++;
108+
Console.WriteLine("InMany return value is wrong");
109+
}
110+
102111
return 100 + failures;
103112
}
104113
}

0 commit comments

Comments
 (0)