diff --git a/.yamato/build_and_test_linux_x64.yml b/.yamato/build_and_test_linux_x64.yml new file mode 100644 index 00000000000000..ec56d33a8a4ff2 --- /dev/null +++ b/.yamato/build_and_test_linux_x64.yml @@ -0,0 +1,26 @@ +name: Build and Test Linux x64 + +agent: + type: Unity::VM + image: platform-foundation/linux-ubuntu-18.04-mono-bokken:latest + flavor: b1.large + +commands: + - ./build.sh -subset clr+libs+libs.tests -test -a x64 -rc checked -lc release -ci -ninja + - command: ./src/tests/build.sh x64 checked ci + retries: 1 + - ./src/tests/run.sh x64 checked + - ./build.sh clr.paltests + - ./artifacts/bin/coreclr/$(uname).x64.Debug/paltests/runpaltests.sh $(pwd)/artifacts/bin/coreclr/$(uname).x64.Debug/paltests + +triggers: + pull_requests: + - targets: + only: + - "unity-main" + +artifacts: + linux64: + paths: + - artifacts/bin/coreclr/** + - artifacts/repro/** \ No newline at end of file diff --git a/.yamato/build_and_test_osx_x64.yml b/.yamato/build_and_test_osx_x64.yml new file mode 100644 index 00000000000000..8fff8b82900804 --- /dev/null +++ b/.yamato/build_and_test_osx_x64.yml @@ -0,0 +1,25 @@ +name: Build and Test OSX x64 + +agent: + type: Unity::VM::osx + image: platform-foundation/mac-bokken:latest + flavor: m1.mac + +commands: + - LD_LIBRARY_PATH=/usr/local/opt/openssl/lib ./build.sh -subset clr+libs+libs.tests -test -a x64 -rc checked -lc release -ci -ninja + - ./src/tests/build.sh x64 checked ci + - ./src/tests/run.sh x64 checked + - ./build.sh clr.paltests + - ./artifacts/bin/coreclr/OSX.x64.Debug/paltests/runpaltests.sh $(pwd)/artifacts/bin/coreclr/OSX.x64.Debug/paltests + +triggers: + pull_requests: + - targets: + only: + - "unity-main" + +artifacts: + osx64: + paths: + - artifacts/bin/coreclr/** + - artifacts/repro/** \ No newline at end of file diff --git a/.yamato/build_classlibs_win.yml b/.yamato/build_classlibs_win.yml deleted file mode 100644 index e9981dbe0e6481..00000000000000 --- a/.yamato/build_classlibs_win.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Build Classlibs Windows - -agent: - type: Unity::VM - image: platform-foundation/windows-vs2019-il2cpp-bokken:stable - flavor: b1.xlarge - -commands: - - .yamato/scripts/build_classlibs.bat - -triggers: - pull_requests: - - targets: - only: - - "unity-main" - -artifacts: - win64: - paths: - - incomingbuilds\** \ No newline at end of file diff --git a/.yamato/build_windows_x64.yml b/.yamato/build_windows_x64.yml index e7679a0efab9d5..b577011849b12a 100644 --- a/.yamato/build_windows_x64.yml +++ b/.yamato/build_windows_x64.yml @@ -1,12 +1,14 @@ -name: Build Windows x64 +name: Build and Test Windows x64 agent: type: Unity::VM - image: platform-foundation/windows-vs2019-il2cpp-bokken:stable + image: platform-foundation/windows-vs2019-il2cpp-bokken:latest flavor: b1.xlarge commands: - - .yamato/scripts/build_win.bat + - build.cmd -subset clr+libs+libs.tests -test -a x64 -rc checked -lc release -ci + - src\tests\build.cmd x64 checked ci + - src\tests\run.cmd x64 checked triggers: pull_requests: @@ -17,4 +19,5 @@ triggers: artifacts: win64: paths: - - incomingbuilds\win64\** \ No newline at end of file + - artifacts\bin\coreclr\** + - artifacts\repro\** \ No newline at end of file diff --git a/.yamato/scripts/build_classlibs.bat b/.yamato/scripts/build_classlibs.bat deleted file mode 100644 index 3f6e0dfc0dc569..00000000000000 --- a/.yamato/scripts/build_classlibs.bat +++ /dev/null @@ -1,22 +0,0 @@ -@echo OFF - -if not exist "incomingbuilds" mkdir "incomingbuilds" - -for %%x IN ("windows", "OSX", "Linux") do ( - CALL :EchoAndExecute build.cmd libs -os %%x -c release - if NOT %errorlevel% == 0 ( - echo "build failed" - EXIT /B %errorlevel% - ) - if not exist "incomingbuilds/coreclrjit-%%x" mkdir "incomingbuilds/coreclrjit-%%x" - - CALL :EchoAndExecute xcopy /s /e /h /y "artifacts/bin/runtime/net7.0-%%x-Release-x64" "incomingbuilds/coreclrjit-%%x" - CALL :EchoAndExecute taskkill /IM "dotnet.exe" /F - CALL :EchoAndExecute build.cmd -clean -) -EXIT /B %ERRORLEVEL% - -:EchoAndExecute -ECHO %* -CALL %* -GOTO :EOF diff --git a/.yamato/scripts/build_win.bat b/.yamato/scripts/build_win.bat deleted file mode 100644 index 79ebdc83e32d3f..00000000000000 --- a/.yamato/scripts/build_win.bat +++ /dev/null @@ -1,14 +0,0 @@ -@echo off -setlocal - - -powershell -ExecutionPolicy ByPass -NoProfile -Command "& 'eng\build.ps1'" -subset clr -a x64 -c release - -if NOT %errorlevel% == 0 ( - echo "build failed" - EXIT /B %errorlevel% -) -echo "build ran successfully" - -md incomingbuilds\win64 -xcopy /s /e /h /y artifacts\bin\coreclr\windows.x64.Release incomingbuilds\win64 diff --git a/src/tests/JIT/Directed/debugging/debuginfo/tester.cs b/src/tests/JIT/Directed/debugging/debuginfo/tester.cs deleted file mode 100644 index b784fd4a6f56b0..00000000000000 --- a/src/tests/JIT/Directed/debugging/debuginfo/tester.cs +++ /dev/null @@ -1,152 +0,0 @@ -extern alias tests_d; -extern alias tests_r; - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.Tracing; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Diagnostics.Tools.RuntimeClient; -using Microsoft.Diagnostics.Tracing; -using Microsoft.Diagnostics.Tracing.Parsers; -using Microsoft.Diagnostics.Tracing.Parsers.Clr; -using Tracing.Tests.Common; -using DebugInfoMethodsD = tests_d::DebugInfoMethods; -using DebugInfoMethodsR = tests_r::DebugInfoMethods; - -public unsafe class DebugInfoTest -{ - public static unsafe int Main() - { - var keywords = - ClrTraceEventParser.Keywords.Jit | ClrTraceEventParser.Keywords.JittedMethodILToNativeMap; - - var dotnetRuntimeProvider = new List - { - new Provider("Microsoft-Windows-DotNETRuntime", eventLevel: EventLevel.Verbose, keywords: (ulong)keywords) - }; - - var config = new SessionConfiguration(1024, EventPipeSerializationFormat.NetTrace, dotnetRuntimeProvider); - - return - IpcTraceTest.RunAndValidateEventCounts( - new Dictionary(), - JitMethods, - config, - ValidateMappings); - } - - private static void JitMethods() - { - ProcessType(typeof(DebugInfoMethodsD)); - ProcessType(typeof(DebugInfoMethodsR)); - } - - private static void ProcessType(Type t) - { - foreach (MethodInfo mi in t.GetMethods()) - { - if (mi.GetCustomAttribute() != null) - { - RuntimeHelpers.PrepareMethod(mi.MethodHandle); - } - } - } - - private static Func ValidateMappings(EventPipeEventSource source) - { - List<(long MethodID, OptimizationTier Tier, (int ILOffset, int NativeOffset)[] Mappings)> methodsWithMappings = new(); - Dictionary methodTier = new(); - - source.Clr.MethodLoad += e => methodTier[e.MethodID] = e.OptimizationTier; - source.Clr.MethodLoadVerbose += e => methodTier[e.MethodID] = e.OptimizationTier; - source.Clr.MethodILToNativeMap += e => - { - if (e.MethodID == 0) - return; - - var mappings = new (int, int)[e.CountOfMapEntries]; - for (int i = 0; i < mappings.Length; i++) - mappings[i] = (e.ILOffset(i), e.NativeOffset(i)); - - if (!methodTier.TryGetValue(e.MethodID, out OptimizationTier tier)) - tier = OptimizationTier.Unknown; - - methodsWithMappings.Add((e.MethodID, tier, mappings)); - }; - - return () => - { - int result = 100; - foreach ((long methodID, OptimizationTier tier, (int ILOffset, int NativeOffset)[] mappings) in methodsWithMappings) - { - MethodBase meth = s_getMethodBaseByHandle(null, (IntPtr)(void*)methodID); - ExpectedILMappings attrib = meth.GetCustomAttribute(); - if (attrib == null) - { - continue; - } - - string name = $"[{meth.DeclaringType.Assembly.GetName().Name}]{meth.DeclaringType.FullName}.{meth.Name}"; - - // If DebuggableAttribute is saying that the assembly must be debuggable, then verify debug mappings. - // Otherwise verify release mappings. - // This may seem a little strange since we do not use the tier at all -- however, we expect debug - // to never tier and in release, we expect the release mappings to be the "least common denominator", - // i.e. tier0 and tier1 mappings should both be a superset. - // Note that tier0 and MinOptJitted differs in mappings generated exactly due to DebuggableAttribute. - DebuggableAttribute debuggableAttrib = meth.DeclaringType.Assembly.GetCustomAttribute(); - bool debuggableMappings = debuggableAttrib != null && debuggableAttrib.IsJITOptimizerDisabled; - - Console.WriteLine("{0}: Validate mappings for {1} codegen (tier: {2})", name, debuggableMappings ? "debuggable" : "optimized", tier); - - int[] expected = debuggableMappings ? attrib.Debug : attrib.Opts; - if (expected == null) - { - continue; - } - - if (!ValidateSingle(expected, mappings)) - { - Console.WriteLine(" Validation failed: expected mappings at IL offsets {0}", string.Join(", ", expected.Select(il => $"{il:x3}"))); - Console.WriteLine(" Actual (IL <-> native):"); - foreach ((int ilOffset, int nativeOffset) in mappings) - { - string ilOffsetName = Enum.IsDefined((SpecialILOffset)ilOffset) ? ((SpecialILOffset)ilOffset).ToString() : $"{ilOffset:x3}"; - Console.WriteLine(" {0:x3} <-> {1:x3}", ilOffsetName, nativeOffset); - } - - result = -1; - } - } - - return result; - }; - } - - // Validate that all IL offsets we expected had mappings generated for them. - private static bool ValidateSingle(int[] expected, (int ILOffset, int NativeOffset)[] mappings) - { - return expected.All(il => mappings.Any(t => t.ILOffset == il)); - } - - private enum SpecialILOffset - { - NoMapping = -1, - Prolog = -2, - Epilog = -3, - } - - static DebugInfoTest() - { - Type runtimeMethodHandleInternalType = typeof(RuntimeMethodHandle).Assembly.GetType("System.RuntimeMethodHandleInternal"); - Type runtimeTypeType = typeof(RuntimeMethodHandle).Assembly.GetType("System.RuntimeType"); - MethodInfo getMethodBaseMethod = runtimeTypeType.GetMethod("GetMethodBase", BindingFlags.NonPublic | BindingFlags.Static, new[] { runtimeTypeType, runtimeMethodHandleInternalType }); - s_getMethodBaseByHandle = (delegate*)getMethodBaseMethod.MethodHandle .GetFunctionPointer(); - } - - // Needed to go from MethodID -> MethodBase - private static readonly delegate* s_getMethodBaseByHandle; -} diff --git a/src/tests/JIT/Directed/debugging/debuginfo/tester.csproj b/src/tests/JIT/Directed/debugging/debuginfo/tester.csproj deleted file mode 100644 index 2545e6ceb3c2aa..00000000000000 --- a/src/tests/JIT/Directed/debugging/debuginfo/tester.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - Exe - PdbOnly - True - True - true - true - - - - - - - - - diff --git a/src/tests/profiler/unittest/getappdomainstaticaddress.cs b/src/tests/profiler/unittest/getappdomainstaticaddress.cs deleted file mode 100644 index 4676a6b05818b4..00000000000000 --- a/src/tests/profiler/unittest/getappdomainstaticaddress.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; -using System.IO; -using System.Runtime.Loader; - -namespace Profiler.Tests -{ - class Program - { - static readonly Guid GetAppDomainStaticAddressProfilerGuid = new Guid("604D76F0-2AF2-48E0-B196-80C972F6AFB7"); - - static int Main(string[] args) - { - if (args.Length == 1 && args[0].Equals("RunTest", StringComparison.OrdinalIgnoreCase)) - { - return RunTest(); - } - - return ProfilerTestRunner.Run(profileePath: System.Reflection.Assembly.GetExecutingAssembly().Location, - testName: "UnitTestGetAppDomainStaticAddress", - profilerClsid: GetAppDomainStaticAddressProfilerGuid); - } - - static int RunTest() - { - LoadCollectibleAssembly(); - - Thread.Sleep(TimeSpan.FromSeconds(3)); - - return 100; - } - - private static void LoadCollectibleAssembly() - { - var collectibleContext = new AssemblyLoadContext("Collectible", true); - - var asmDir = Path.GetDirectoryName(typeof(Program).Assembly.Location); - var dynamicLibrary = collectibleContext.LoadFromAssemblyPath(Path.Combine(asmDir, "unloadlibrary.dll")); - var testType = dynamicLibrary.GetType("UnloadLibrary.TestClass"); - - object instance = Activator.CreateInstance(testType); - - Console.WriteLine(instance.GetHashCode()); - GC.Collect(); - collectibleContext.Unload(); - } - } -} diff --git a/src/tests/profiler/unittest/getappdomainstaticaddress.csproj b/src/tests/profiler/unittest/getappdomainstaticaddress.csproj deleted file mode 100644 index a6387766a2c852..00000000000000 --- a/src/tests/profiler/unittest/getappdomainstaticaddress.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - .NETCoreApp - exe - true - true - - true - - true - - - - - - - - - diff --git a/src/tests/tracing/eventpipe/eventsourceerror/eventsourceerror.cs b/src/tests/tracing/eventpipe/eventsourceerror/eventsourceerror.cs deleted file mode 100644 index cc77d66546f0fe..00000000000000 --- a/src/tests/tracing/eventpipe/eventsourceerror/eventsourceerror.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Diagnostics.Tracing; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Microsoft.Diagnostics.Tools.RuntimeClient; -using Microsoft.Diagnostics.Tracing; -using Tracing.Tests.Common; -using Microsoft.Diagnostics.Tracing.Parsers.Clr; - -namespace Tracing.Tests.EventSourceError -{ - // This class tries to use IEnumerable events with manifest based - // EventSource, which will cause an error. The test is validating we see - // that error over EventPipe. - class IllegalTypesEventSource : EventSource - { - public IllegalTypesEventSource() - { - - } - - [Event(1, Level = EventLevel.LogAlways)] - public void SimpleArrayEvent(int[] simpleArray) - { - WriteEvent(1, simpleArray); - } - - [Event(2, Level = EventLevel.LogAlways)] - public void BasicEvent(int i) - { - WriteEvent(2, i); - } - - protected override void OnEventCommand(EventCommandEventArgs command) - { - Console.WriteLine($"command={command.Command}"); - } - } - - public class EventSourceError - { - public static int Main(string[] args) - { - // This test validates that if an EventSource generates an error - // during construction it gets emitted over EventPipe - - List providers = new List - { - new Provider("IllegalTypesEventSource") - }; - - var configuration = new SessionConfiguration(circularBufferSizeMB: 1024, format: EventPipeSerializationFormat.NetTrace, providers: providers); - return IpcTraceTest.RunAndValidateEventCounts(_expectedEventCounts, _eventGeneratingAction, configuration, _DoesRundownContainMethodEvents); - } - - private static Dictionary _expectedEventCounts = new Dictionary() - { - { "IllegalTypesEventSource", 1 } - }; - - private static Action _eventGeneratingAction = () => - { - // Constructing the EventSource should generate the error message - IllegalTypesEventSource eventSource = new IllegalTypesEventSource(); - - // This will be a no-op since the EventSource failed to construct - eventSource.SimpleArrayEvent(new int[] { 12 }); - }; - - private static Func> _DoesRundownContainMethodEvents = (source) => - { - int eventCount = 0; - bool sawEvent = false; - source.Dynamic.All += (TraceEvent traceEvent) => - { - if (traceEvent.ProviderName == "SentinelEventSource" - || traceEvent.ProviderName == "Microsoft-Windows-DotNETRuntime" - || traceEvent.ProviderName == "Microsoft-Windows-DotNETRuntimeRundown" - || traceEvent.ProviderName == "Microsoft-DotNETCore-EventPipe") - { - return; - } - - ++eventCount; - - if (traceEvent.ProviderName == "IllegalTypesEventSource" - && traceEvent.EventName == "EventSourceMessage" - && traceEvent.FormattedMessage.StartsWith("ERROR: Exception in Command Processing for EventSource IllegalTypesEventSource", StringComparison.OrdinalIgnoreCase)) - { - sawEvent = true; - } - else - { - Console.WriteLine($"Saw unexpected event {traceEvent}"); - } - }; - - return () => ((eventCount == 1) && sawEvent) ? 100 : -1; - }; - } -} diff --git a/src/tests/tracing/eventpipe/eventsourceerror/eventsourceerror.csproj b/src/tests/tracing/eventpipe/eventsourceerror/eventsourceerror.csproj deleted file mode 100644 index a8e7888a687727..00000000000000 --- a/src/tests/tracing/eventpipe/eventsourceerror/eventsourceerror.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - .NETCoreApp - exe - true - - true - true - - - - - - diff --git a/src/tests/tracing/eventpipe/gcdump/gcdump.cs b/src/tests/tracing/eventpipe/gcdump/gcdump.cs deleted file mode 100644 index 91750986d395a4..00000000000000 --- a/src/tests/tracing/eventpipe/gcdump/gcdump.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; -using System.Diagnostics.Tracing; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Microsoft.Diagnostics.NETCore.Client; -using Microsoft.Diagnostics.Tools.RuntimeClient; -using Microsoft.Diagnostics.Tracing; -using Microsoft.Diagnostics.Tracing.Parsers; -using Tracing.Tests.Common; -using Microsoft.Diagnostics.Tracing.Parsers.Clr; - -namespace Tracing.Tests.EventSourceError -{ - // Regression test for https://github.com/dotnet/runtime/issues/38639 - public class GCDumpTest - { - private static int _bulkTypeCount = 0; - private static int _bulkNodeCount = 0; - private static int _bulkEdgeCount = 0; - private static int _bulkRootEdgeCount = 0; - private static int _bulkRootStaticVarCount = 0; - - private static readonly ulong GC_HeapDump_Keyword = 0x100000UL; - - public static int Main(string[] args) - { - // This test validates that if an EventSource generates an error - // during construction it gets emitted over EventPipe - - List providers = new List - { - new Provider("Microsoft-Windows-DotNETRuntime", eventLevel: EventLevel.Verbose, keywords: (ulong)ClrTraceEventParser.Keywords.GCHeapSnapshot) - }; - - var configuration = new SessionConfiguration(circularBufferSizeMB: 1024, format: EventPipeSerializationFormat.NetTrace, providers: providers); - return IpcTraceTest.RunAndValidateEventCounts(_expectedEventCounts, _eventGeneratingAction, configuration, _DoesRundownContainMethodEvents); - } - - private static Dictionary _expectedEventCounts = new Dictionary() - { - // This space intentionally left blank - }; - - private static Action _eventGeneratingAction = () => - { - // This space intentionally left blank - }; - - private static Func> _DoesRundownContainMethodEvents = (source) => - { - source.Clr.TypeBulkType += (GCBulkTypeTraceData data) => - { - _bulkTypeCount += data.Count; - }; - - source.Clr.GCBulkNode += delegate (GCBulkNodeTraceData data) - { - _bulkNodeCount += data.Count; - }; - - source.Clr.GCBulkEdge += (GCBulkEdgeTraceData data) => - { - _bulkEdgeCount += data.Count; - }; - - source.Clr.GCBulkRootEdge += (GCBulkRootEdgeTraceData data) => - { - _bulkRootEdgeCount += data.Count; - }; - - source.Clr.GCBulkRootStaticVar += (GCBulkRootStaticVarTraceData data) => - { - _bulkRootStaticVarCount += data.Count; - }; - - return () => - { - // Hopefully it is low enough to be resilient to changes in the runtime - // and high enough to catch issues. There should be between hundreds and thousands - // for each, but the number is variable and the point of the test is to verify - // that we get any events at all. - if (_bulkTypeCount > 50 - && _bulkNodeCount > 50 - && _bulkEdgeCount > 50 - && _bulkRootEdgeCount > 50 - && _bulkRootStaticVarCount > 50) - { - return 100; - } - - - Console.WriteLine($"Test failed due to missing GC heap events."); - Console.WriteLine($"_bulkTypeCount = {_bulkTypeCount}"); - Console.WriteLine($"_bulkNodeCount = {_bulkNodeCount}"); - Console.WriteLine($"_bulkEdgeCount = {_bulkEdgeCount}"); - Console.WriteLine($"_bulkRootEdgeCount = {_bulkRootEdgeCount}"); - Console.WriteLine($"_bulkRootStaticVarCount = {_bulkRootStaticVarCount}"); - return -1; - }; - }; - } -} diff --git a/src/tests/tracing/eventpipe/gcdump/gcdump.csproj b/src/tests/tracing/eventpipe/gcdump/gcdump.csproj deleted file mode 100644 index 26b0e4e38b2a2e..00000000000000 --- a/src/tests/tracing/eventpipe/gcdump/gcdump.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - .NETCoreApp - exe - true - true - - true - - - - - -