Skip to content

Commit

Permalink
Test merging baseservices/threading (#83143)
Browse files Browse the repository at this point in the history
* Removing cs test entrypoint args

* Running ILTransform -n

* Running ILTransform -prociso

* Running ILTransform -public

* Running ILTransform -ilfact

* Adding JIT/Directed merge tests wrapper

* Patching merge wrapper generator code

* Fixing accesibility problems after wrapper generator updates
  • Loading branch information
BrianBohe authored Mar 14, 2023
1 parent d6b89c6 commit a78f9bd
Show file tree
Hide file tree
Showing 365 changed files with 654 additions and 388 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,15 @@ private static string GenerateStandaloneSimpleTestRunner(ImmutableArray<ITestInf
ITestReporterWrapper reporter = new NoTestReporting();
StringBuilder builder = new();
builder.AppendLine(string.Join("\n", aliasMap.Values.Where(alias => alias != "global").Select(alias => $"extern alias {alias};")));
builder.AppendLine("namespace __GeneratedMainWrapper;");
builder.AppendLine("class __GeneratedMainWrapper {");
builder.AppendLine("public static int Main() {");
builder.AppendLine("try {");
builder.AppendLine(string.Join("\n", testInfos.Select(m => m.GenerateTestExecution(reporter))));
builder.AppendLine("} catch(System.Exception ex) { System.Console.WriteLine(ex.ToString()); return 101; }");
builder.AppendLine("return 100;");
builder.AppendLine("}");
builder.AppendLine("}");
return builder.ToString();
}

Expand Down
20 changes: 10 additions & 10 deletions src/tests/Loader/classloader/Casting/punning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
partial class Program
{
[Fact]
static void Via_GetFunctionPointer()
internal static void Via_GetFunctionPointer()
{
Console.WriteLine($"Running {nameof(Via_GetFunctionPointer)}...");

Expand All @@ -24,7 +24,7 @@ static void Via_GetFunctionPointer()
}

[Fact]
static void Via_GetFunctionPointer_Generics()
internal static void Via_GetFunctionPointer_Generics()
{
Console.WriteLine($"Running {nameof(Via_GetFunctionPointer_Generics)}...");

Expand All @@ -39,7 +39,7 @@ static void Via_GetFunctionPointer_Generics()
}

[Fact]
static void Via_Ldftn()
internal static void Via_Ldftn()
{
Console.WriteLine($"Running {nameof(Via_Ldftn)}...");

Expand All @@ -54,7 +54,7 @@ static void Via_Ldftn()
}

[Fact]
static void Via_Ldftn_Generics()
internal static void Via_Ldftn_Generics()
{
Console.WriteLine($"Running {nameof(Via_Ldftn_Generics)}...");

Expand All @@ -69,7 +69,7 @@ static void Via_Ldftn_Generics()
}

[Fact]
static void Via_Ldftn_Generics_Virtual()
internal static void Via_Ldftn_Generics_Virtual()
{
Console.WriteLine($"Running {nameof(Via_Ldftn_Generics_Virtual)}...");

Expand All @@ -85,7 +85,7 @@ static void Via_Ldftn_Generics_Virtual()
}

[Fact]
static void Via_Ldftn_Generics_EarlyLoad()
internal static void Via_Ldftn_Generics_EarlyLoad()
{
Console.WriteLine($"Running {nameof(Via_Ldftn_Generics_EarlyLoad)}...");

Expand All @@ -100,7 +100,7 @@ static void Via_Ldftn_Generics_EarlyLoad()
}

[Fact]
static void Via_Ldftn_Generics_Virtual_EarlyLoad()
internal static void Via_Ldftn_Generics_Virtual_EarlyLoad()
{
Console.WriteLine($"Running {nameof(Via_Ldftn_Generics_Virtual_EarlyLoad)}...");

Expand All @@ -116,7 +116,7 @@ static void Via_Ldftn_Generics_Virtual_EarlyLoad()
}

[Fact]
static void Via_Ldvirtftn()
internal static void Via_Ldvirtftn()
{
Console.WriteLine($"Running {nameof(Via_Ldvirtftn)}...");

Expand All @@ -132,7 +132,7 @@ static void Via_Ldvirtftn()
}

[Fact]
static void Via_Ldvirtftn_Generics()
internal static void Via_Ldvirtftn_Generics()
{
Console.WriteLine($"Running {nameof(Via_Ldvirtftn_Generics)}...");

Expand All @@ -148,7 +148,7 @@ static void Via_Ldvirtftn_Generics()
}

[Fact]
static void Via_Ldvirtftn_Generics_EarlyLoad()
internal static void Via_Ldvirtftn_Generics_EarlyLoad()
{
Console.WriteLine($"Running {nameof(Via_Ldvirtftn_Generics_EarlyLoad)}...");

Expand Down
4 changes: 3 additions & 1 deletion src/tests/baseservices/threading/DeadThreads/DeadThreads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Runtime.CompilerServices;
using System.Threading;
using Xunit;

public class DeadThreads
{
Expand Down Expand Up @@ -34,7 +35,8 @@ private static void StartNoOpThread()
t.Start();
}

public static int Main()
[Fact]
public static int TestEntryPoint()
{
GCTriggerSanityTest();
return 100;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Needed for CLRTestEnvironmentVariable -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
Expand Down
11 changes: 11 additions & 0 deletions src/tests/baseservices/threading/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<BuildAsStandalone Condition="'$(BuildAsStandalone)' == ''">false</BuildAsStandalone>

<AssemblyName Condition="'$(BuildAsStandalone)' != 'true'">$(MSBuildProjectName.Replace('_il_d', '').Replace('_il_r', ''))</AssemblyName>
</PropertyGroup>

<Import Project="..\..\Directory.Build.props" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
using System.Text;
// using System.Configuration;
using System.Runtime.InteropServices;
using Xunit;

namespace StackCommitTest
{
class DefaultStackCommit
public class DefaultStackCommit
{
static int Main()
[Fact]
public static int TestEntryPoint()
{
int result = 1;
bool commitEnabled = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Needed for CLRTestTargetUnsupported -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
<!-- Test unsupported outside of windows -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Threading;
using Xunit;

public class mytest {
public static int Main() {
[Fact]
public static int TestEntryPoint() {
int rValue = 100;
AutoResetEvent are = null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Threading;
using Xunit;

public class mytest {
public static int Main() {
[Fact]
public static int TestEntryPoint() {
int rValue = 100;
ManualResetEvent mre = null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Threading;
using Xunit;

public class mytest {
public static int Main() {
[Fact]
public static int TestEntryPoint() {
int rValue = 100;
Mutex mut = null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Threading;
using Xunit;

public class mytest {
public static int Main() {
[Fact]
public static int TestEntryPoint() {
int rValue = 100;
RegisteredWaitHandle rwh = null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using System.Threading;
// using System.Runtime.Remoting;
using System.Runtime.Serialization;
using Xunit;

public class mytest {
public static int Main() {
[Fact]
public static int TestEntryPoint() {
int rValue = 100;
SynchronizationLockException sle = null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
using System;
using System.Threading;
using System.Runtime.Serialization;
using Xunit;

public class mytest {
public static int Main() {
[Fact]
public static int TestEntryPoint() {
int rValue = 100;
ThreadStateException ta = null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Threading;
using Xunit;

public class mytest {
public static int Main() {
[Fact]
public static int TestEntryPoint() {

int rValue = 100;
Timer time = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Threading;
using Xunit;

public class mytest {
public static int Main() {
[Fact]
public static int TestEntryPoint() {
int rValue = 100;
WaitHandle wh = null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using System.Reflection;
using System.Threading;
using Xunit;

namespace Threading.Tests
{
Expand All @@ -12,7 +13,8 @@ public sealed class OSThreadId
private static ManualResetEvent s_resetEvent = new ManualResetEvent(false);
private static ulong[] s_threadIds = new ulong[NumThreads];

public static int Main()
[Fact]
public static int TestEntryPoint()
{
// The property to be tested is internal.
Type runtimeThreadType = typeof(object).Assembly.GetType("System.Threading.Thread");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Threading;
using Xunit;

namespace DelegateTest
{
Expand All @@ -13,10 +14,11 @@ public static string TestMethod(int input)
}
}

class BeginInvokeEndInvokeTest
public class BeginInvokeEndInvokeTest
{
public delegate string AsyncMethodCaller(int input);
static int Main()
[Fact]
public static int TestEntryPoint()
{
IAsyncResult result = null;
AsyncMethodCaller caller = new AsyncMethodCaller(DelegateCommon.TestMethod);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
Expand Down
Loading

0 comments on commit a78f9bd

Please sign in to comment.