Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
cc82704b
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,发现更多精彩内容 >>
提交
cc82704b
编写于
10月 15, 2015
作者:
T
Tanner Gooding
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updating TestRunner to sort unit test assemblies by size.
上级
972e7e1b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
30 deletion
+10
-30
netci.groovy
netci.groovy
+1
-1
src/Tools/Source/RunTests/Program.cs
src/Tools/Source/RunTests/Program.cs
+6
-20
src/Tools/Source/RunTests/TestRunner.cs
src/Tools/Source/RunTests/TestRunner.cs
+3
-9
未找到文件。
netci.groovy
浏览文件 @
cc82704b
...
@@ -71,7 +71,7 @@ static void addUnitPublisher(def myJob) {
...
@@ -71,7 +71,7 @@ static void addUnitPublisher(def myJob) {
'xunit'
(
'plugin'
:
'xunit@1.97'
)
{
'xunit'
(
'plugin'
:
'xunit@1.97'
)
{
'types'
{
'types'
{
'XUnitDotNetTestType'
{
'XUnitDotNetTestType'
{
'pattern'
(
'**/
*TestResults
.xml'
)
'pattern'
(
'**/
xUnitResults/*
.xml'
)
'skipNoTestFiles'
(
false
)
'skipNoTestFiles'
(
false
)
'failIfNotNew'
(
true
)
'failIfNotNew'
(
true
)
'deleteOutputFiles'
(
true
)
'deleteOutputFiles'
(
true
)
...
...
src/Tools/Source/RunTests/Program.cs
浏览文件 @
cc82704b
...
@@ -48,8 +48,8 @@ internal static int Main(string[] args)
...
@@ -48,8 +48,8 @@ internal static int Main(string[] args)
var
testRunner
=
new
TestRunner
(
xunit
,
useHtml
);
var
testRunner
=
new
TestRunner
(
xunit
,
useHtml
);
var
start
=
DateTime
.
Now
;
var
start
=
DateTime
.
Now
;
Console
.
WriteLine
(
"Running {0} tests"
,
list
.
Count
);
Console
.
WriteLine
(
"Running {0} tests"
,
list
.
Count
);
OrderAssemblyList
(
list
);
var
orderedList
=
OrderAssemblyList
(
list
);
var
result
=
testRunner
.
RunAllAsync
(
l
ist
,
cts
.
Token
).
Result
;
var
result
=
testRunner
.
RunAllAsync
(
orderedL
ist
,
cts
.
Token
).
Result
;
var
span
=
DateTime
.
Now
-
start
;
var
span
=
DateTime
.
Now
-
start
;
if
(!
result
)
if
(!
result
)
{
{
...
@@ -90,25 +90,11 @@ private static void ParseArgs(string[] args, ref int index, ref bool test64, ref
...
@@ -90,25 +90,11 @@ private static void ParseArgs(string[] args, ref int index, ref bool test64, ref
}
}
/// <summary>
/// <summary>
/// Order the assembly list so th
e known slower test begin running earlier
. This
/// Order the assembly list so th
at the largest assemblies come first
. This
///
should really be dynamically calculated and not hard coded like this
.
///
is not ideal as the largest assembly does not necessarily take the most time
.
/// </summary>
/// </summary>
/// <param name="list"></param>
/// <param name="list"></param>
private
static
void
OrderAssemblyList
(
List
<
string
>
list
)
private
static
IOrderedEnumerable
<
string
>
OrderAssemblyList
(
List
<
string
>
list
)
=>
{
list
.
OrderByDescending
((
assemblyName
)
=>
new
FileInfo
(
assemblyName
).
Length
);
var
regex
=
new
Regex
(
@"Roslyn.Services.Editor.(\w+).UnitTests"
,
RegexOptions
.
IgnoreCase
);
var
i
=
1
;
while
(
i
<
list
.
Count
)
{
var
cur
=
list
[
i
];
if
(
regex
.
IsMatch
(
cur
))
{
list
.
RemoveAt
(
i
);
list
.
Insert
(
0
,
cur
);
}
i
++;
}
}
}
}
}
}
src/Tools/Source/RunTests/TestRunner.cs
浏览文件 @
cc82704b
...
@@ -115,19 +115,13 @@ private void Print(List<TestResult> testResults)
...
@@ -115,19 +115,13 @@ private void Print(List<TestResult> testResults)
Console
.
WriteLine
(
"================"
);
Console
.
WriteLine
(
"================"
);
}
}
private
static
readonly
string
[]
UpgradedTests
=
new
string
[]
{
"Microsoft.DiaSymReader.PortablePdb.UnitTests.dll"
,
"Microsoft.CodeAnalysis.Scripting.VisualBasic.UnitTests.dll"
,
"Microsoft.CodeAnalysis.Scripting.CSharp.UnitTests.dll"
};
private
async
Task
<
TestResult
>
RunTest
(
string
assemblyPath
,
CancellationToken
cancellationToken
)
private
async
Task
<
TestResult
>
RunTest
(
string
assemblyPath
,
CancellationToken
cancellationToken
)
{
{
try
try
{
{
var
assemblyName
=
Path
.
GetFileName
(
assemblyPath
);
var
assemblyName
=
Path
.
GetFileName
(
assemblyPath
);
var
extension
=
_useHtml
?
"
.TestResults.html"
:
".TestResults.
xml"
;
var
extension
=
_useHtml
?
"
html"
:
"
xml"
;
var
resultsPath
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
assemblyPath
),
Path
.
ChangeExtension
(
assemblyName
,
extension
)
);
var
resultsPath
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
assemblyPath
),
"xUnitResults"
,
$"
{
assemblyName
}
.
{
extension
}
"
);
DeleteFile
(
resultsPath
);
DeleteFile
(
resultsPath
);
var
builder
=
new
StringBuilder
();
var
builder
=
new
StringBuilder
();
...
@@ -138,7 +132,7 @@ private async Task<TestResult> RunTest(string assemblyPath, CancellationToken ca
...
@@ -138,7 +132,7 @@ private async Task<TestResult> RunTest(string assemblyPath, CancellationToken ca
var
errorOutput
=
new
StringBuilder
();
var
errorOutput
=
new
StringBuilder
();
var
start
=
DateTime
.
UtcNow
;
var
start
=
DateTime
.
UtcNow
;
var
xunitPath
=
UpgradedTests
.
Contains
(
assemblyName
)
?
Path
.
Combine
(
$"
{
Path
.
GetDirectoryName
(
_xunitConsolePath
)}
"
,
@"..\..\..\xunit.runner.console\2.1.0\tools"
,
$"
{
Path
.
GetFileName
(
_xunitConsolePath
)}
"
)
:
_xunitConsolePath
;
var
xunitPath
=
_xunitConsolePath
;
var
processOutput
=
await
ProcessRunner
.
RunProcessAsync
(
var
processOutput
=
await
ProcessRunner
.
RunProcessAsync
(
xunitPath
,
xunitPath
,
builder
.
ToString
(),
builder
.
ToString
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录