Skip to content

Commit

Permalink
Fix a few special cases of projects with command line arguments (#61758)
Browse files Browse the repository at this point in the history
* Remove CLRTestExecutionArguments from OOMException01

Test entrypoint is parameterless and so it ignores the argument

* The test entrypoint for 347011 is parameterless so the property is ignored

* Remove project-driven command line arguments from the polyrec test

The test just passes a pair of integers that are used as internal
parameters for the test. Refactor the test so that the entrypoint
accepts the parameters as arguments and call it once from Main
the way we used to do based on the CLRTestExecutionArguments.

Thanks

Tomas
  • Loading branch information
trylek authored Nov 22, 2021
1 parent 752d396 commit 77165a0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/tests/Loader/regressions/polyrec/Polyrec.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestExecutionArguments>4 50</CLRTestExecutionArguments>
<CLRTestPriority>1</CLRTestPriority>
<!-- This test leaves threads running at exit -->
<UnloadabilityIncompatible>true</UnloadabilityIncompatible>
Expand Down
25 changes: 13 additions & 12 deletions src/tests/Loader/regressions/polyrec/polyrec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// and niters it the number of type/method instantiations to create each thread
using System;
using System.Threading;
using Xunit;

// Spice things up a bit with some mutual recursion between instantiations
class C<T>
Expand Down Expand Up @@ -63,24 +64,24 @@ public static void Start2()
genmeth2<string>(ninsts);
}

public static int Main(String[] args)
public static void Test(int threads, int insts)
{
if (args.Length < 2)
{
Console.WriteLine("Usage: polyrec <nthreads> <ninsts>");
return 99;
}

nthreads = Int32.Parse(args[0]);
ninsts = Int32.Parse(args[1]);
nthreads = threads;
ninsts = insts;

for (int i = 0; i < nthreads; i++)
{
{
Thread t = new Thread(i % 2 == 0 ? new ThreadStart(Start) : new ThreadStart(Start2));
t.Name = "Thread " + i;
t.Start();
}
Console.WriteLine("Main thread exited");
return 100;

Console.WriteLine("Main thread exited");
}

[Fact]
public static void Test_4_50()
{
Test(4, 50);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
<CLRTestExecutionArguments>-trustedexe</CLRTestExecutionArguments>
</PropertyGroup>
<ItemGroup>
<Compile Include="oomexception01.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
<CLRTestExecutionArguments>240</CLRTestExecutionArguments>
</PropertyGroup>
<ItemGroup>
<Compile Include="347011.cs" />
Expand Down

0 comments on commit 77165a0

Please sign in to comment.