提交 ab0b36d3 编写于 作者: C CyrusNajmabadi

Merge remote-tracking branch 'upstream/master' into patternMatchingCheck

......@@ -7,10 +7,7 @@
|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|
|**master**|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_debug_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_debug_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_debug_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_debug_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_release_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_release_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_release_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_release_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_determinism/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_determinism/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/master/windows_debug_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_debug_vs-integration/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/master/windows_release_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/windows_release_vs-integration/)|
|**dev15.0.x**|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_debug_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_debug_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_debug_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_debug_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_release_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_release_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_release_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_release_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_determinism/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_determinism/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev15.0.x/windows_debug_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_debug_vs-integration/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev15.0.x/windows_release_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/windows_release_vs-integration/)|
|**dev15.1.x**|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_debug_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_debug_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_debug_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_debug_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_release_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_release_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_release_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_release_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_determinism/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_determinism/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev15.1.x/windows_debug_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_debug_vs-integration/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev15.1.x/windows_release_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/windows_release_vs-integration/)|
|**dev15.2.x**|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_debug_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_debug_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_debug_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_debug_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_release_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_release_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_release_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_release_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_determinism/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_determinism/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev15.2.x/windows_debug_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_debug_vs-integration/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev15.2.x/windows_release_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/windows_release_vs-integration/)|
|**dev15.3.x**|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_debug_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_debug_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_debug_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_debug_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_release_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_release_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_release_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_release_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_determinism/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_determinism/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev15.3.x/windows_debug_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_debug_vs-integration/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev15.3.x/windows_release_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/windows_release_vs-integration/)|
|**dev15.6**|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_debug_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_debug_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_debug_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_debug_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_release_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_release_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_release_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_release_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_determinism/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_determinism/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev15.6/windows_debug_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_debug_vs-integration/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev15.6/windows_release_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/windows_release_vs-integration/)|
|**dev16**|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_debug_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_debug_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_debug_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_debug_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_release_unit32/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_release_unit32/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_release_unit64/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_release_unit64/)|[![Build Status](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_determinism/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_determinism/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev16/windows_debug_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_debug_vs-integration/)|[![Build Status](https://ci.dot.net/buildStatus/icon?job=dotnet_roslyn/dev16/windows_release_vs-integration)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/windows_release_vs-integration/)|
### Linux/Mac - Unit Tests
......@@ -18,10 +15,7 @@
|:--:|:--:|:--:|:--:|
|**master**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/master/job/ubuntu_14_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/ubuntu_14_debug/)|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/master/job/ubuntu_16_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/ubuntu_16_debug/)|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/master/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/mac_debug/)|
|**dev15.0.x**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/linux_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/linux_debug/)||[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/mac_debug/)|
|**dev15.1.x**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/linux_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/linux_debug/)||[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.1.x/job/mac_debug/)|
|**dev15.2.x**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/linux_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/linux_debug/)||[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.2.x/job/mac_debug/)|
|**dev15.3.x**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/linux_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/linux_debug/)||[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/mac_debug/)|
|**dev15.6**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/linux_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/linux_debug/)||[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.6/job/mac_debug/)|
|**dev16**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/ubuntu_14_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/ubuntu_14_debug/)|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/ubuntu_16_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/ubuntu_16_debug/)|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/mac_debug/)|
[//]: # (End current test results)
......
......@@ -7,6 +7,7 @@
<XUnitTestResultsDirectory>$(OutDir)\xUnitResults</XUnitTestResultsDirectory>
<XUnitArguments>"$(OutDir)\$(AssemblyName).dll" -html "$(XUnitTestResultsDirectory)\$(AssemblyName).html" -noshadow</XUnitArguments>
<!-- These properties are ignored by CPS projects, which use launchSettings.json instead. -->
<StartAction Condition="'$(StartActions)' == ''">Program</StartAction>
<StartProgram Condition="'$(StartProgram)' == ''">$(XUnitPath)</StartProgram>
<StartArguments Condition="'$(StartArguments)' == ''">$(XUnitArguments)</StartArguments>
......
......@@ -262,8 +262,9 @@ function Deploy-VsixViaTool() {
$both = Get-VisualStudioDirAndId
$vsDir = $both[0].Trim("\")
$vsId = $both[1]
$hive = "RoslynDev"
Write-Host "Using VS Instance $vsId at `"$vsDir`""
$baseArgs = "/rootSuffix:RoslynDev /vsInstallDir:`"$vsDir`""
$baseArgs = "/rootSuffix:$hive /vsInstallDir:`"$vsDir`""
$all = @(
"Vsix\CompilerExtension\Roslyn.Compilers.Extension.vsix",
"Vsix\VisualStudioSetup\Roslyn.VisualStudio.Setup.vsix",
......@@ -275,24 +276,18 @@ function Deploy-VsixViaTool() {
Write-Host "Uninstalling old Roslyn VSIX"
# Reverse the extension list so we uninstall in the proper order so that dependencies line up
[array]::Reverse($all)
foreach ($e in $all)
{
$name = Split-Path -leaf $e
$filePath = Join-Path $configDir $e
$fullArg = "-u $baseArgs $filePath"
Write-Host "`tUninstalling $name"
Exec-Command $vsixExe $fullArg | Out-Host
# Actual uninstall is failing at the moment using the uninstall options. Temporarily using
# wildfire to uninstall our VSIX extensions
$extDir = Join-Path ${env:USERPROFILE} "AppData\Local\Microsoft\VisualStudio\15.0_$($vsid)$($hive)"
if (Test-Path $extDir) {
foreach ($dir in Get-ChildItem -Directory $extDir) {
$name = Split-Path -leaf $dir
Write-Host "`tUninstalling $name"
}
Remove-Item -re -fo $extDir
}
Write-Host "Installing all Roslyn VSIX"
# Reverse the extension list so we install in the proper order so that dependencies line up
# Note: Only required as long as we reverse the list for uninstall above
[array]::Reverse($all)
foreach ($e in $all) {
$name = Split-Path -leaf $e
$filePath = Join-Path $configDir $e
......@@ -338,13 +333,33 @@ function Redirect-Temp() {
${env:TMP} = $temp
}
function List-BuildProcesses() {
Write-Host "Listing running build processes..."
Get-Process -Name "msbuild" -ErrorAction SilentlyContinue | Out-Host
Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Out-Host
}
function List-VSProcesses() {
Write-Host "Listing running vs processes..."
Get-Process -Name "devenv" -ErrorAction SilentlyContinue | Out-Host
}
# Kill any instances VBCSCompiler.exe to release locked files, ignoring stderr if process is not open
# This prevents future CI runs from failing while trying to delete those files.
# Kill any instances of msbuild.exe to ensure that we never reuse nodes (e.g. if a non-roslyn CI run
# left some floating around).
function Stop-BuildProcesses() {
Get-Process msbuild -ErrorAction SilentlyContinue | kill
Get-Process vbcscompiler -ErrorAction SilentlyContinue | kill
Write-Host "Killing running build processes..."
Get-Process -Name "msbuild" -ErrorAction SilentlyContinue | Stop-Process
Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Stop-Process
}
# Kill any instances of devenv.exe to ensure VSIX install/uninstall works in future runs and to ensure
# that any locked files don't prevent future CI runs from failing.
# Also call Stop-BuildProcesses
function Stop-VSProcesses() {
Write-Host "Killing running vs processes..."
Get-Process -Name "devenv" -ErrorAction SilentlyContinue | Stop-Process
}
try {
......@@ -373,6 +388,8 @@ try {
Create-Directory $configDir
if ($cibuild) {
List-VSProcesses
List-BuildProcesses
Redirect-Temp
}
......@@ -425,7 +442,8 @@ catch {
}
finally {
Pop-Location
if ($cibuild) {
if ($cibuild) {
Stop-VSProcesses
Stop-BuildProcesses
}
}
[CmdletBinding(PositionalBinding=$false)]
param ( [string]$bootstrapDir = "",
[bool]$debugDeterminism = $false)
[switch]$debugDeterminism = $false)
Set-StrictMode -version 2.0
$ErrorActionPreference = "Stop"
......@@ -11,124 +11,137 @@ $ErrorActionPreference = "Stop"
# makes them non-deterministic.
$script:skipList = @()
# Holds the determinism data checked on every build.
$script:dataMap = @{}
# Location that deterministic error information should be written to.
[string]$script:errorDir = ""
[string]$script:errorDirLeft = ""
[string]$script:errorDirRight = ""
function Run-Build() {
param ( [string]$rootDir = $(throw "Need a root directory to build"),
[string]$pathMapBuildOption = "",
[switch]$restore = $false)
$sln = Join-Path $rootDir "Roslyn.sln"
$debugDir = Join-Path $rootDir "Binaries\Debug"
$objDir = Join-Path $rootDir "Binaries\Obj"
# Create directories that may or may not exist to make the script execution below
# clean in either case.
Create-Directory $debugDir
Create-Directory $objDir
function Run-Build([string]$rootDir, [string]$pathMapBuildOption, [switch]$restore = $false) {
Push-Location $rootDir
try {
# Clean out the previous run
Write-Host "Cleaning the Binaries"
Exec-Command $msbuild "/nologo /v:m /nodeReuse:false /t:clean $sln"
Exec-Command $msbuild "/nologo /v:m /nodeReuse:false /t:clean Roslyn.sln"
if ($restore) {
Write-Host "Restoring the packages"
Restore-Project -fileName $sln -nuget (Ensure-NuGet) -msbuildDir (Split-Path -parent $msbuild)
Restore-Project -fileName "Roslyn.sln" -nuget (Ensure-NuGet) -msbuildDir (Split-Path -parent $msbuild)
}
Write-Host "Building the Solution"
Exec-Command $msbuild "/nologo /v:m /nodeReuse:false /m /p:DebugDeterminism=true /p:BootstrapBuildPath=$script:bootstrapDir /p:Features=`"debug-determinism`" /p:UseRoslynAnalyzers=false $pathMapBuildOption $sln"
Exec-Command $msbuild "/nologo /v:m /nodeReuse:false /m /p:DebugDeterminism=true /p:BootstrapBuildPath=$script:bootstrapDir /p:Features=`"debug-determinism`" /p:UseRoslynAnalyzers=false $pathMapBuildOption Roslyn.sln"
}
finally {
Pop-Location
}
}
function Run-Analysis() {
param ( [string]$rootDir = $(throw "Need a root directory to build"),
[bool]$buildMap = $(throw "Whether to build the map or analyze it"),
[string]$pathMapBuildOption = "",
[switch]$restore = $false)
$debugDir = Join-Path $rootDir "Binaries\Debug"
$errorList = @()
$allGood = $true
Run-Build $rootDir $pathMapBuildOption -restore:$restore
function Get-ObjDir([string]$rootDir) {
return Join-Path $rootDir "Binaries\Obj"
}
Push-Location $debugDir
# 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 $objDir) {
$fileFullName = $item.FullName
$fileName = Split-Path -leaf $fileFullName
Write-Host "Testing the binaries"
foreach ($dll in gci -re -in *.dll,*.exe) {
$dllFullName = $dll.FullName
$dllId = $dllFullName.Substring($debugDir.Length)
$dllName = Split-Path -leaf $dllFullName
$dllHash = (get-filehash $dll -algorithm MD5).Hash
$keyFullName = $dllFullName + ".key"
$keyName = Split-Path -leaf $keyFullName
# Do not process binaries that have been explicitly skipped or do not have a key
# file. The lack of a key file means it's a binary that wasn't specifically
# built for that directory (dependency). Only need to check the binaries we are
# building.
if ($script:skipList.Contains($dllName) -or -not (test-path $keyFullName)) {
if ($skipList.Contains($fileName)) {
continue;
}
if ($buildMap) {
Write-Host "`tRecording $dllName = $dllHash"
$data = @{}
$data["Hash"] = $dllHash
$data["Content"] = [IO.File]::ReadAllBytes($dllFullName)
$data["Key"] = [IO.File]::ReadAllBytes($dllFullName + ".key")
$script:dataMap[$dllId] = $data
}
elseif (-not $script:dataMap.Contains($dllId)) {
Write-Host "Missing entry in map $dllId->$dllFullName"
$allGood = $false
}
else {
$data = $script:dataMap[$dllId]
$oldHash = $data.Hash
if ($oldHash -eq $dllHash) {
Write-Host "`tVerified $dllName"
}
else {
Write-Host "`tERROR! $dllName"
$allGood = $false
$errorList += $dllName
# Save out the original and baseline so Jenkins will archive them for investigation
[IO.File]::WriteAllBytes((Join-Path $script:errorDirLeft $dllName), $data.Content)
[IO.File]::WriteAllBytes((Join-Path $script:errorDirLeft $keyName), $data.Key)
cp $dllFullName (Join-Path $script:errorDirRight $dllName)
cp $keyFullName (Join-Path $script:errorDirRight $keyName)
}
}
$fileId = $fileFullName.Substring($objDir.Length).Replace("\", ".")
$fileHash = (Get-FileHash $fileFullName -algorithm MD5).Hash
$data = @{}
$data.Hash = $fileHash
$data.Content = [IO.File]::ReadAllBytes($fileFullName)
$data.FileId = $fileId
$data.FileName = $fileName
$data.FileFullName = $fileFullName
Write-Output $data
}
}
Pop-Location
# This will build up the map of all of the binaries and their respective hashes.
function Record-Binaries([string]$rootDir) {
Write-Host "Recording file hashes"
# During determinism debugging shutdown the compiler after every pass so we get a unique
# log directory.
if ($debugDeterminism) {
Get-Process VBCSCompiler -ErrorAction SilentlyContinue | kill
$map = @{ }
foreach ($fileData in Get-FilesToProcess $rootDir) {
Write-Host "`t$($fileData.FileName) = $($fileData.Hash)"
$map[$fileData.FileId] = $fileData
}
return $map
}
# This is a sanity check to ensure that we're actually putting the right entries into
# the core data map. Essentially to ensure things like if we change our directory layout
# that this test fails beacuse we didn't record the binaries we intended to record.
function Test-MapContents($dataMap) {
# Sanity check to ensure we didn't return a false positive because we failed
# to examine any binaries.
if ($script:dataMap.Count -lt 10) {
Write-Host "Found no binaries to process"
$allGood = $false
if ($dataMap.Count -lt 40) {
throw "Didn't find the expected count of binaries"
}
# Test for some well known binaries
$list = @(
"Microsoft.CodeAnalysis.dll",
"Microsoft.CodeAnalysis.CSharp.dll",
"Microsoft.CodeAnalysis.Workspaces.dll",
"Microsoft.VisualStudio.LanguageServices.Implementation.dll")
foreach ($fileName in $list) {
$found = $false
foreach ($value in $dataMap.Values) {
if ($value.FileName -eq $fileName) {
$found = $true
break;
}
}
if (-not $found) {
throw "Did not find the expected binary $fileName"
}
}
}
function Test-Build([string]$rootDir, $dataMap, [string]$pathMapBuildOption, [switch]$restore = $false) {
Run-Build $rootDir $pathMapBuildOption -restore:$restore
$errorList = @()
$allGood = $true
Write-Host "Testing the binaries"
foreach ($fileData in Get-FilesToProcess $rootDir) {
$fileId = $fileData.FileId
$fileName = $fileData.FileName
$fileFullName = $fileData.FileFullName
if (-not $dataMap.Contains($fileId)) {
Write-Host "ERROR! Missing entry in map $fileId->$fileFullName"
$allGood = $false
continue
}
$oldfileData = $datamap[$fileId]
if ($fileData.Hash -ne $oldFileData.Hash) {
Write-Host "`tERROR! $fileName contents don't match"
$allGood = $false
$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)
continue
}
Write-Host "`tVerified $fileName"
}
if (-not $allGood) {
......@@ -138,7 +151,7 @@ function Run-Analysis() {
}
Write-Host "Archiving failure information"
$zipFile = Join-Path $rootDir "Binaries\determinism.zip"
$zipFile = Join-Path $repoDir "Binaries\determinism.zip"
Add-Type -Assembly "System.IO.Compression.FileSystem";
[System.IO.Compression.ZipFile]::CreateFromDirectory($script:errorDir, $zipFile, "Fastest", $true);
......@@ -148,31 +161,32 @@ function Run-Analysis() {
}
function Run-Test() {
$origRootDir = Resolve-Path (Split-Path -parent (Split-Path -parent $PSScriptRoot))
$rootDir = $repoDir
# Ensure the error directory is written for all analysis to use.
$script:errorDir = Join-Path $origRootDir "Binaries\Determinism"
$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 initial build to populate all of the expected data.
Run-Analysis -rootDir $origRootDir -buildMap $true
# Run the initial build so that we can populate the maps
Run-Build $repoDir
$dataMap = Record-Binaries $repoDir
Test-MapContents $dataMap
# Run another build in same place and verify the build is identical.
Run-Analysis -rootDir $origRootDir -buildMap $false
# Run a test against the source in the same directory location
Test-Build -rootDir $repoDir -dataMap $dataMap
# 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.
$origBinDir = Join-Path $origRootDir "Binaries"
$altRootDir = Join-Path $origBinDir "q"
& robocopy $origRootDir $altRootDir /E /XD $origBinDir /XD ".git" /njh /njs /ndl /nc /ns /np /nfl
$pathMapBuildOption = "/p:PathMap=`"$altRootDir=$origRootDir`""
Run-Analysis -rootDir $altRootDir -buildMap $false -pathMapBuildOption $pathMapBuildOption -restore
Remove-Item -re -fo $altRootDir
$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
$pathMapBuildOption = "/p:PathMap=`"$altRootDir=$repoDir`""
Test-Build -rootDir $altRootDir -dataMap $dataMap -pathMapBuildOption $pathMapBuildOption -restore
}
try {
......@@ -188,12 +202,14 @@ try {
exit 0
}
catch {
Write-Host "Error: $($_.Exception.Message)"
Write-Host $_
Write-Host $_.Exception
Write-Host $_.ScriptStackTrace
exit 1
}
finally {
Write-Host "Stopping VBCSCompiler"
Get-Process VBCSCompiler -ErrorAction SilentlyContinue | kill
Get-Process VBCSCompiler -ErrorAction SilentlyContinue | Stop-Process
Write-Host "Stopped VBCSCompiler"
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles":
{
"CSharpCompilerSymbolTest":
{
"commandName": "Executable",
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
\ No newline at end of file
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
......@@ -20,9 +20,6 @@
<IncludeDebugSymbolsInLocalVSIXDeployment>true</IncludeDebugSymbolsInLocalVSIXDeployment>
<CopyBuildOutputToOutputDirectory>true</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>true</CopyOutputSymbolsToOutputDirectory>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix RoslynDev /log</StartArguments>
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
<MinimumVisualStudioVersion>$(VisualStudioVersion)</MinimumVisualStudioVersion>
<RoslynProjectType>Vsix</RoslynProjectType>
......
{
"profiles": {
"Visual Studio Extension": {
"executablePath": "$(DevEnvDir)devenv.exe",
"commandLineArgs": "/rootsuffix $(VSSDKTargetPlatformRegRootSuffix) /log"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"Visual Studio Extension": {
"executablePath": "$(DevEnvDir)devenv.exe",
"commandLineArgs": "/rootsuffix $(VSSDKTargetPlatformRegRootSuffix) /log"
}
}
}
......@@ -28,11 +28,6 @@
<SubType>Designer</SubType>
</None>
</ItemGroup>
<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix RoslynDev /log</StartArguments>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Compilers\Extension\CompilerExtension.csproj">
<Project>{43026D51-3083-4850-928D-07E1883D5B1A}</Project>
......
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
......@@ -15,9 +15,6 @@
<IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix RoslynDev /log</StartArguments>
<VSSDKTargetPlatformRegRootSuffix>RoslynDev</VSSDKTargetPlatformRegRootSuffix>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<MinimumVisualStudioVersion>$(VisualStudioVersion)</MinimumVisualStudioVersion>
......
{
"profiles": {
"Visual Studio Extension": {
"executablePath": "$(DevEnvDir)devenv.exe",
"commandLineArgs": "/rootsuffix $(VSSDKTargetPlatformRegRootSuffix) /log"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
......@@ -231,14 +231,35 @@ private static IEnumerable<ISetupInstance> EnumerateVisualStudioInstances()
private static ISetupInstance LocateVisualStudioInstance(ImmutableHashSet<string> requiredPackageIds)
{
var instances = EnumerateVisualStudioInstances().Where((instance) => instance.GetInstallationVersion().StartsWith(VsProductVersion));
var vsInstallDir = Environment.GetEnvironmentVariable("VSInstallDir");
var haveVsInstallDir = !string.IsNullOrEmpty(vsInstallDir);
if (haveVsInstallDir)
{
vsInstallDir = Path.GetFullPath(vsInstallDir);
Debug.WriteLine($"An environment variable named 'VSInstallDir' was found, adding this to the specified requirements. (VSInstallDir: {vsInstallDir})");
}
var instances = EnumerateVisualStudioInstances().Where((instance) => {
var isMatch = true;
{
isMatch &= instance.GetInstallationVersion().StartsWith(VsProductVersion);
if (haveVsInstallDir)
{
var installationPath = instance.GetInstallationPath();
isMatch &= installationPath.Equals(vsInstallDir, StringComparison.OrdinalIgnoreCase);
}
}
return isMatch;
});
var instanceFoundWithInvalidState = false;
foreach (ISetupInstance2 instance in instances)
{
var packages = instance.GetPackages()
.Where((package) => requiredPackageIds.Contains(package.GetId()));
.Where((package) => requiredPackageIds.Contains(package.GetId()));
if (packages.Count() != requiredPackageIds.Count())
{
......@@ -260,7 +281,7 @@ private static ISetupInstance LocateVisualStudioInstance(ImmutableHashSet<string
throw new Exception(instanceFoundWithInvalidState ?
"An instance matching the specified requirements was found but it was in an invalid state." :
"There were no instances of Visual Studio 15.0 or later found that match the specified requirements.");
"There were no instances of Visual Studio found that match the specified requirements.");
}
private static Process StartNewVisualStudioProcess(string installationPath)
......
{
"profiles": {
"Visual Studio Extension": {
"executablePath": "$(DevEnvDir)devenv.exe",
"commandLineArgs": "/rootsuffix $(VSSDKTargetPlatformRegRootSuffix) /log"
}
}
}
......@@ -27,11 +27,6 @@
<NgenArchitecture>All</NgenArchitecture>
<NgenPriority>3</NgenPriority>
</PropertyGroup>
<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix RoslynDev /log</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<ItemGroup>
......
{
"profiles": {
"Visual Studio Extension": {
"executablePath": "$(DevEnvDir)devenv.exe",
"commandLineArgs": "/rootsuffix $(VSSDKTargetPlatformRegRootSuffix) /log"
}
}
}
......@@ -95,11 +95,6 @@
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix RoslynDev /log</StartArguments>
</PropertyGroup>
<ItemGroup>
<Content Include="snapshotService.servicehub.service.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
......
{
"profiles": {
"Visual Studio Extension": {
"executablePath": "$(DevEnvDir)devenv.exe",
"commandLineArgs": "/rootsuffix $(VSSDKTargetPlatformRegRootSuffix) /log"
}
}
}
......@@ -233,11 +233,6 @@
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<PropertyGroup>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix RoslynDev /log</StartArguments>
</PropertyGroup>
<ItemGroup>
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
......
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
......@@ -55,7 +55,7 @@ public static async Task<Checksum> GetSourceSymbolsChecksumAsync(Project project
// Order the documents by FilePath. Default ordering in the RemoteWorkspace is
// to be ordered by Guid (which is not consistent across VS sessions).
var textChecksumsTasks = project.Documents.OrderBy(d => d.FilePath).Select(async d =>
var textChecksumsTasks = project.Documents.OrderBy(d => d.FilePath, StringComparer.Ordinal).Select(async d =>
{
var documentStateChecksum = await d.State.GetStateChecksumsAsync(cancellationToken).ConfigureAwait(false);
return documentStateChecksum.Text;
......
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
{
"profiles": {
"xUnit.net Console": {
"executablePath": "$(XUnitPath)",
"commandLineArgs": "$(XUnitArguments)"
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册