Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
6988e40f
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6988e40f
编写于
9月 23, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Include XML test results in local test runs
Closes #47974
上级
637cb4c8
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
26 addition
and
22 deletion
+26
-22
src/Tools/Source/RunTests/AssemblyScheduler.cs
src/Tools/Source/RunTests/AssemblyScheduler.cs
+10
-12
src/Tools/Source/RunTests/ITestExecutor.cs
src/Tools/Source/RunTests/ITestExecutor.cs
+3
-3
src/Tools/Source/RunTests/Options.cs
src/Tools/Source/RunTests/Options.cs
+3
-3
src/Tools/Source/RunTests/ProcessTestExecutor.cs
src/Tools/Source/RunTests/ProcessTestExecutor.cs
+8
-2
src/Tools/Source/RunTests/Program.cs
src/Tools/Source/RunTests/Program.cs
+1
-1
src/Tools/Source/RunTests/TestRunner.cs
src/Tools/Source/RunTests/TestRunner.cs
+1
-1
未找到文件。
src/Tools/Source/RunTests/AssemblyScheduler.cs
浏览文件 @
6988e40f
...
...
@@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
...
...
@@ -10,7 +9,6 @@
using
System.Reflection.Metadata
;
using
System.Reflection.PortableExecutable
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
RunTests
{
...
...
@@ -33,12 +31,12 @@ internal struct AssemblyInfo
ExtraArguments
=
extraArguments
;
}
internal
AssemblyInfo
(
string
assemblyPath
,
string
targetFrameworkMoniker
,
string
architecture
,
bool
useHmt
l
)
internal
AssemblyInfo
(
string
assemblyPath
,
string
targetFrameworkMoniker
,
string
architecture
,
bool
includeHtm
l
)
{
AssemblyPath
=
assemblyPath
;
DisplayName
=
Path
.
GetFileName
(
assemblyPath
);
var
suffix
=
useHmt
l
?
"html"
:
"xml"
;
var
suffix
=
includeHtm
l
?
"html"
:
"xml"
;
ResultsFileName
=
$"
{
DisplayName
}
_
{
targetFrameworkMoniker
}
_
{
architecture
}
.
{
suffix
}
"
;
ExtraArguments
=
string
.
Empty
;
}
...
...
@@ -91,23 +89,23 @@ private sealed class AssemblyInfoBuilder
private
readonly
StringBuilder
_builder
=
new
StringBuilder
();
private
readonly
string
_assemblyPath
;
private
readonly
int
_methodLimit
;
private
readonly
bool
_
us
eHtml
;
private
readonly
bool
_
includ
eHtml
;
private
readonly
bool
_hasEventListenerGuard
;
private
int
_currentId
;
private
List
<
TypeInfo
>
_currentTypeInfoList
=
new
List
<
TypeInfo
>();
private
AssemblyInfoBuilder
(
string
assemblyPath
,
int
methodLimit
,
bool
us
eHtml
,
bool
hasEventListenerGuard
)
private
AssemblyInfoBuilder
(
string
assemblyPath
,
int
methodLimit
,
bool
includ
eHtml
,
bool
hasEventListenerGuard
)
{
_assemblyPath
=
assemblyPath
;
_
useHtml
=
us
eHtml
;
_
includeHtml
=
includ
eHtml
;
_methodLimit
=
methodLimit
;
_hasEventListenerGuard
=
hasEventListenerGuard
;
}
internal
static
void
Build
(
string
assemblyPath
,
int
methodLimit
,
bool
us
eHtml
,
List
<
TypeInfo
>
typeInfoList
,
out
List
<
Partition
>
partitionList
,
out
List
<
AssemblyInfo
>
assemblyInfoList
)
internal
static
void
Build
(
string
assemblyPath
,
int
methodLimit
,
bool
includ
eHtml
,
List
<
TypeInfo
>
typeInfoList
,
out
List
<
Partition
>
partitionList
,
out
List
<
AssemblyInfo
>
assemblyInfoList
)
{
var
hasEventListenerGuard
=
typeInfoList
.
Any
(
x
=>
x
.
FullName
==
EventListenerGuardFullName
);
var
builder
=
new
AssemblyInfoBuilder
(
assemblyPath
,
methodLimit
,
us
eHtml
,
hasEventListenerGuard
);
var
builder
=
new
AssemblyInfoBuilder
(
assemblyPath
,
methodLimit
,
includ
eHtml
,
hasEventListenerGuard
);
builder
.
Build
(
typeInfoList
);
partitionList
=
builder
.
_partitionList
;
assemblyInfoList
=
builder
.
_assemblyInfoList
;
...
...
@@ -169,7 +167,7 @@ private void FinishPartition()
{
var
assemblyName
=
Path
.
GetFileName
(
_assemblyPath
);
var
displayName
=
$"
{
assemblyName
}
.
{
_currentId
}
"
;
var
suffix
=
_
us
eHtml
?
"html"
:
"xml"
;
var
suffix
=
_
includ
eHtml
?
"html"
:
"xml"
;
var
resultsFileName
=
$"
{
assemblyName
}
.
{
_currentId
}
.
{
suffix
}
"
;
var
assemblyInfo
=
new
AssemblyInfo
(
_assemblyPath
,
...
...
@@ -206,7 +204,7 @@ public IEnumerable<AssemblyInfo> Schedule(string assemblyPath, bool force = fals
var
typeInfoList
=
GetTypeInfoList
(
assemblyPath
);
var
assemblyInfoList
=
new
List
<
AssemblyInfo
>();
var
partitionList
=
new
List
<
Partition
>();
AssemblyInfoBuilder
.
Build
(
assemblyPath
,
_methodLimit
,
_options
.
Us
eHtml
,
typeInfoList
,
out
partitionList
,
out
assemblyInfoList
);
AssemblyInfoBuilder
.
Build
(
assemblyPath
,
_methodLimit
,
_options
.
Includ
eHtml
,
typeInfoList
,
out
partitionList
,
out
assemblyInfoList
);
// If the scheduling didn't actually produce multiple partition then send back an unpartitioned
// representation.
...
...
@@ -233,7 +231,7 @@ public IEnumerable<AssemblyInfo> Schedule(string assemblyPath, bool force = fals
public
AssemblyInfo
CreateAssemblyInfo
(
string
assemblyPath
)
{
return
new
AssemblyInfo
(
assemblyPath
,
_options
.
TargetFrameworkMoniker
,
_options
.
Test64
?
"x64"
:
"x86"
,
_options
.
Us
eHtml
);
return
new
AssemblyInfo
(
assemblyPath
,
_options
.
TargetFrameworkMoniker
,
_options
.
Test64
?
"x64"
:
"x86"
,
_options
.
Includ
eHtml
);
}
private
static
List
<
TypeInfo
>
GetTypeInfoList
(
string
assemblyPath
)
...
...
src/Tools/Source/RunTests/ITestExecutor.cs
浏览文件 @
6988e40f
...
...
@@ -15,18 +15,18 @@ namespace RunTests
internal
string
OutputDirectory
{
get
;
}
internal
string
Trait
{
get
;
}
internal
string
NoTrait
{
get
;
}
internal
bool
Us
eHtml
{
get
;
}
internal
bool
Includ
eHtml
{
get
;
}
internal
bool
Test64
{
get
;
}
internal
bool
TestVsi
{
get
;
}
internal
TestExecutionOptions
(
string
xunitPath
,
ProcDumpInfo
?
procDumpInfo
,
string
outputDirectory
,
string
trait
,
string
noTrait
,
bool
us
eHtml
,
bool
test64
,
bool
testVsi
)
internal
TestExecutionOptions
(
string
xunitPath
,
ProcDumpInfo
?
procDumpInfo
,
string
outputDirectory
,
string
trait
,
string
noTrait
,
bool
includ
eHtml
,
bool
test64
,
bool
testVsi
)
{
XunitPath
=
xunitPath
;
ProcDumpInfo
=
procDumpInfo
;
OutputDirectory
=
outputDirectory
;
Trait
=
trait
;
NoTrait
=
noTrait
;
UseHtml
=
us
eHtml
;
IncludeHtml
=
includ
eHtml
;
Test64
=
test64
;
TestVsi
=
testVsi
;
}
...
...
src/Tools/Source/RunTests/Options.cs
浏览文件 @
6988e40f
...
...
@@ -23,7 +23,7 @@ internal class Options
/// <summary>
/// Use HTML output files.
/// </summary>
public
bool
Us
eHtml
{
get
;
set
;
}
public
bool
Includ
eHtml
{
get
;
set
;
}
/// <summary>
/// Use the 64 bit test runner.
...
...
@@ -119,7 +119,7 @@ bool isOption(string argument, string optionName, out string value)
return
false
;
}
var
opt
=
new
Options
{
XunitPath
=
args
[
0
],
Us
eHtml
=
true
,
TestResultXmlOutputDirectory
=
Path
.
Combine
(
Directory
.
GetCurrentDirectory
(),
"TestResults"
)
};
var
opt
=
new
Options
{
XunitPath
=
args
[
0
],
Includ
eHtml
=
true
,
TestResultXmlOutputDirectory
=
Path
.
Combine
(
Directory
.
GetCurrentDirectory
(),
"TestResults"
)
};
var
index
=
1
;
var
allGood
=
true
;
while
(
index
<
args
.
Length
)
...
...
@@ -137,7 +137,7 @@ bool isOption(string argument, string optionName, out string value)
}
else
if
(
comparer
.
Equals
(
current
,
"-xml"
))
{
opt
.
Us
eHtml
=
false
;
opt
.
Includ
eHtml
=
false
;
index
++;
}
else
if
(
isOption
(
current
,
"-tfm"
,
out
string
targetFrameworkMoniker
))
...
...
src/Tools/Source/RunTests/ProcessTestExecutor.cs
浏览文件 @
6988e40f
...
...
@@ -32,11 +32,17 @@ public string GetCommandLineArguments(AssemblyInfo assemblyInfo)
{
var
assemblyName
=
Path
.
GetFileName
(
assemblyInfo
.
AssemblyPath
);
var
resultsFilePath
=
GetResultsFilePath
(
assemblyInfo
);
var
xmlResultsFilePath
=
Path
.
ChangeExtension
(
resultsFilePath
,
".xml"
);
var
htmlResultsFilePath
=
Path
.
ChangeExtension
(
resultsFilePath
,
".html"
);
var
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"""{0}"""
,
assemblyInfo
.
AssemblyPath
);
builder
.
AppendFormat
(
@" {0}"
,
assemblyInfo
.
ExtraArguments
);
builder
.
AppendFormat
(
@" -{0} ""{1}"""
,
Options
.
UseHtml
?
"html"
:
"xml"
,
resultsFilePath
);
builder
.
AppendFormat
(
$@" -xml ""
{
xmlResultsFilePath
}
"""
);
if
(
Options
.
IncludeHtml
)
builder
.
AppendFormat
(
$@" -html ""
{
htmlResultsFilePath
}
"""
);
builder
.
Append
(
" -noshadow -verbose"
);
if
(!
string
.
IsNullOrWhiteSpace
(
Options
.
Trait
))
...
...
@@ -70,7 +76,7 @@ public async Task<TestResult> RunTestAsync(AssemblyInfo assemblyInfo, Cancellati
var
result
=
await
RunTestAsyncInternal
(
assemblyInfo
,
retry
:
false
,
cancellationToken
);
// For integration tests (TestVsi), we make one more attempt to re-run failed tests.
if
(
Options
.
TestVsi
&&
!
Options
.
Us
eHtml
&&
!
result
.
Succeeded
)
if
(
Options
.
TestVsi
&&
!
Options
.
Includ
eHtml
&&
!
result
.
Succeeded
)
{
return
await
RunTestAsyncInternal
(
assemblyInfo
,
retry
:
true
,
cancellationToken
);
}
...
...
src/Tools/Source/RunTests/Program.cs
浏览文件 @
6988e40f
...
...
@@ -328,7 +328,7 @@ private static ProcessTestExecutor CreateTestExecutor(Options options)
outputDirectory
:
options
.
TestResultXmlOutputDirectory
,
trait
:
options
.
Trait
,
noTrait
:
options
.
NoTrait
,
useHtml
:
options
.
Us
eHtml
,
includeHtml
:
options
.
Includ
eHtml
,
test64
:
options
.
Test64
,
testVsi
:
options
.
TestVsi
);
return
new
ProcessTestExecutor
(
testExecutionOptions
);
...
...
src/Tools/Source/RunTests/TestRunner.cs
浏览文件 @
6988e40f
...
...
@@ -175,7 +175,7 @@ private void PrintFailedTestResult(TestResult testResult)
}
// If the results are html, use Process.Start to open in the browser.
if
(
_options
.
Us
eHtml
&&
!
string
.
IsNullOrEmpty
(
testResult
.
ResultsFilePath
))
if
(
_options
.
Includ
eHtml
&&
!
string
.
IsNullOrEmpty
(
testResult
.
ResultsFilePath
))
{
Process
.
Start
(
testResult
.
ResultsFilePath
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录