Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
c9904f95
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,发现更多精彩内容 >>
未验证
提交
c9904f95
编写于
2月 18, 2019
作者:
J
Jared Parsons
提交者:
GitHub
2月 18, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #33474 from jaredpar/fix-space-p4
Ensure pipename argument quoted
上级
a2d6035b
aaed7b57
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
66 addition
and
3 deletion
+66
-3
src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
...mpilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
+34
-0
src/Compilers/Shared/BuildServerConnection.cs
src/Compilers/Shared/BuildServerConnection.cs
+26
-3
src/Test/Utilities/Portable/Assert/ConditionalFactAttribute.cs
...est/Utilities/Portable/Assert/ConditionalFactAttribute.cs
+6
-0
未找到文件。
src/Compilers/Server/VBCSCompilerTests/CompilerServerApiTest.cs
浏览文件 @
c9904f95
...
...
@@ -542,5 +542,39 @@ public async Task IncorrectServerHashReturnsIncorrectHashResponse()
Assert
.
Equal
(
BuildResponse
.
ResponseType
.
IncorrectHash
,
buildResponse
.
Type
);
}
}
[
ConditionalFact
(
typeof
(
WindowsDesktopOnly
))]
[
WorkItem
(
33452
,
"https://github.com/dotnet/roslyn/issues/33452"
)]
public
void
QuotePipeName_Desktop
()
{
var
serverInfo
=
BuildServerConnection
.
GetServerProcessInfo
(
@"q:\tools"
,
"name with space"
);
Assert
.
Equal
(
@"q:\tools\VBCSCompiler.exe"
,
serverInfo
.
processFilePath
);
Assert
.
Equal
(
@"q:\tools\VBCSCompiler.exe"
,
serverInfo
.
toolFilePath
);
Assert
.
Equal
(
@"""-pipename:name with space"""
,
serverInfo
.
commandLineArguments
);
}
[
ConditionalFact
(
typeof
(
CoreClrOnly
))]
[
WorkItem
(
33452
,
"https://github.com/dotnet/roslyn/issues/33452"
)]
public
void
QuotePipeName_CoreClr
()
{
var
toolDir
=
ExecutionConditionUtil
.
IsWindows
?
@"q:\tools"
:
"/tools"
;
var
serverInfo
=
BuildServerConnection
.
GetServerProcessInfo
(
toolDir
,
"name with space"
);
var
vbcsFilePath
=
Path
.
Combine
(
toolDir
,
"VBCSCompiler.dll"
);
Assert
.
Equal
(
vbcsFilePath
,
serverInfo
.
toolFilePath
);
Assert
.
Equal
(
$@"exec ""
{
vbcsFilePath
}
"" ""-pipename:name with space"""
,
serverInfo
.
commandLineArguments
);
}
[
Theory
]
[
InlineData
(
@"name with space.T.basename"
,
"name with space"
,
true
,
"basename"
)]
[
InlineData
(
@"ha_ha.T.basename"
,
@"ha""ha"
,
true
,
"basename"
)]
[
InlineData
(
@"jared.T.ha_ha"
,
@"jared"
,
true
,
@"ha""ha"
)]
[
InlineData
(
@"jared.F.ha_ha"
,
@"jared"
,
false
,
@"ha""ha"
)]
[
InlineData
(
@"jared.F.ha_ha"
,
@"jared"
,
false
,
@"ha\ha"
)]
public
void
GetPipeNameCore
(
string
expectedName
,
string
userName
,
bool
isAdmin
,
string
basePipeName
)
{
Assert
.
Equal
(
expectedName
,
BuildServerConnection
.
GetPipeNameCore
(
userName
,
isAdmin
,
basePipeName
));
}
}
}
src/Compilers/Shared/BuildServerConnection.cs
浏览文件 @
c9904f95
...
...
@@ -378,10 +378,16 @@ internal static bool IsCompilerServerSupported(string tempPath)
}
}
internal
static
bool
TryCreateServerCore
(
string
clientDir
,
string
pipeName
)
internal
static
(
string
processFilePath
,
string
commandLineArguments
,
string
toolFilePath
)
GetServerProcessInfo
(
string
clientDir
,
string
pipeName
)
{
var
serverPathWithoutExtension
=
Path
.
Combine
(
clientDir
,
"VBCSCompiler"
);
var
serverInfo
=
RuntimeHostInfo
.
GetProcessInfo
(
serverPathWithoutExtension
,
$"-pipename:
{
pipeName
}
"
);
var
commandLineArgs
=
$@"""-pipename:
{
pipeName
}
"""
;
return
RuntimeHostInfo
.
GetProcessInfo
(
serverPathWithoutExtension
,
commandLineArgs
);
}
internal
static
bool
TryCreateServerCore
(
string
clientDir
,
string
pipeName
)
{
var
serverInfo
=
GetServerProcessInfo
(
clientDir
,
pipeName
);
if
(!
File
.
Exists
(
serverInfo
.
toolFilePath
))
{
...
...
@@ -480,7 +486,24 @@ internal static string GetPipeNameForPathOpt(string compilerExeDirectory)
return
null
;
}
return
$"
{
userName
}
.
{(
isAdmin
?
'T'
:
'F'
)}
.
{
basePipeName
}
"
;
return
GetPipeNameCore
(
userName
,
isAdmin
,
basePipeName
);
}
internal
static
string
GetPipeNameCore
(
string
userName
,
bool
isAdmin
,
string
basePipeName
)
{
var
pipeName
=
$"
{
userName
}
.
{(
isAdmin
?
'T'
:
'F'
)}
.
{
basePipeName
}
"
;
// The pipe name is passed between processes as a command line argument as a
// quoted value. Unfortunately we can't use ProcessStartInfo.ArgumentList as
// we still target net472 (API only available on CoreClr + netstandard). To
// make the problem approachable we remove the troublesome characters.
//
// This does mean if two users on the same machine are building simultaneously
// and the user names differ only be a " or / and a _ then there will be a
// conflict. That seems rather obscure though.
return
pipeName
.
Replace
(
'"'
,
'_'
)
.
Replace
(
'\\'
,
'_'
);
}
/// <summary>
...
...
src/Test/Utilities/Portable/Assert/ConditionalFactAttribute.cs
浏览文件 @
c9904f95
...
...
@@ -225,6 +225,12 @@ public class ClrOnly : ExecutionCondition
public
override
string
SkipReason
=>
"Test not supported on Mono"
;
}
public
class
CoreClrOnly
:
ExecutionCondition
{
public
override
bool
ShouldSkip
=>
!
ExecutionConditionUtil
.
IsCoreClr
;
public
override
string
SkipReason
=>
"Test only supported on CoreClr"
;
}
public
class
DesktopOnly
:
ExecutionCondition
{
public
override
bool
ShouldSkip
=>
!
ExecutionConditionUtil
.
IsDesktop
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录