Skip to content

Commit

Permalink
Resolving various Linux test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding committed Nov 10, 2023
1 parent c46d95f commit 13d2da3
Show file tree
Hide file tree
Showing 145 changed files with 554 additions and 266 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
using System;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("unix")]
public sealed class CSharpCompatibleUnix_CXXMethodDeclarationTest : CXXMethodDeclarationTest
{
protected override Task ConstructorTestImpl()
Expand Down Expand Up @@ -425,19 +427,19 @@ public unsafe partial struct MyStruct
public void** lpVtbl;
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate int _GetType(MyStruct* pThis, int objA, int objB);
public delegate int _GetType(MyStruct* pThis, int obj);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate int _GetType1(MyStruct* pThis);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate int _GetType2(MyStruct* pThis, int obj);
public delegate int _GetType2(MyStruct* pThis, int objA, int objB);
public int GetType(int objA, int objB)
public int GetType(int obj)
{{
fixed (MyStruct* pThis = &this)
{{
return Marshal.GetDelegateForFunctionPointer<_GetType>((IntPtr)(lpVtbl[0]))(pThis, objA, objB);
return Marshal.GetDelegateForFunctionPointer<_GetType>((IntPtr)(lpVtbl[0]))(pThis, obj);
}}
}}
Expand All @@ -449,11 +451,11 @@ public new int GetType()
}}
}}
public int GetType(int obj)
public int GetType(int objA, int objB)
{{
fixed (MyStruct* pThis = &this)
{{
return Marshal.GetDelegateForFunctionPointer<_GetType2>((IntPtr)(lpVtbl[2]))(pThis, obj);
return Marshal.GetDelegateForFunctionPointer<_GetType2>((IntPtr)(lpVtbl[2]))(pThis, objA, objB);
}}
}}
}}
Expand Down Expand Up @@ -489,19 +491,19 @@ public unsafe partial struct MyStruct
public Vtbl* lpVtbl;
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate int _GetType(MyStruct* pThis, int objA, int objB);
public delegate int _GetType(MyStruct* pThis, int obj);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate int _GetType1(MyStruct* pThis);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate int _GetType2(MyStruct* pThis, int obj);
public delegate int _GetType2(MyStruct* pThis, int objA, int objB);
public int GetType(int objA, int objB)
public int GetType(int obj)
{{
fixed (MyStruct* pThis = &this)
{{
return Marshal.GetDelegateForFunctionPointer<_GetType>(lpVtbl->GetType)(pThis, objA, objB);
return Marshal.GetDelegateForFunctionPointer<_GetType>(lpVtbl->GetType)(pThis, obj);
}}
}}
Expand All @@ -513,23 +515,23 @@ public new int GetType()
}}
}}
public int GetType(int obj)
public int GetType(int objA, int objB)
{{
fixed (MyStruct* pThis = &this)
{{
return Marshal.GetDelegateForFunctionPointer<_GetType2>(lpVtbl->GetType2)(pThis, obj);
return Marshal.GetDelegateForFunctionPointer<_GetType2>(lpVtbl->GetType2)(pThis, objA, objB);
}}
}}
public partial struct Vtbl
{{
[NativeTypeName(""int (int, int){nativeCallConv}"")]
[NativeTypeName(""int (int){nativeCallConv}"")]
public new IntPtr GetType;
[NativeTypeName(""int (){nativeCallConv}"")]
public IntPtr GetType1;
[NativeTypeName(""int (int){nativeCallConv}"")]
[NativeTypeName(""int (int, int){nativeCallConv}"")]
public IntPtr GetType2;
}}
}}
Expand Down Expand Up @@ -565,19 +567,19 @@ public unsafe partial struct MyStruct : MyStruct.Interface
public Vtbl* lpVtbl;
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate int _GetType(MyStruct* pThis, int objA, int objB);
public delegate int _GetType(MyStruct* pThis, int obj);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate int _GetType1(MyStruct* pThis);
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
public delegate int _GetType2(MyStruct* pThis, int obj);
public delegate int _GetType2(MyStruct* pThis, int objA, int objB);
public int GetType(int objA, int objB)
public int GetType(int obj)
{{
fixed (MyStruct* pThis = &this)
{{
return Marshal.GetDelegateForFunctionPointer<_GetType>(lpVtbl->GetType)(pThis, objA, objB);
return Marshal.GetDelegateForFunctionPointer<_GetType>(lpVtbl->GetType)(pThis, obj);
}}
}}
Expand All @@ -589,32 +591,32 @@ public new int GetType()
}}
}}
public int GetType(int obj)
public int GetType(int objA, int objB)
{{
fixed (MyStruct* pThis = &this)
{{
return Marshal.GetDelegateForFunctionPointer<_GetType2>(lpVtbl->GetType2)(pThis, obj);
return Marshal.GetDelegateForFunctionPointer<_GetType2>(lpVtbl->GetType2)(pThis, objA, objB);
}}
}}
public interface Interface
{{
int GetType(int objA, int objB);
int GetType(int obj);
int GetType();
int GetType(int obj);
int GetType(int objA, int objB);
}}
public partial struct Vtbl
{{
[NativeTypeName(""int (int, int){nativeCallConv}"")]
[NativeTypeName(""int (int){nativeCallConv}"")]
public new IntPtr GetType;
[NativeTypeName(""int (){nativeCallConv}"")]
public IntPtr GetType1;
[NativeTypeName(""int (int){nativeCallConv}"")]
[NativeTypeName(""int (int, int){nativeCallConv}"")]
public IntPtr GetType2;
}}
}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,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.

