Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,20 @@ public static class CoreClrConfigurationDetection
public static bool IsTieredCompilation => string.Equals(GetEnvironmentVariableValue("TieredCompilation", "1"), "1", StringComparison.InvariantCulture);
public static bool IsHeapVerify => string.Equals(GetEnvironmentVariableValue("HeapVerify"), "1", StringComparison.InvariantCulture);

public static bool IsCoreClrInterpreter
{
get
{
if (!string.IsNullOrWhiteSpace(GetEnvironmentVariableValue("Interpreter", "")))
return true;
if (int.TryParse(GetEnvironmentVariableValue("InterpMode", "0"), out int mode) && (mode > 0))
return true;
return false;
}
}

public static bool IsGCStress => !string.Equals(GetEnvironmentVariableValue("GCStress"), "0", StringComparison.InvariantCulture);

public static bool IsAnyJitStress => IsJitStress || IsJitStressRegs || IsJitMinOpts || IsTailCallStress;

public static bool IsAnyJitOptimizationStress => IsAnyJitStress || IsTieredCompilation;
Expand Down Expand Up @@ -58,4 +70,4 @@ private static bool CompareGCStressModeAsLower(string value, string first, strin
string.Equals(value, "0xf", StringComparison.InvariantCulture) ||
string.Equals(value, "f", StringComparison.InvariantCulture);
}
}
}
12 changes: 12 additions & 0 deletions src/tests/Common/CoreCLRTestLibrary/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ public static bool IsWindowsIoTCore
public static bool IsNativeAot => IsNotMonoRuntime && !IsReflectionEmitSupported;
public static bool IsNotNativeAot => !IsNativeAot;

public static bool IsCoreClrInterpreter
{
get
{
if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("DOTNET_Interpreter")))
return true;
if (int.TryParse(Environment.GetEnvironmentVariable("DOTNET_InterpMode") ?? "", out int mode) && (mode > 0))
return true;
return false;
}
}

public static bool HasAssemblyFiles => !string.IsNullOrEmpty(typeof(Utilities).Assembly.Location);
public static bool IsSingleFile => !HasAssemblyFiles;

Expand Down
2 changes: 2 additions & 0 deletions src/tests/Common/XUnitWrapperGenerator/RuntimeTestModes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ public enum RuntimeTestModes
AnyJitOptimizationStress = AnyJitStress | TieredCompilation, // Disable when any JIT non-full optimization stress mode is exercised.

HeapVerify = 1 << 9, // DOTNET_HeapVerify (or COMPlus_HeapVerify) is set.

InterpreterActive = 1 << 10, // DOTNET_Interpreter != "" or DOTNET_InterpMode != 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,10 @@ private static ImmutableArray<ITestInfo> DecorateWithSkipOnCoreClrConfiguration(
{
conditions.Add($"!{ConditionClass}.IsHeapVerify");
}
if (skippedTestModes.HasFlag(Xunit.RuntimeTestModes.InterpreterActive))
{
conditions.Add($"!{ConditionClass}.IsCoreClrInterpreter");
}

if (skippedTestModes.HasFlag(Xunit.RuntimeTestModes.AnyGCStress))
{
Expand Down
1 change: 1 addition & 0 deletions src/tests/Interop/COM/ComWrappers/API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ protected override void ReleaseObjects(IEnumerable objects)

[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // COM apartments are Windows-specific
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public unsafe void CrossApartmentQueryInterface_NoDeadlock()
{
Console.WriteLine($"Running {nameof(CrossApartmentQueryInterface_NoDeadlock)}...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ private static void ValidateNotRegisteredForTrackerSupport()
}

[Fact]
[Xunit.SkipOnCoreClrAttribute("Depends on windows-only COM->CLR transitions flowing hidden parameter", RuntimeTestModes.InterpreterActive)]
public static int TestEntryPoint()
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ private static void ValidateNotRegisteredForMarshalling()
}

[Fact]
[Xunit.SkipOnCoreClrAttribute("Depends on windows-only COM->CLR transitions flowing hidden parameter", RuntimeTestModes.InterpreterActive)]
public static int TestEntryPoint()
{
try
Expand Down
1 change: 1 addition & 0 deletions src/tests/Interop/COM/Dynamic/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Dynamic
public class Program
{
[Fact]
[Xunit.SkipOnCoreClrAttribute("Depends on COM behavior that is not correct in interpreter", RuntimeTestModes.InterpreterActive)]
public static int TestEntryPoint()
{
// RegFree COM is not supported on Windows Nano
Expand Down
3 changes: 2 additions & 1 deletion src/tests/Interop/COM/ExtensionPoints/ExtensionPoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public virtual void PostHeapMinimize() { }
}

[Fact]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static unsafe void Validate_Managed_IMallocSpy()
{
Console.WriteLine($"Running {nameof(Validate_Managed_IMallocSpy)}...");
Expand Down Expand Up @@ -79,4 +80,4 @@ static int ArrayLen(char** ptr)
return (int)(ptr - begin);
}
}
}
}
2 changes: 1 addition & 1 deletion src/tests/Interop/COM/NETClients/IDispatch/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ static void Validate_ValueCoerce_ReturnToManaged()
public static int TestEntryPoint()
{
// RegFree COM is not supported on Windows Nano
if (Utilities.IsWindowsNanoServer)
if (Utilities.IsWindowsNanoServer || Utilities.IsCoreClrInterpreter)
{
return 100;
}
Expand Down
11 changes: 9 additions & 2 deletions src/tests/Interop/ExecInDefAppDom/ExecInDefAppDom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,17 @@ public static int TestEntryPoint()
result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "WrongReturnType", "None", COR_E_MISSINGMETHOD, 0);
result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "Return0", "None", S_OK, 0);
result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "Return1", "None", S_OK, 1);
result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "ThrowAnything", "None", COR_E_EXCEPTION, 0);
// This requires EH interop which is not currently supported by the interpreter. See https://github.com/dotnet/runtime/issues/118965
if (!TestLibrary.Utilities.IsCoreClrInterpreter)
{
result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "ThrowAnything", "None", COR_E_EXCEPTION, 0);
}
result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "ParseArgument", "0", S_OK, 0);
result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "ParseArgument", "200", S_OK, 200);
result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "ParseArgument", "None", COR_E_FORMAT, 0);
if (!TestLibrary.Utilities.IsCoreClrInterpreter)
{
result += TestExecuteInAppDomain(myPath, "FakeInjectedCode", "ParseArgument", "None", COR_E_FORMAT, 0);
}
result += TestExecuteInAppDomain(injectedPath, "InjectedCode", "ParseArgument", "300", S_OK, 300);

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static int UnmanagedExportedFunction(float arg)
{
return Convert.ToInt32(arg);
}

