Skip to content

Commit

Permalink
Remove string[] args from Main methods under JIT/Methodical (#63770)
Browse files Browse the repository at this point in the history
In most cases the arguments were formal and not really used so
I just fixed the Main method signature. In a bunch of cases the
command-line arguments supported variant functionality of the
test case but I haven't found any test projects that would be
exercising this functionality. I don't think it makes sense to
keep untested code paths so I deleted the logic pertaining to
non-empty command-line arguments.

In the particular case of stringintern tests, each test apparently
had a TestSameObjRef and TestDiffObjRef variant, triggered by
command-line arguments. I tried to run TestDiffObjRef but it
ended up failing left and right - not suprising for untested
code logic - so I also deleted the TestDiffObjRef variants
as I suppose the invariants previously tested there no longer hold.

Thanks

Tomas
  • Loading branch information
trylek authored Jan 14, 2022
1 parent 5626066 commit 02e22b0
Show file tree
Hide file tree
Showing 72 changed files with 93 additions and 645 deletions.
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/Coverage/b433189.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void foo()
{
}

public static int Main(String[] args)
public static int Main()
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/Invoke/hfa_params/hfa_params.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static bool foo(doublesStruct d1, doublesStruct d2, doublesStruct d3)
return success;
}

public static int Main(string[] args)
public static int Main()
{
// Test that a function with HFA args gets the expected contents of the structs.

Expand Down
30 changes: 4 additions & 26 deletions src/tests/JIT/Methodical/Overflow/FloatInfinitiesToInt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,32 +300,10 @@ public static int TestValues()
return res;
}

public static void Usage()
public static int Main()
{
Console.WriteLine("FloatOvfToInt [print|test]");
}

public static int Main(String[] args)
{
if (args.Length != 1)
{
int res = TestValues();
Console.WriteLine("Test " + (res == 100 ? "passed" : "failed"));
return res;
}
switch (args[0])
{
case "print":
PrintValues();
break;
case "test":
int res = TestValues();
Console.WriteLine("Test " + (res == 100 ? "passed" : "failed"));
return res;
default:
Usage();
break;
}
return 0;
int res = TestValues();
Console.WriteLine("Test " + (res == 100 ? "passed" : "failed"));
return res;
}
}
32 changes: 5 additions & 27 deletions src/tests/JIT/Methodical/Overflow/FloatOvfToInt2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -887,32 +887,10 @@ public static int TestValues()
return res;
}

public static void Usage()
{
Console.WriteLine("FloatOvfToInt [print|test]");
}

public static int Main(String[] args)
{
if (args.Length != 1)
{
int res = TestValues();
Console.WriteLine("Test " + (res == 100 ? "passed" : "failed"));
return res;
}
switch (args[0])
{
case "print":
PrintValues();
break;
case "test":
int res = TestValues();
Console.WriteLine("Test " + (res == 100 ? "passed" : "failed"));
return res;
default:
Usage();
break;
}
return 0;
public static int Main()
{
int res = TestValues();
Console.WriteLine("Test " + (res == 100 ? "passed" : "failed"));
return res;
}
}
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/basics/multihandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static Class1()
testLog = new TestUtil.TestLog(expectedOut);
}

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/basics/throwincatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static Class1()
testLog = new TestUtil.TestLog(expectedOut);
}

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/basics/throwinfinally.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static void MiddleMethod()
}
}

public static int Main(string[] args)
public static int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static public void inFinally()
{
Console.WriteLine("in Finally");
}
static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void MiddleMethod()
Console.WriteLine("Unreached...");
}

public static int Main(string[] args)
public static int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/basics/throwoutside.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void MiddleMethod()
throw new Exception();
}

public static int Main(string[] args)
public static int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/basics/trycatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static public void inCatch()

static public void inFinally() { }

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/basics/trycatchtrycatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static public void inFinally()
Console.WriteLine("In finally");
}

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/basics/tryfinally.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static public void inFinally()
Console.WriteLine("in Finally");
}

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/basics/tryfinallytrycatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static public void inFinally()
Console.WriteLine("in Finally");
}

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/basics/tryfinallytryfinally.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static Class1()
testLog = new TestUtil.TestLog(expectedOut);
}

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/basics/trythrowcatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static public void inCatch()
}
static public void inFinally() { }

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/cs/unsafe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ unsafe static void WriteLocations(byte[] arr)
}
}

