Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
22e20b55
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,发现更多精彩内容 >>
未验证
提交
22e20b55
编写于
7月 18, 2018
作者:
J
Jared Parsons
提交者:
GitHub
7月 18, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #28622 from jaredpar/fix-det
Misc infrastructure fixes
上级
e3ced36b
df17b01e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
81 addition
and
44 deletion
+81
-44
build/scripts/test-determinism.ps1
build/scripts/test-determinism.ps1
+79
-42
src/Compilers/Server/VBCSCompilerTests/DesktopBuildClientTests.cs
...ilers/Server/VBCSCompilerTests/DesktopBuildClientTests.cs
+2
-2
未找到文件。
build/scripts/test-determinism.ps1
浏览文件 @
22e20b55
####
#
# $bootstrapDir: directory containing the bootstrap compiler
# $release: whether to build a debug or release build
# $altRootDrive: the drive we build on (via subst) for verifying pathmap implementation
#
####
[
CmdletBinding
(
PositionalBinding
=
$false
)]
param
(
[
string
]
$bootstrapDir
=
""
,
[
switch
]
$debugDeterminism
=
$false
)
[
switch
]
$release
=
$false
,
[
string
]
$altRootDrive
=
"q:"
)
Set-StrictMode
-version
2.0
$Error
ActionPreference
=
"Stop"
...
...
@@ -12,26 +21,25 @@ $ErrorActionPreference = "Stop"
$
script
:
skipList
=
@()
# Location that deterministic error information should be written to.
[
string
]
$
script
:
errorDir
=
""
[
string
]
$
script
:
errorDirLeft
=
""
[
string
]
$
script
:
errorDirRight
=
""
[
string
]
$errorDir
=
""
[
string
]
$errorDirLeft
=
""
[
string
]
$errorDirRight
=
""
function
Run-Build
([
string
]
$rootDir
,
[
s
witch
]
$restore
=
$false
,
[
s
tring
]
$logFile
=
$null
)
{
function
Run-Build
([
string
]
$rootDir
,
[
string
]
$logFile
=
$null
)
{
Push-Location
$rootDir
try
{
# Clean out the previous run
Write-Host
"Cleaning the Binaries"
Exec-Console
$msbuild
"/nologo /v:m /nodeReuse:false /t:clean Roslyn.sln"
Remove-Item
-Recurse
(
Get-ConfigDir
$rootDir
)
Remove-Item
-Recurse
(
Get-ObjDir
$rootDir
)
if
(
$restore
)
{
Write-Host
"Restoring the packages"
Restore-Project
$dotnet
"Roslyn.sln"
}
Write-Host
"Restoring the packages"
Restore-Project
$dotnet
"Roslyn.sln"
$args
=
"/nologo /v:m /nodeReuse:false /m /p:DebugDeterminism=true /p:BootstrapBuildPath=
$
script
:
bootstrapDir
/p:Features=
`"
debug-determinism
`"
/p:UseRoslynAnalyzers=false /p:DeployExtension=false Roslyn.sln"
$args
=
"/nologo /v:m /nodeReuse:false /m /p:DebugDeterminism=true /p:
DeveloperBuild=false /p:
BootstrapBuildPath=
$
script
:
bootstrapDir
/p:Features=
`"
debug-determinism
`"
/p:UseRoslynAnalyzers=false /p:DeployExtension=false Roslyn.sln"
if
(
$logFile
-ne
$null
)
{
$logFile
=
Join-Path
$
binaries
Dir
$logFile
$logFile
=
Join-Path
$
log
Dir
$logFile
$args
+=
" /bl:
$logFile
"
}
...
...
@@ -47,27 +55,45 @@ function Get-ObjDir([string]$rootDir) {
return
Join-Path
$rootDir
"Binaries\Obj"
}
function
Get-ConfigDir
([
string
]
$rootDir
)
{
return
Join-Path
$rootDir
"Binaries\
$buildConfiguration
"
}
# Return all of the files that need to be processed for determinism under the given
# directory.
function
Get-FilesToProcess
([
string
]
$rootDir
)
{
$objDir
=
Get-ObjDir
$rootDir
foreach
(
$item
in
Get-ChildItem
-re
-in
*.
dll
,
*.
exe
,
*.
pdb
$objDir
)
{
$file
FullName
=
$item
.
FullName
$fileName
=
Split-Path
-leaf
$file
FullName
foreach
(
$item
in
Get-ChildItem
-re
-in
*.
dll
,
*.
exe
,
*.
pdb
,
*.
sourcelink
.
json
$objDir
)
{
$file
Path
=
$item
.
FullName
$fileName
=
Split-Path
-leaf
$file
Path
if
(
$skipList
.
Contains
(
$fileName
))
{
continue
;
}
$fileId
=
$file
FullName
.
Substring
(
$objDir
.
Length
)
.
Replace
(
"\"
,
"."
)
$fileHash
=
(
Get-FileHash
$file
FullName
-algorithm
MD5
)
.
Hash
$fileId
=
$file
Path
.
Substring
(
$objDir
.
Length
)
.
Replace
(
"\"
,
"."
)
$fileHash
=
(
Get-FileHash
$file
Path
-algorithm
MD5
)
.
Hash
$data
=
@{}
$data
.
Hash
=
$fileHash
$data
.
Content
=
[
IO.File
]::
ReadAllBytes
(
$file
FullName
)
$data
.
Content
=
[
IO.File
]::
ReadAllBytes
(
$file
Path
)
$data
.
FileId
=
$fileId
$data
.
FileName
=
$fileName
$data
.
FileFullName
=
$fileFullName
$data
.
FilePath
=
$filePath
$keyFilePath
=
$filePath
+
".key"
$keyFileName
=
Split-Path
-leaf
$keyFilePath
if
(
Test-Path
$keyFilePath
)
{
$data
.
KeyFileName
=
$keyFileName
$data
.
KeyFilePath
=
$keyFilePath
$data
.
KeyFileContent
=
[
IO.File
]::
ReadAllBytes
(
$keyFilePath
)
}
else
{
$data
.
KeyFileName
=
""
$data
.
KeyFilePath
=
""
$data
.
KeyFileContent
=
$null
}
Write-Output
$data
}
}
...
...
@@ -117,8 +143,8 @@ function Test-MapContents($dataMap) {
}
}
function
Test-Build
([
string
]
$rootDir
,
$dataMap
,
[
string
]
$logFile
,
[
switch
]
$restore
=
$false
)
{
Run-Build
$rootDir
-logFile
$logFile
-restore
:
$restore
function
Test-Build
([
string
]
$rootDir
,
$dataMap
,
[
string
]
$logFile
)
{
Run-Build
$rootDir
-logFile
$logFile
$errorList
=
@()
$allGood
=
$true
...
...
@@ -127,10 +153,10 @@ function Test-Build([string]$rootDir, $dataMap, [string]$logFile, [switch]$resto
foreach
(
$fileData
in
Get-FilesToProcess
$rootDir
)
{
$fileId
=
$fileData
.
FileId
$fileName
=
$fileData
.
FileName
$file
FullName
=
$fileData
.
FileFullName
$file
Path
=
$fileData
.
FilePath
if
(
-not
$dataMap
.
Contains
(
$fileId
))
{
Write-Host
"ERROR! Missing entry in map
$fileId
->
$file
FullName
"
Write-Host
"ERROR! Missing entry in map
$fileId
->
$file
Path
"
$allGood
=
$false
continue
}
...
...
@@ -142,8 +168,16 @@ function Test-Build([string]$rootDir, $dataMap, [string]$logFile, [switch]$resto
$errorList
+=
$fileName
# Save out the original and baseline so Jenkins will archive them for investigation
[
IO.File
]::
WriteAllBytes
((
Join-Path
$
script
:
errorDirLeft
$fileName
),
$oldFileData
.
Content
)
Copy-Item
$fileFullName
(
Join-Path
$
script
:
errorDirRight
$fileName
)
[
IO.File
]::
WriteAllBytes
((
Join-Path
$errorDirLeft
$fileName
),
$oldFileData
.
Content
)
Copy-Item
$filePath
(
Join-Path
$errorDirRight
$fileName
)
# Copy the key files if available too
$keyFileName
=
$oldFileData
.
KeyFileName
if
(
$keyFileName
-ne
""
)
{
[
IO.File
]::
WriteAllBytes
((
Join-Path
$errorDirLeft
$keyFileName
),
$oldFileData
.
KeyFileContent
)
Copy-Item
$fileData
.
KeyFilePath
(
Join-Path
$errorDirRight
$keyFileName
)
}
continue
}
...
...
@@ -157,7 +191,7 @@ function Test-Build([string]$rootDir, $dataMap, [string]$logFile, [switch]$resto
}
Write-Host
"Archiving failure information"
$zipFile
=
Join-Path
$
repoDir
"Binaries\
determinism.zip"
$zipFile
=
Join-Path
$
logDir
"
determinism.zip"
Add-Type
-Assembly
"System.IO.Compression.FileSystem"
;
[
System.IO.Compression.ZipFile
]::
CreateFromDirectory
(
$
script
:
errorDir
,
$zipFile
,
"Fastest"
,
$true
);
...
...
@@ -169,14 +203,6 @@ function Test-Build([string]$rootDir, $dataMap, [string]$logFile, [switch]$resto
function
Run-Test
()
{
$rootDir
=
$repoDir
# Ensure the error directory is written for all analysis to use.
$
script
:
errorDir
=
Join-Path
$repoDir
"Binaries\Determinism"
$
script
:
errorDirLeft
=
Join-Path
$
script
:
errorDir
"Left"
$
script
:
errorDirRight
=
Join-Path
$
script
:
errorDir
"Right"
Create-Directory
$
script
:
errorDir
Create-Directory
$
script
:
errorDirLeft
Create-Directory
$
script
:
errorDirRight
# Run the initial build so that we can populate the maps
Run-Build
$repoDir
-logFile
"initial.binlog"
$dataMap
=
Record-Binaries
$repoDir
...
...
@@ -188,19 +214,30 @@ function Run-Test() {
# Run another build in a different source location and verify that path mapping
# allows the build to be identical. To do this we'll copy the entire source
# tree under the Binaries\q directory and run a build from there.
$altRootDir
=
Join-Path
"
$repoDir
\Binaries"
"q"
Remove-Item
-re
-fo
$altRootDir
-ErrorAction
SilentlyContinue
&
robocopy
$repoDir
$altRootDir
/E
/XD
$binariesDir
/XD
".git"
/njh
/njs
/ndl
/nc
/ns
/np
/nfl
# Symlink the .git directory to make SourceLink think Binaries/q is the repo root:
&
cmd
/c
mklink
/d
(
Join-Path
$altRootDir
".git"
)
(
Join-Path
$repoDir
".git"
)
Test-Build
-rootDir
$altRootDir
-dataMap
$dataMap
-logFile
"test2.binlog"
-restore
Write-Host
"Building in a different directory"
Exec-Command
"subst"
"
$altRootDrive
$(
Split-Path
-parent
$repoDir
)
"
try {
$altRootDir
= Join-Path "
$
(
$altRootDrive
)
\"
(
Split-Path
-leaf
$repoDir
)
Test-Build
-rootDir
$altRootDir
-dataMap
$dataMap
-logFile
"test2.binlog"
}
finally
{
Exec-Command
"subst"
"
$altRootDrive
/d"
}
}
try
{
.
(
Join-Path
$PSScriptRoot
"build-utils.ps1"
)
# Create all of the logging directories
$buildConfiguration
=
if
(
$release
)
{
"Release"
}
else
{
"Debug"
}
$logDir
=
Join-Path
(
Get-ConfigDir
$repoDir
)
"Logs"
$errorDir
=
Join-Path
$binariesDir
"Determinism"
$errorDirLeft
=
Join-Path
$errorDir
"Left"
$errorDirRight
=
Join-Path
$errorDir
"Right"
Create-Directory
$logDir
Create-Directory
$errorDirLeft
Create-Directory
$errorDirRight
$dotnet
=
Ensure-DotnetSdk
$msbuild
=
Ensure-MSBuild
if
((
$bootstrapDir
-eq
""
)
-or
(
-not
([
IO.Path
]::
IsPathRooted
(
$
script
:
bootstrapDir
))))
{
...
...
src/Compilers/Server/VBCSCompilerTests/DesktopBuildClientTests.cs
浏览文件 @
22e20b55
...
...
@@ -16,6 +16,7 @@
using
System.Threading
;
using
System.IO.Pipes
;
using
System.Security.AccessControl
;
using
System.Security.Principal
;
namespace
Microsoft.CodeAnalysis.CompilerServer.UnitTests
{
...
...
@@ -154,8 +155,7 @@ public void TestMutexConstructorException()
{
Assert
.
True
(
createdNew
);
var
mutexSecurity
=
outer
.
GetAccessControl
();
var
user
=
Environment
.
UserDomainName
+
"\\"
+
Environment
.
UserName
;
mutexSecurity
.
AddAccessRule
(
new
MutexAccessRule
(
user
,
MutexRights
.
FullControl
,
AccessControlType
.
Deny
));
mutexSecurity
.
AddAccessRule
(
new
MutexAccessRule
(
WindowsIdentity
.
GetCurrent
().
Owner
,
MutexRights
.
FullControl
,
AccessControlType
.
Deny
));
outer
.
SetAccessControl
(
mutexSecurity
);
var
ranLocal
=
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录