[UnmanagedCallersOnly]
static BlittableGeneric<int> UnmanagedExportedFunctionBlittableGenericInt(float arg)
{
Expand Down Expand Up @@ -68,6 +68,7 @@ struct BlittableGeneric<T>
[InlineData(-1f)]
[InlineData(42f)]
[InlineData(60f)]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static void RunGenericFunctionPointerTest(float inVal)
{
Console.WriteLine($"Running {nameof(RunGenericFunctionPointerTest)}...");
Expand All @@ -80,7 +81,7 @@ public static void RunGenericFunctionPointerTest(float inVal)
outVar = GenericCaller<int>.GenericCalli((delegate* unmanaged<float, int>)&UnmanagedExportedFunction, inVal);
}
Assert.Equal(expectedValue, outVar);

outVar = 0;
Console.WriteLine("Testing GenericCalli with BlittableGeneric<int> as the return type");
unsafe
Expand Down Expand Up @@ -113,6 +114,7 @@ public static void RunGenericFunctionPointerTest(float inVal)
}

[ConditionalFact(nameof(CanRunInvalidGenericFunctionPointerTest))]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static void RunInvalidGenericFunctionPointerTest()
{
Console.WriteLine($"Running {nameof(RunInvalidGenericFunctionPointerTest)}...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static void DoCallTryFinally()
public static void ManualRaiseException()
{
#if WINDOWS
if (!TestLibrary.Utilities.IsMonoRuntime)
if (!TestLibrary.Utilities.IsMonoRuntime && !TestLibrary.Utilities.IsCoreClrInterpreter)
{
try
{
Expand Down
1 change: 1 addition & 0 deletions src/tests/Interop/PInvoke/IEnumerator/IEnumeratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public static void TestManagedRoundTrip()
}

[Fact]
[Xunit.SkipOnCoreClrAttribute("Depends on COM behavior that is not correct in interpreter", RuntimeTestModes.InterpreterActive)]
public static void TestSupportForICustomAdapter()
{
{
Expand Down
5 changes: 5 additions & 0 deletions src/tests/Interop/PInvoke/Int128/Int128Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ public struct StructJustInt128
{
public StructJustInt128(Int128 val) { value = val; }
public Int128 value;

public override string ToString() => $"StructJustInt128(value={value:X32})";
}

public struct StructWithInt128
{
public StructWithInt128(Int128 val) { value = val; messUpPadding = 0x10; }
public byte messUpPadding;
public Int128 value;

public override string ToString() => $"StructWithInt128(messUpPadding={messUpPadding}, value={value:X32})";
}

unsafe partial class Int128Native
Expand Down Expand Up @@ -111,6 +115,7 @@ public static void TestInt128FieldLayout()
StructWithInt128 rhs = new StructWithInt128(new Int128(13, 14));

Int128Native.AddStructWithInt128_ByRef(ref lhs, ref rhs);
// Interpreter-FIXME: Incorrect result. Tracked by https://github.com/dotnet/runtime/issues/118618
Assert.Equal(new StructWithInt128(new Int128(24, 26)), lhs);

Int128 value2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static unsafe int StructWithCtorTest(StructWithCtor* ptrStruct, ref Struc
[SkipOnMono("Not supported on Mono")]
[ActiveIssue("https://github.com/dotnet/runtimelab/issues/155", typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNativeAot))]
[SkipOnCoreClr("JitStress can introduce extra copies", RuntimeTestModes.JitStress)]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static unsafe void ValidateCopyConstructorAndDestructorCalled()
{
CopyCtorUtil.TestDelegate del = (CopyCtorUtil.TestDelegate)Delegate.CreateDelegate(typeof(CopyCtorUtil.TestDelegate), typeof(CopyCtor).GetMethod("StructWithCtorTest"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ public sealed class NestedClassGenericServer<T> : INestedInterfaceVisibleTrue, I
[ConditionalFact(typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNotNativeAot))]
[PlatformSpecific(TestPlatforms.Windows)]
[SkipOnMono("Requires COM support")]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static void RunComVisibleTests()
{
int fooSuccessVal = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ public sealed class NestedClassGenericServer<T> : INestedInterfaceVisibleTrue, I
[ConditionalFact(typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNotNativeAot))]
[PlatformSpecific(TestPlatforms.Windows)]
[SkipOnMono("Requires COM support")]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static void RunComVisibleTests()
{
int fooSuccessVal = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ public sealed class NestedClassGenericServer<T> : INestedInterfaceVisibleTrue, I
/// </summary>
/// <returns></returns>
[Fact]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static void RunComVisibleTests()
{
int fooSuccessVal = 0;
Expand Down Expand Up @@ -1003,6 +1004,7 @@ public static void RunComVisibleTests()
}

[Fact]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static void RunTestsInALC()
{
TestLibrary.Utilities.ExecuteAndUnload(typeof(ComVisibleServer).Assembly.Location, nameof(ComVisibleServer), nameof(RunComVisibleTests));
Expand Down
1 change: 1 addition & 0 deletions src/tests/Interop/PInvoke/Varargs/VarargsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private static bool AssertEqual(string lhs, string rhs)
[SkipOnMono("PInvoke Varargs/ArgIterator marshalling not supported on Mono")]
[ActiveIssue("https://github.com/dotnet/runtimelab/issues/155", typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNativeAot))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91388", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.PlatformDoesNotSupportNativeTestAssets))]
[Xunit.SkipOnCoreClrAttribute("Depends on varargs", RuntimeTestModes.InterpreterActive)]
public static int TestEntryPoint()
{
var passed = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public partial class Test_VariantTest
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
[ActiveIssue("https://github.com/dotnet/runtimelab/issues/155", typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNativeAot))]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static int TestEntryPoint()
{
bool builtInComDisabled=false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public partial class Test_VariantTest
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
[ActiveIssue("https://github.com/dotnet/runtimelab/issues/155", typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNativeAot))]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static int TestEntryPoint()
{
bool testComMarshal=true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ private static int ILStubCache_NoGCTransition_GCTransition(int expected)

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91388", typeof(TestLibrary.PlatformDetection), nameof(TestLibrary.PlatformDetection.PlatformDoesNotSupportNativeTestAssets))]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled pinvoke calli", RuntimeTestModes.InterpreterActive)]
public static void TestEntryPoint()
{
CheckGCMode.Initialize(&SuppressGCTransitionNative.SetIsInCooperativeModeFunction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public static int TestEntryPoint()
TestPInvokeMarkedWithUnmanagedCallersOnly();
TestUnmanagedCallersOnlyWithGeneric();

// Exception handling is only supported on CoreCLR Windows.
if (TestLibrary.Utilities.IsWindows && !TestLibrary.Utilities.IsMonoRuntime)
// Exception handling interop is only supported on CoreCLR Windows.
if (TestLibrary.Utilities.IsWindows && !TestLibrary.Utilities.IsMonoRuntime && !TestLibrary.Utilities.IsCoreClrInterpreter)
{
TestUnmanagedCallersOnlyValid_ThrowException();
TestUnmanagedCallersOnlyViaUnmanagedCalli_ThrowException();
Expand Down
3 changes: 2 additions & 1 deletion src/tests/baseservices/invalid_operations/ManagedPointers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static void Validate_BoxingHelpers_NullByRef()
}

[Fact]
[Xunit.SkipOnCoreClrAttribute("Depends on marshalled calli", RuntimeTestModes.InterpreterActive)]
public static void Validate_GeneratedILStubs_NullByRef()
{
Console.WriteLine($"Running {nameof(Validate_GeneratedILStubs_NullByRef)}...");
Expand Down Expand Up @@ -81,4 +82,4 @@ public static void Validate_IntrinsicMethodsWithByRef_NullByRef()
Assert.Throws<NullReferenceException>(() => Interlocked.CompareExchange(ref Unsafe.NullRef<object>(), new object(), new object()));
Assert.Throws<NullReferenceException>(() => Interlocked.CompareExchange<object>(ref Unsafe.NullRef<object>(), new object(), new object()));
}
}
}
Loading