Skip to content

Commit 13d2da3

Browse files
committed
Resolving various Linux test failures
1 parent c46d95f commit 13d2da3

File tree

145 files changed

+554
-266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+554
-266
lines changed

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/CXXMethodDeclarationTest.cs

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
using System;
44
using System.Runtime.InteropServices;
55
using System.Threading.Tasks;
6+
using NUnit.Framework;
67

78
namespace ClangSharp.UnitTests;
89

10+
[Platform("unix")]
911
public sealed class CSharpCompatibleUnix_CXXMethodDeclarationTest : CXXMethodDeclarationTest
1012
{
1113
protected override Task ConstructorTestImpl()
@@ -425,19 +427,19 @@ public unsafe partial struct MyStruct
425427
public void** lpVtbl;
426428
427429
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
428-
public delegate int _GetType(MyStruct* pThis, int objA, int objB);
430+
public delegate int _GetType(MyStruct* pThis, int obj);
429431
430432
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
431433
public delegate int _GetType1(MyStruct* pThis);
432434
433435
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
434-
public delegate int _GetType2(MyStruct* pThis, int obj);
436+
public delegate int _GetType2(MyStruct* pThis, int objA, int objB);
435437
436-
public int GetType(int objA, int objB)
438+
public int GetType(int obj)
437439
{{
438440
fixed (MyStruct* pThis = &this)
439441
{{
440-
return Marshal.GetDelegateForFunctionPointer<_GetType>((IntPtr)(lpVtbl[0]))(pThis, objA, objB);
442+
return Marshal.GetDelegateForFunctionPointer<_GetType>((IntPtr)(lpVtbl[0]))(pThis, obj);
441443
}}
442444
}}
443445
@@ -449,11 +451,11 @@ public int GetType(int objA, int objB)
449451
}}
450452
}}
451453
452-
public int GetType(int obj)
454+
public int GetType(int objA, int objB)
453455
{{
454456
fixed (MyStruct* pThis = &this)
455457
{{
456-
return Marshal.GetDelegateForFunctionPointer<_GetType2>((IntPtr)(lpVtbl[2]))(pThis, obj);
458+
return Marshal.GetDelegateForFunctionPointer<_GetType2>((IntPtr)(lpVtbl[2]))(pThis, objA, objB);
457459
}}
458460
}}
459461
}}
@@ -489,19 +491,19 @@ public unsafe partial struct MyStruct
489491
public Vtbl* lpVtbl;
490492
491493
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
492-
public delegate int _GetType(MyStruct* pThis, int objA, int objB);
494+
public delegate int _GetType(MyStruct* pThis, int obj);
493495
494496
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
495497
public delegate int _GetType1(MyStruct* pThis);
496498
497499
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
498-
public delegate int _GetType2(MyStruct* pThis, int obj);
500+
public delegate int _GetType2(MyStruct* pThis, int objA, int objB);
499501
500-
public int GetType(int objA, int objB)
502+
public int GetType(int obj)
501503
{{
502504
fixed (MyStruct* pThis = &this)
503505
{{
504-
return Marshal.GetDelegateForFunctionPointer<_GetType>(lpVtbl->GetType)(pThis, objA, objB);
506+
return Marshal.GetDelegateForFunctionPointer<_GetType>(lpVtbl->GetType)(pThis, obj);
505507
}}
506508
}}
507509
@@ -513,23 +515,23 @@ public int GetType(int objA, int objB)
513515
}}
514516
}}
515517
516-
public int GetType(int obj)
518+
public int GetType(int objA, int objB)
517519
{{
518520
fixed (MyStruct* pThis = &this)
519521
{{
520-
return Marshal.GetDelegateForFunctionPointer<_GetType2>(lpVtbl->GetType2)(pThis, obj);
522+
return Marshal.GetDelegateForFunctionPointer<_GetType2>(lpVtbl->GetType2)(pThis, objA, objB);
521523
}}
522524
}}
523525
524526
public partial struct Vtbl
525527
{{
526-
[NativeTypeName(""int (int, int){nativeCallConv}"")]
528+
[NativeTypeName(""int (int){nativeCallConv}"")]
527529
public new IntPtr GetType;
528530
529531
[NativeTypeName(""int (){nativeCallConv}"")]
530532
public IntPtr GetType1;
531533
532-
[NativeTypeName(""int (int){nativeCallConv}"")]
534+
[NativeTypeName(""int (int, int){nativeCallConv}"")]
533535
public IntPtr GetType2;
534536
}}
535537
}}
@@ -565,19 +567,19 @@ public unsafe partial struct MyStruct : MyStruct.Interface
565567
public Vtbl* lpVtbl;
566568
567569
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
568-
public delegate int _GetType(MyStruct* pThis, int objA, int objB);
570+
public delegate int _GetType(MyStruct* pThis, int obj);
569571
570572
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
571573
public delegate int _GetType1(MyStruct* pThis);
572574
573575
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
574-
public delegate int _GetType2(MyStruct* pThis, int obj);
576+
public delegate int _GetType2(MyStruct* pThis, int objA, int objB);
575577
576-
public int GetType(int objA, int objB)
578+
public int GetType(int obj)
577579
{{
578580
fixed (MyStruct* pThis = &this)
579581
{{
580-
return Marshal.GetDelegateForFunctionPointer<_GetType>(lpVtbl->GetType)(pThis, objA, objB);
582+
return Marshal.GetDelegateForFunctionPointer<_GetType>(lpVtbl->GetType)(pThis, obj);
581583
}}
582584
}}
583585
@@ -589,32 +591,32 @@ public int GetType(int objA, int objB)
589591
}}
590592
}}
591593
592-
public int GetType(int obj)
594+
public int GetType(int objA, int objB)
593595
{{
594596
fixed (MyStruct* pThis = &this)
595597
{{
596-
return Marshal.GetDelegateForFunctionPointer<_GetType2>(lpVtbl->GetType2)(pThis, obj);
598+
return Marshal.GetDelegateForFunctionPointer<_GetType2>(lpVtbl->GetType2)(pThis, objA, objB);
597599
}}
598600
}}
599601
600602
public interface Interface
601603
{{
602-
int GetType(int objA, int objB);
604+
int GetType(int obj);
603605
604606
int GetType();
605607
606-
int GetType(int obj);
608+
int GetType(int objA, int objB);
607609
}}
608610
609611
public partial struct Vtbl
610612
{{
611-
[NativeTypeName(""int (int, int){nativeCallConv}"")]
613+
[NativeTypeName(""int (int){nativeCallConv}"")]
612614
public new IntPtr GetType;
613615
614616
[NativeTypeName(""int (){nativeCallConv}"")]
615617
public IntPtr GetType1;
616618
617-
[NativeTypeName(""int (int){nativeCallConv}"")]
619+
[NativeTypeName(""int (int, int){nativeCallConv}"")]
618620
public IntPtr GetType2;
619621
}}
620622
}}

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/DeprecatedToObsoleteTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
22

