Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
63666416
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,发现更多精彩内容 >>
未验证
提交
63666416
编写于
3月 11, 2019
作者:
J
Jared Parsons
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tune tolerance levels
上级
14cfe689
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
60 addition
and
40 deletion
+60
-40
src/Compilers/CSharp/Test/Emit/Emit/EndToEndTests.cs
src/Compilers/CSharp/Test/Emit/Emit/EndToEndTests.cs
+32
-39
src/Test/Utilities/Portable/Assert/ConditionalFactAttribute.cs
...est/Utilities/Portable/Assert/ConditionalFactAttribute.cs
+28
-1
未找到文件。
src/Compilers/CSharp/Test/Emit/Emit/EndToEndTests.cs
浏览文件 @
63666416
...
...
@@ -14,14 +14,6 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Emit
{
public
class
EndToEndTests
:
EmitMetadataTestBase
{
#if DEBUG
public
static
bool
IsDebug
=>
true
;
#else
public
static
bool
IsDebug
=>
false
;
#endif
/// <summary>
/// These tests are very sensitive to stack size hence we use a fresh thread to ensure there
/// is a consistent stack size for them to execute in.
...
...
@@ -57,26 +49,14 @@ private static void RunInThread(Action action)
[
Fact
]
public
void
OverflowOnFluentCall
()
{
int
numberFluentCalls
=
0
;
// TODO: Number of frames was reduced by 50 to pass tests. We need to return to original counts after https://github.com/dotnet/roslyn/issues/25603
// is fixed to determine the bug here
switch
(
IntPtr
.
Size
*
8
)
int
numberFluentCalls
=
(
ExecutionConditionUtil
.
Architecture
,
ExecutionConditionUtil
.
Configuration
)
switch
{
case
32
when
IsDebug
:
numberFluentCalls
=
510
;
break
;
case
32
when
!
IsDebug
:
numberFluentCalls
=
1350
;
break
;
case
64
when
IsDebug
:
numberFluentCalls
=
225
;
break
;
case
64
when
!
IsDebug
:
numberFluentCalls
=
620
;
break
;
default
:
throw
new
Exception
(
$"unexpected pointer size
{
IntPtr
.
Size
}
"
);
}
(
ExecutionArchitecture
.
x86
,
ExecutionConfiguration
.
Debug
)
=>
510
,
(
ExecutionArchitecture
.
x86
,
ExecutionConfiguration
.
Release
)
=>
1350
,
(
ExecutionArchitecture
.
x64
,
ExecutionConfiguration
.
Debug
)
=>
225
,
(
ExecutionArchitecture
.
x64
,
ExecutionConfiguration
.
Release
)
=>
620
,
_
=>
throw
new
Exception
(
$"Unexpected configuration
{
ExecutionConditionUtil
.
Architecture
}
{
ExecutionConditionUtil
.
Configuration
}
"
)
};
// <path>\xunit.console.exe "<path>\CSharpCompilerEmitTest\Roslyn.Compilers.CSharp.Emit.UnitTests.dll" -noshadow -verbose -class "Microsoft.CodeAnalysis.CSharp.UnitTests.Emit.EndToEndTests"
// <path>\xunit.console.x86.exe "<path>\CSharpCompilerEmitTest\Roslyn.Compilers.CSharp.Emit.UnitTests.dll" -noshadow -verbose -class "Microsoft.CodeAnalysis.CSharp.UnitTests.Emit.EndToEndTests"
...
...
@@ -122,22 +102,35 @@ void tryCompileDeepFluentCalls(int depth)
[
WorkItem
(
33909
,
"https://github.com/dotnet/roslyn/issues/33909"
)]
public
void
DeeplyNestedGeneric
()
{
int
nestingLevel
=
(
IntPtr
.
Size
*
8
)
switch
// The actual tolerance level of the compiler for nested generics is in excess of 1,000
// members. The problem is that the time it takes to compute that is on the order of
// tens of minutes which makes it impractical as a unit test. Instead for release builds
// we simply ensure that a reasonable tolerance level is supported.
//
// This does mean we don't get the full regression testing for release builds. But our
// debug builds can be tested to their full tolerance hence they will catch any regressions
// in this area.
const
int
minimumReleaseTolerance
=
550
;
int
nestingLevel
=
(
ExecutionConditionUtil
.
Architecture
,
ExecutionConditionUtil
.
Configuration
)
switch
{
32
when
IsDebug
=>
100
,
32
when
!
IsDebug
=>
100
,
64
when
IsDebug
=>
100
,
64
when
!
IsDebug
=>
100
,
_
=>
throw
new
Exception
(
$"unexpected pointer size
{
IntPtr
.
Size
}
"
)
_
when
ExecutionConditionUtil
.
IsCoreClrUnix
=>
minimumReleaseTolerance
,
_
when
ExecutionConditionUtil
.
IsMonoDesktop
=>
minimumReleaseTolerance
,
(
ExecutionArchitecture
.
x86
,
ExecutionConfiguration
.
Debug
)
=>
270
,
(
ExecutionArchitecture
.
x86
,
ExecutionConfiguration
.
Release
)
=>
minimumReleaseTolerance
,
(
ExecutionArchitecture
.
x64
,
ExecutionConfiguration
.
Debug
)
=>
170
,
(
ExecutionArchitecture
.
x64
,
ExecutionConfiguration
.
Release
)
=>
minimumReleaseTolerance
,
_
=>
throw
new
Exception
(
$"Unexpected configuration
{
ExecutionConditionUtil
.
Architecture
}
{
ExecutionConditionUtil
.
Configuration
}
"
)
};
// Un-comment loop below and use above commands to figure out the new limits
Console
.
WriteLine
(
$"
{
IsDebug
}
{
IntPtr
.
Size
}
"
);
for
(
int
i
=
nestingLevel
;
i
<
int
.
MaxValue
;
i
=
i
+
10
)
{
Console
.
WriteLine
(
$"Depth:
{
i
}
"
);
runDeeplyNestedGenericTest
(
i
);
}
// for (int i = nestingLevel; i < int.MaxValue; i = i + 10)
// {
// var start = DateTime.UtcNow;
// Console.Write($"Depth: {i}");
// runDeeplyNestedGenericTest(i);
// Console.WriteLine($" - {DateTime.UtcNow - start}");
// }
runDeeplyNestedGenericTest
(
nestingLevel
);
void
runDeeplyNestedGenericTest
(
int
nestingLevel
)
...
...
src/Test/Utilities/Portable/Assert/ConditionalFactAttribute.cs
浏览文件 @
63666416
...
...
@@ -135,6 +135,21 @@ public abstract class ExecutionCondition
public
static
class
ExecutionConditionUtil
{
public
static
ExecutionArchitecture
Architecture
=>
(
IntPtr
.
Size
)
switch
{
4
=>
ExecutionArchitecture
.
x86
,
8
=>
ExecutionArchitecture
.
x64
,
_
=>
throw
new
InvalidOperationException
(
$"Unrecognized pointer size
{
IntPtr
.
Size
}
"
)
};
public
static
ExecutionConfiguration
Configuration
=>
#if DEBUG
ExecutionConfiguration
.
Debug
;
#elif RELEASE
ExecutionConfiguration
.
Release
;
#else
#error Unsupported Configuration
#endif
public
static
bool
IsWindows
=>
Path
.
DirectorySeparatorChar
==
'\\'
;
public
static
bool
IsUnix
=>
!
IsWindows
;
public
static
bool
IsDesktop
=>
RuntimeUtilities
.
IsDesktopRuntime
;
...
...
@@ -144,9 +159,21 @@ public static class ExecutionConditionUtil
public
static
bool
IsCoreClrUnix
=>
IsCoreClr
&&
IsUnix
;
}
public
enum
ExecutionArchitecture
{
x86
,
x64
,
}
public
enum
ExecutionConfiguration
{
Debug
,
Release
,
}
public
class
x86
:
ExecutionCondition
{
public
override
bool
ShouldSkip
=>
IntPtr
.
Size
!=
4
;
public
override
bool
ShouldSkip
=>
ExecutionConditionUtil
.
Architecture
!=
ExecutionArchitecture
.
x86
;
public
override
string
SkipReason
=>
"Target platform is not x86"
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录