Skip to content

Commit

Permalink
Numerous improvements to the test runner and disable some IronPython …
Browse files Browse the repository at this point in the history
…tests that no longer work properly.
  • Loading branch information
jdhardy committed Mar 23, 2012
1 parent 8a41d67 commit c2e58f6
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Languages/IronPython/Tests/Tools/check/_functools.log
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Implement rest of _functools module


IP VERSION AFFECTED: 2.7
IP VERSION AFFECTED: 3.0
FLAGS PASSED TO IPY.EXE: None
OPERATING SYSTEMS AFFECTED: All

Expand Down
8 changes: 4 additions & 4 deletions Test/IronPython.tests
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@
<Arguments>%DLR_BIN%\ipy.exe sbs_true_division.py</Arguments>
<MaxDuration>600000</MaxDuration>
<LongRunning>true</LongRunning>
<Disabled>false</Disabled>
<Disabled>true</Disabled>
<RequiresAdmin>false</RequiresAdmin>
<NotParallelSafe>false</NotParallelSafe>
<WorkingDirectory>%DLR_ROOT%\Languages\IronPython\Tests\compat</WorkingDirectory>
Expand All @@ -533,7 +533,7 @@
<Arguments>test_interactive.py</Arguments>
<MaxDuration>1200000</MaxDuration>
<LongRunning>true</LongRunning>
<Disabled>false</Disabled>
<Disabled>true</Disabled><!-- Too many errors -->
<RequiresAdmin>false</RequiresAdmin>
<NotParallelSafe>false</NotParallelSafe>
<WorkingDirectory>%DLR_ROOT%\languages\ironpython\Tests</WorkingDirectory>
Expand Down Expand Up @@ -1877,7 +1877,7 @@
<Arguments>%DLR_ROOT%\Test\IronPythonTutorial\IPTutorialTest.ps1</Arguments>
<MaxDuration>1800000</MaxDuration>
<LongRunning>true</LongRunning>
<Disabled>false</Disabled>
<Disabled>true</Disabled><!-- files no longer available -->
<RequiresAdmin>false</RequiresAdmin>
<NotParallelSafe>false</NotParallelSafe>
<WorkingDirectory>%DLR_ROOT%\Test\IronPythonTutorial</WorkingDirectory>
Expand Down Expand Up @@ -1921,7 +1921,7 @@
<Arguments />
<MaxDuration>-1</MaxDuration>
<LongRunning>false</LongRunning>
<Disabled>true</Disabled>
<Disabled>true</Disabled><!-- Files no longer exist -->
<RequiresAdmin>false</RequiresAdmin>
<NotParallelSafe>false</NotParallelSafe>
<WorkingDirectory>%DLR_ROOT%\Test\Debugging\Desktop</WorkingDirectory>
Expand Down
78 changes: 49 additions & 29 deletions Test/TestRunner/TestRunner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Diagnostics;
using System.Threading;
using System.Reflection;
using System.ComponentModel;

namespace TestRunner {
class Program {
Expand Down Expand Up @@ -203,40 +204,54 @@ int MainBody(string[] args) {

private void RunTestForConsole(Test test) {
lock (this) {
if (!_quiet) {
if (!_quiet && _verbose) {
Console.Write("{0,-100}", test.Category.Name + " " + test.Name);
}
}
var result = RunTest(test);

TestResult result = null;
try {
result = RunTest(test);
} catch (Exception e) {
result = new TestResult(test, TestResultStatus.Failed, 0, new List<string> { e.Message });
}

lock (this) {
if (!_quiet) {
const string resultFormat = "{0,-10}";
var originalColor = Console.ForegroundColor;
switch (result.Status) {
case TestResultStatus.Skipped:
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write(resultFormat, "SKIPPED");
break;
case TestResultStatus.TimedOut:
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(resultFormat, "TIMEOUT");
break;
case TestResultStatus.Passed:
Console.ForegroundColor = ConsoleColor.Green;
Console.Write(resultFormat, "PASSED");
break;
case TestResultStatus.Failed:
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(resultFormat, "FAILED");
break;
case TestResultStatus.Disabled:
Console.ForegroundColor = ConsoleColor.Blue;
Console.Write(resultFormat, "DISABLED");
break;
if (_verbose) {
const string resultFormat = "{0,-10}";
var originalColor = Console.ForegroundColor;
switch (result.Status) {
case TestResultStatus.Skipped:
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write(resultFormat, "SKIPPED");
break;
case TestResultStatus.TimedOut:
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(resultFormat, "TIMEOUT");
break;
case TestResultStatus.Passed:
Console.ForegroundColor = ConsoleColor.Green;
Console.Write(resultFormat, "PASSED");
break;
case TestResultStatus.Failed:
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(resultFormat, "FAILED");
break;
case TestResultStatus.Disabled:
Console.ForegroundColor = ConsoleColor.Blue;
Console.Write(resultFormat, "DISABLED");
break;
}
Console.ForegroundColor = originalColor;
Console.WriteLine(result.EllapsedSeconds);
} else {
if (result.Status == TestResultStatus.Passed) {
Console.Write(".");
} else {
Console.Write(result.Status.ToString()[0]);
}
}
Console.ForegroundColor = originalColor;
Console.WriteLine(result.EllapsedSeconds);
}

if (result.IsFailure) {
Expand Down Expand Up @@ -278,8 +293,13 @@ private TestResult RunTest(Test test) {

// start the process
DateTime startTime = DateTime.Now;
var process = Process.Start(CreateProcessInfoFromTest(test));

Process process = null;
try {
process = Process.Start(CreateProcessInfoFromTest(test));
} catch (Win32Exception e) {
return new TestResult(test, TestResultStatus.Failed, 0, new List<string> { e.Message });
}

// get the output asynchronously
List<string> output = new List<string>();
process.OutputDataReceived += (sender, e) => {
Expand Down

0 comments on commit c2e58f6

Please sign in to comment.