static int Main(String[] args)
static int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/deadcode/loopstrswitchgoto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static Class1()
s_testLog = new TestUtil.TestLog(expectedOut);
}

private static int Main(string[] args)
private static int Main()
{
string[] s = { "one", "two", "three", "four", "five", "six" };
s_testLog.StartRecording();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static Class1()
testLog = new TestUtil.TestLog(expectedOut);
}

static int Main(string[] args)
static int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/finallyexec/loopinfinally.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static Class1()
testLog = new TestUtil.TestLog(expectedOut);
}

static int Main(string[] args)
static int Main()
{
//Start recording
testLog.StartRecording();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static Class1()
testLog = new TestUtil.TestLog(expectedOut);
}

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
Expand All @@ -39,11 +39,8 @@ static public int Main(string[] args)
if (i > 0) goto done;
try
{
if (args.Length == 0)
{
i++;
goto begintry1;
}
i++;
goto begintry1;
}
finally
{
Expand Down
4 changes: 2 additions & 2 deletions src/tests/JIT/Methodical/eh/finallyexec/simplenonlocalexit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ static Class1()
testLog = new TestUtil.TestLog(expectedOut);
}

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();

try
{
if (args.Length == 0) goto done;
goto done;
Console.WriteLine("in try");
}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ static Class1()
testLog = new TestUtil.TestLog(expectedOut);
}

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
try
{
try
{
if (args.Length == 0) goto done;
goto done;
Console.WriteLine("in try");
}
finally
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/finallyexec/switchincatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static Class1()
/// <summary>
/// The main entry point for the application.
/// </summary>
static int Main(string[] args)
static int Main()
{
string[] s = { "one", "two", "three", "four", "five", "six" };
//Start recording
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static public void Middle1(int i)
Console.WriteLine("middle1 L1");
}

static public int Main(string[] args)
static public int Main()
{
// start recording
testLog.StartRecording();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static public void Middle2(int i)
Console.WriteLine("middle2 L2");
}

static public int Main(string[] args)
static public int Main()
{
// start recording
testLog.StartRecording();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static public void Middle2(int i)
Console.WriteLine(" in middle2 L2B");
}

static public int Main(string[] args)
static public int Main()
{
// start recording
testLog.StartRecording();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static public void foo(int i)
}


static public int Main(string[] args)
static public int Main()
{
// start recording
testLog.StartRecording();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ static public void Middle(int i)

}

static public int Main(string[] args)
static public int Main()
{
//Start recording
testLog.StartRecording();
try
{
Console.WriteLine("In main's try");
Middle(args.Length);
Middle(0);
}
catch
{
Expand Down
9 changes: 1 addition & 8 deletions src/tests/JIT/Methodical/eh/interactions/gcincatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static Class1()
/// <summary>
/// The main entry point for the application.
/// </summary>
public static int Main(String[] args)
public static int Main()
{
int[] ar = new int[] { 1, 2, 3, 4, 5 };

Expand All @@ -49,13 +49,6 @@ public static int Main(String[] args)

try
{
if (args.Length > 0)
{
for (int i = 0; i < ar.Length; i++)
{
Console.WriteLine("ar[" + i + "]=" + ar[i]);
}
}
Console.WriteLine("In try");
GC.Collect();
GC.WaitForPendingFinalizers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static Class1()
// Create and initialize test log object
testLog = new TestUtil.TestLog(expectedOut);
}
static public int Main(string[] args)
static public int Main()
{
int[] a;
//Start recording
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Methodical/eh/interactions/strswitchfinal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static Class1()
s_testLog = new TestUtil.TestLog(expectedOut);
}

private static int Main(string[] args)
private static int Main()
{
string[] s = { "one", "two", "three", "four", "five", "six" };
s_testLog.StartRecording();
Expand Down
Loading

0 comments on commit 02e22b0

Please sign in to comment.