33
using System.Threading.Tasks;
4+
using NUnit.Framework;
45

56
namespace ClangSharp.UnitTests;
67

8+
[Platform("unix")]
79
public sealed class CSharpCompatibleUnix_DeprecatedToObsoleteTest : DeprecatedToObsoleteTest
810
{
911
protected override Task SimpleStructMembersImpl(string nativeType, string expectedManagedType)

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/EnumDeclarationTest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
using System.Collections.Generic;
44
using System.Threading.Tasks;
5+
using NUnit.Framework;
56

67
namespace ClangSharp.UnitTests;
78

9+
[Platform("unix")]
810
public sealed class CSharpCompatibleUnix_EnumDeclarationTest : EnumDeclarationTest
911
{
1012
protected override Task BasicTestImpl()
@@ -572,7 +574,7 @@ public enum MyEnum2
572574
573575
public static partial class Methods
574576
{
575-
public const int MyEnum1_Value1 = 1;
577+
public const uint MyEnum1_Value1 = 1;
576578
}
577579
}
578580
";
@@ -595,7 +597,7 @@ protected override Task WithReferenceToAnonymousEnumEnumeratorTestImpl()
595597
{
596598
public static partial class Methods
597599
{
598-
public const int MyEnum1_Value1 = 1;
600+
public const uint MyEnum1_Value1 = 1;
599601
600602
[NativeTypeName(""const int"")]
601603
public const int MyEnum2_Value1 = (int)(MyEnum1_Value1) + 1;

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/FunctionDeclarationBodyImportTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
22

33
using System.Threading.Tasks;
4+
using NUnit.Framework;
45

56
namespace ClangSharp.UnitTests;
67

8+
[Platform("unix")]
79
public sealed class CSharpCompatibleUnix_FunctionDeclarationBodyImportTest : FunctionDeclarationBodyImportTest
810
{
911
protected override Task ArraySubscriptTestImpl()

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/FunctionDeclarationDllImportTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
using System.Collections.Generic;
44
using System.Runtime.InteropServices;
55
using System.Threading.Tasks;
6+
using NUnit.Framework;
67

78
namespace ClangSharp.UnitTests;
89

10+
[Platform("unix")]
911
public sealed class CSharpCompatibleUnix_FunctionDeclarationDllImportTest : FunctionDeclarationDllImportTest
1012
{
1113
protected override Task BasicTestImpl()

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/FunctionPointerDeclarationTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
22

33
using System.Threading.Tasks;
4+
using NUnit.Framework;
45

56
namespace ClangSharp.UnitTests;
67

8+
[Platform("unix")]
79
public sealed class CSharpCompatibleUnix_FunctionPointerDeclarationTest : FunctionPointerDeclarationTest
810
{
911
protected override Task BasicTestImpl()

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/StructDeclarationTest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
using System.Collections.Generic;
55
using System.Runtime.InteropServices;
66
using System.Threading.Tasks;
7+
using NUnit.Framework;
78

89
namespace ClangSharp.UnitTests;
910

11+
[Platform("unix")]
1012
public sealed class CSharpCompatibleUnix_StructDeclarationTest : StructDeclarationTest
1113
{
1214
protected override Task IncompleteArraySizeTestImpl(string nativeType, string expectedManagedType)
@@ -1942,7 +1944,9 @@ public partial struct MyStruct3
19421944

19431945
protected override Task WithPackingTestImpl()
19441946
{
1945-
const string InputContents = @"struct MyStruct
1947+
const string InputContents = @"typedef int size_t;
1948+
1949+
struct MyStruct
19461950
{
19471951
size_t FixedBuffer[1];
19481952
};

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/UnionDeclarationTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
22

3-
using System;
43
using System.Collections.Generic;
54
using System.Runtime.InteropServices;
65
using System.Threading.Tasks;
6+
using NUnit.Framework;
77

88
namespace ClangSharp.UnitTests;
99

10+
[Platform("unix")]
1011
public sealed class CSharpCompatibleUnix_UnionDeclarationTest : UnionDeclarationTest
1112
{
1213
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/VarDeclarationTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
using System.Collections.Generic;
44
using System.Threading.Tasks;
5+
using NUnit.Framework;
56

67
namespace ClangSharp.UnitTests;
78

9+
[Platform("unix")]
810
public sealed class CSharpCompatibleUnix_VarDeclarationTest : VarDeclarationTest
911
{
1012
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)

tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/CXXMethodDeclarationTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
using System;
44
using System.Runtime.InteropServices;
55
using System.Threading.Tasks;
6+
using NUnit.Framework;
67

78
namespace ClangSharp.UnitTests;
89

10+
[Platform("win")]
911
public sealed class CSharpCompatibleWindows_CXXMethodDeclarationTest : CXXMethodDeclarationTest
1012
{
1113
protected override Task ConstructorTestImpl()

0 commit comments

Comments
 (0)