using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("unix")]
public sealed class CSharpCompatibleUnix_DeprecatedToObsoleteTest : DeprecatedToObsoleteTest
{
protected override Task SimpleStructMembersImpl(string nativeType, string expectedManagedType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("unix")]
public sealed class CSharpCompatibleUnix_EnumDeclarationTest : EnumDeclarationTest
{
protected override Task BasicTestImpl()
Expand Down Expand Up @@ -572,7 +574,7 @@ public enum MyEnum2
public static partial class Methods
{
public const int MyEnum1_Value1 = 1;
public const uint MyEnum1_Value1 = 1;
}
}
";
Expand All @@ -595,7 +597,7 @@ protected override Task WithReferenceToAnonymousEnumEnumeratorTestImpl()
{
public static partial class Methods
{
public const int MyEnum1_Value1 = 1;
public const uint MyEnum1_Value1 = 1;
[NativeTypeName(""const int"")]
public const int MyEnum2_Value1 = (int)(MyEnum1_Value1) + 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,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.

using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("unix")]
public sealed class CSharpCompatibleUnix_FunctionDeclarationBodyImportTest : FunctionDeclarationBodyImportTest
{
protected override Task ArraySubscriptTestImpl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("unix")]
public sealed class CSharpCompatibleUnix_FunctionDeclarationDllImportTest : FunctionDeclarationDllImportTest
{
protected override Task BasicTestImpl()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,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.

using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("unix")]
public sealed class CSharpCompatibleUnix_FunctionPointerDeclarationTest : FunctionPointerDeclarationTest
{
protected override Task BasicTestImpl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

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

protected override Task WithPackingTestImpl()
{
const string InputContents = @"struct MyStruct
const string InputContents = @"typedef int size_t;
struct MyStruct
{
size_t FixedBuffer[1];
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// 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.

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("unix")]
public sealed class CSharpCompatibleUnix_UnionDeclarationTest : UnionDeclarationTest
{
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("unix")]
public sealed class CSharpCompatibleUnix_VarDeclarationTest : VarDeclarationTest
{
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
using System;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("win")]
public sealed class CSharpCompatibleWindows_CXXMethodDeclarationTest : CXXMethodDeclarationTest
{
protected override Task ConstructorTestImpl()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,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.

using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("win")]
public sealed class CSharpCompatibleWindows_DeprecatedToObsoleteTest : DeprecatedToObsoleteTest
{
protected override Task SimpleStructMembersImpl(string nativeType, string expectedManagedType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("win")]
public sealed class CSharpCompatibleWindows_EnumDeclarationTest : EnumDeclarationTest
{
protected override Task BasicTestImpl()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,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.

using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("win")]
public sealed class CSharpCompatibleWindows_FunctionDeclarationBodyImportTest : FunctionDeclarationBodyImportTest
{
protected override Task ArraySubscriptTestImpl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("win")]
public sealed class CSharpCompatibleWindows_FunctionDeclarationDllImportTest : FunctionDeclarationDllImportTest
{
protected override Task BasicTestImpl()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,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.

using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("win")]
public sealed class CSharpCompatibleWindows_FunctionPointerDeclarationTest : FunctionPointerDeclarationTest
{
protected override Task BasicTestImpl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("win")]
public sealed class CSharpCompatibleWindows_StructDeclarationTest : StructDeclarationTest
{
protected override Task IncompleteArraySizeTestImpl(string nativeType, string expectedManagedType)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// 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.

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ClangSharp.UnitTests;

[Platform("win")]
public sealed class CSharpCompatibleWindows_UnionDeclarationTest : UnionDeclarationTest
{
protected override Task BasicTestImpl(string nativeType, string expectedManagedType)
Expand Down
Loading

0 comments on commit 13d2da3

Please sign in to comment.