提交 3052f6fb 编写于 作者: J Jared Parsons 提交者: Jared Parsons

Switched to using ConditionalFact

There were some issues getting xunit to respect the -notrait option
hence we decided to simplify and use ConditionalFact
上级 ee54148b
...@@ -3775,8 +3775,7 @@ .maxstack 1 ...@@ -3775,8 +3775,7 @@ .maxstack 1
/// Reuse existing anonymous types. /// Reuse existing anonymous types.
/// </summary> /// </summary>
[WorkItem(825903, "DevDiv")] [WorkItem(825903, "DevDiv")]
[Fact] [ConditionalFact(typeof(x86))]
[Trait("Require32", "true")]
public void AnonymousTypes() public void AnonymousTypes()
{ {
var source0 = var source0 =
......
...@@ -3276,8 +3276,7 @@ End Class ...@@ -3276,8 +3276,7 @@ End Class
]]>.Value) ]]>.Value)
End Sub End Sub
<Fact()> <ConditionalFact(GetType(x86))>
<Trait("Require32", "true")>
Public Sub AnonymousTypes() Public Sub AnonymousTypes()
Dim sources0 = <compilation> Dim sources0 = <compilation>
<file name="a.vb"><![CDATA[ <file name="a.vb"><![CDATA[
......
...@@ -3017,8 +3017,7 @@ End Class ...@@ -3017,8 +3017,7 @@ End Class
End Sub End Sub
<WorkItem(1108007, "DevDiv")> <WorkItem(1108007, "DevDiv")>
<Fact()> <ConditionalFact(GetType(x86))>
<Trait("Require32", "true")>
Public Sub Bug1108007_2() Public Sub Bug1108007_2()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
<compilation> <compilation>
...@@ -3320,8 +3319,7 @@ End Class ...@@ -3320,8 +3319,7 @@ End Class
End Sub End Sub
<WorkItem(1108007, "DevDiv")> <WorkItem(1108007, "DevDiv")>
<Fact()> <ConditionalFact(GetType(x86))>
<Trait("Require32", "true")>
Public Sub Bug1108007_8() Public Sub Bug1108007_8()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
<compilation> <compilation>
......
...@@ -16,8 +16,7 @@ public class ExtensionOrderingTests ...@@ -16,8 +16,7 @@ public class ExtensionOrderingTests
{ {
private readonly ExportProvider _exportProvider = TestExportProvider.ExportProviderWithCSharpAndVisualBasic; private readonly ExportProvider _exportProvider = TestExportProvider.ExportProviderWithCSharpAndVisualBasic;
[Fact] [ConditionalFact(typeof(x86))]
[Trait("Require32", "true")]
public void TestNoCyclesInFixProviders() public void TestNoCyclesInFixProviders()
{ {
// This test will fail if a cycle is detected in the ordering of our code fix providers. // This test will fail if a cycle is detected in the ordering of our code fix providers.
......
...@@ -39,7 +39,7 @@ internal static int Main(string[] args) ...@@ -39,7 +39,7 @@ internal static int Main(string[] args)
? Path.Combine(xunitPath, "xunit.console.exe") ? Path.Combine(xunitPath, "xunit.console.exe")
: Path.Combine(xunitPath, "xunit.console.x86.exe"); : Path.Combine(xunitPath, "xunit.console.x86.exe");
var testRunner = new TestRunner(xunit, test64); var testRunner = new TestRunner(xunit);
var start = DateTime.Now; var start = DateTime.Now;
Console.WriteLine("Running {0} tests", list.Count); Console.WriteLine("Running {0} tests", list.Count);
var result = testRunner.RunAll(list).Result; var result = testRunner.RunAll(list).Result;
......
...@@ -31,12 +31,10 @@ internal TestResult(bool succeeded, string assemblyName, TimeSpan elapsed, strin ...@@ -31,12 +31,10 @@ internal TestResult(bool succeeded, string assemblyName, TimeSpan elapsed, strin
} }
private readonly string _xunitConsolePath; private readonly string _xunitConsolePath;
private readonly bool _use64;
internal TestRunner(string xunitConsolePath, bool use64) internal TestRunner(string xunitConsolePath)
{ {
_xunitConsolePath = xunitConsolePath; _xunitConsolePath = xunitConsolePath;
_use64 = use64;
} }
internal async Task<bool> RunAll(IEnumerable<string> assemblyList) internal async Task<bool> RunAll(IEnumerable<string> assemblyList)
...@@ -108,14 +106,10 @@ private async Task<TestResult> RunTest(string assemblyPath) ...@@ -108,14 +106,10 @@ private async Task<TestResult> RunTest(string assemblyPath)
{ {
var assemblyName = Path.GetFileName(assemblyPath); var assemblyName = Path.GetFileName(assemblyPath);
var resultsPath = Path.Combine(Path.GetDirectoryName(assemblyPath), Path.ChangeExtension(assemblyName, ".html")); var resultsPath = Path.Combine(Path.GetDirectoryName(assemblyPath), Path.ChangeExtension(assemblyName, ".html"));
DeleteFile(resultsPath);
var builder = new StringBuilder(); var builder = new StringBuilder();
builder.AppendFormat(@"""{0}""", assemblyPath); builder.AppendFormat(@"""{0}""", assemblyPath);
if (_use64)
{
builder.Append(@" -notrait ""Require32=true""");
}
builder.AppendFormat(@" -html ""{0}""", resultsPath); builder.AppendFormat(@" -html ""{0}""", resultsPath);
builder.Append(" -noshadow"); builder.Append(" -noshadow");
...@@ -163,5 +157,20 @@ private async Task<TestResult> RunTest(string assemblyPath) ...@@ -163,5 +157,20 @@ private async Task<TestResult> RunTest(string assemblyPath)
return new TestResult(processOutput.ExitCode == 0, assemblyName, span, errorOutput); return new TestResult(processOutput.ExitCode == 0, assemblyName, span, errorOutput);
} }
private static void DeleteFile(string filePath)
{
try
{
if (File.Exists(filePath))
{
File.Delete(filePath);
}
}
catch
{
// Ignore
}
}
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册