From 5d720fe6364914f435f534cab907bdf1ee2e8119 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 13 Oct 2025 16:48:19 +0200 Subject: [PATCH] [wasm][coreclr] Enable working parts of the interpreter test And annotate rest with the active issue comments --- src/tests/JIT/interpreter/Interpreter.cs | 123 ++++++++++++++--------- 1 file changed, 76 insertions(+), 47 deletions(-) diff --git a/src/tests/JIT/interpreter/Interpreter.cs b/src/tests/JIT/interpreter/Interpreter.cs index b8783d9c7f266f..4e397f067db0b1 100644 --- a/src/tests/JIT/interpreter/Interpreter.cs +++ b/src/tests/JIT/interpreter/Interpreter.cs @@ -723,13 +723,6 @@ static void EnsureCallingConventionTestTargetMethodsAreJitted() static int Main(string[] args) { - // WASM-TODO this is just hello world for now - if (RuntimeInformation.ProcessArchitecture == Architecture.Wasm) - { - Console.WriteLine("WASM-TODO: Interpreter tests"); - return 100; - } - jitField1 = 42; jitField2 = 43; @@ -950,9 +943,13 @@ public static void RunInterpreterTests() if (!TestCalli()) Environment.FailFast(null); - Console.WriteLine("TestStaticVirtualGeneric_CodePointerCase"); - if (!TestStaticVirtualGeneric_CodePointerCase()) - Environment.FailFast(null); + // active issue https://github.com/dotnet/runtime/issues/120319 + if (RuntimeInformation.ProcessArchitecture != Architecture.Wasm) + { + Console.WriteLine("TestStaticVirtualGeneric_CodePointerCase"); + if (!TestStaticVirtualGeneric_CodePointerCase()) + Environment.FailFast(null); + } Console.WriteLine("TestPreciseInitCctors"); if (!TestPreciseInitCctors()) @@ -972,7 +969,11 @@ public static void RunInterpreterTests() Console.WriteLine("Empty string length: {0}", string.Empty.Length); - Console.WriteLine("BitConverter.IsLittleEndian: {0}", BitConverter.IsLittleEndian); + // active issue https://github.com/dotnet/runtime/issues/120319 + if (RuntimeInformation.ProcessArchitecture != Architecture.Wasm) + { + Console.WriteLine("BitConverter.IsLittleEndian: {0}", BitConverter.IsLittleEndian); + } Console.WriteLine("IntPtr.Zero: {0}, UIntPtr.Zero: {1}", IntPtr.Zero, UIntPtr.Zero); @@ -1963,10 +1964,14 @@ public static bool TestVirtual() retType = bc.GenericVirtualMethod(out isBase); if (retType != typeof(int) || isBase) return false; - Console.WriteLine("bc.GenericVirtualMethod"); - retType = bc.GenericVirtualMethod(out isBase); - if (retType != typeof(string) || isBase) - return false; + // active issue https://github.com/dotnet/runtime/issues/120319 + if (RuntimeInformation.ProcessArchitecture != Architecture.Wasm) + { + Console.WriteLine("bc.GenericVirtualMethod"); + retType = bc.GenericVirtualMethod(out isBase); + if (retType != typeof(string) || isBase) + return false; + } Console.WriteLine("itest.VirtualMethod"); if (itest.VirtualMethod() != 0xdede) return false; @@ -1974,10 +1979,14 @@ public static bool TestVirtual() retType = itest.GenericVirtualMethod(out isBase); if (retType != typeof(int) || isBase) return false; - Console.WriteLine("itest.GenericVirtualMethod"); - retType = itest.GenericVirtualMethod(out isBase); - if (retType != typeof(string) || isBase) - return false; + // active issue https://github.com/dotnet/runtime/issues/120319 + if (RuntimeInformation.ProcessArchitecture != Architecture.Wasm) + { + Console.WriteLine("itest.GenericVirtualMethod"); + retType = itest.GenericVirtualMethod(out isBase); + if (retType != typeof(string) || isBase) + return false; + } bc = new BaseClass(); itest = bc; @@ -1991,10 +2000,14 @@ public static bool TestVirtual() retType = bc.GenericVirtualMethod(out isBase); if (retType != typeof(int) || !isBase) return false; - Console.WriteLine("bc.GenericVirtualMethod"); - retType = bc.GenericVirtualMethod(out isBase); - if (retType != typeof(string) || !isBase) - return false; + // active issue https://github.com/dotnet/runtime/issues/120319 + if (RuntimeInformation.ProcessArchitecture != Architecture.Wasm) + { + Console.WriteLine("bc.GenericVirtualMethod"); + retType = bc.GenericVirtualMethod(out isBase); + if (retType != typeof(string) || !isBase) + return false; + } Console.WriteLine("itest.VirtualMethod"); if (itest.VirtualMethod() != 0xbebe) return false; @@ -2002,10 +2015,14 @@ public static bool TestVirtual() retType = itest.GenericVirtualMethod(out isBase); if (retType != typeof(int) || !isBase) return false; - Console.WriteLine("itest.GenericVirtualMethod"); - retType = itest.GenericVirtualMethod(out isBase); - if (retType != typeof(string) || !isBase) - return false; + // active issue https://github.com/dotnet/runtime/issues/120319 + if (RuntimeInformation.ProcessArchitecture != Architecture.Wasm) + { + Console.WriteLine("itest.GenericVirtualMethod"); + retType = itest.GenericVirtualMethod(out isBase); + if (retType != typeof(string) || !isBase) + return false; + } return true; } @@ -2500,12 +2517,16 @@ public static bool TestArray() if (!ArrayUInt32(32, uint.MinValue)) return false; if (!ArrayUInt32(32, uint.MaxValue)) return false; - // // long - if (!ArrayInt64(0, 0)) return false; - if (!ArrayInt64(1, 1)) return false; - if (!ArrayInt64(32, 32)) return false; - if (!ArrayInt64(32, Int64.MinValue)) return false; - if (!ArrayInt64(32, Int64.MaxValue)) return false; + // active issue https://github.com/dotnet/runtime/issues/120659 + if (RuntimeInformation.ProcessArchitecture != Architecture.Wasm) + { + // // long + if (!ArrayInt64(0, 0)) return false; + if (!ArrayInt64(1, 1)) return false; + if (!ArrayInt64(32, 32)) return false; + if (!ArrayInt64(32, Int64.MinValue)) return false; + if (!ArrayInt64(32, Int64.MaxValue)) return false; + } // float if (!ArrayFloat(0, 0)) return false; @@ -2514,10 +2535,14 @@ public static bool TestArray() if (!ArrayFloat(32, float.MinValue)) return false; if (!ArrayFloat(32, float.MaxValue)) return false; - // double - if (!ArrayDouble(0, 0)) return false; - if (!ArrayDouble(1, 1)) return false; - if (!ArrayDouble(32, 32)) return false; + // active issue https://github.com/dotnet/runtime/issues/120659 + if (RuntimeInformation.ProcessArchitecture != Architecture.Wasm) + { + // double + if (!ArrayDouble(0, 0)) return false; + if (!ArrayDouble(1, 1)) return false; + if (!ArrayDouble(32, 32)) return false; + } // ref and value types if (!TestObjectArray()) return false; @@ -2941,18 +2966,22 @@ public unsafe static bool TestCalli() } - GetCalliGeneric()(); - if (_typeFromFill != typeof(object)) + // active issue https://github.com/dotnet/runtime/issues/120319 + if (RuntimeInformation.ProcessArchitecture != Architecture.Wasm) { - Console.WriteLine("Calli generic test failed: expected object, got " + _typeFromFill); - return false; - } + GetCalliGeneric()(); + if (_typeFromFill != typeof(object)) + { + Console.WriteLine("Calli generic test failed: expected object, got " + _typeFromFill); + return false; + } - GetCalliGeneric()(); - if (_typeFromFill != typeof(string)) - { - Console.WriteLine("Calli generic test failed: expected string, got " + _typeFromFill); - return false; + GetCalliGeneric()(); + if (_typeFromFill != typeof(string)) + { + Console.WriteLine("Calli generic test failed: expected string, got " + _typeFromFill); + return false; + } } return true; }