Skip to content

Commit

Permalink
Backport correctness fixes from #54997
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich authored May 2, 2022
1 parent 09f0867 commit d5b10a6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<MicrosoftDiaSymReaderConverterXmlVersion>1.1.0-beta2-20115-01</MicrosoftDiaSymReaderConverterXmlVersion>
<MicrosoftDiaSymReaderNativeVersion>16.9.0-beta1.21055.5</MicrosoftDiaSymReaderNativeVersion>
<MicrosoftDiaSymReaderPortablePdbVersion>1.5.0</MicrosoftDiaSymReaderPortablePdbVersion>
<MicrosoftDotNetBuildTasksFeedVersion>6.0.0-beta.21230.2</MicrosoftDotNetBuildTasksFeedVersion>
<MicrosoftDotNetBuildTasksFeedVersion>6.0.0-beta.22218.4</MicrosoftDotNetBuildTasksFeedVersion>
<MicrosoftExtensionsLoggingVersion>5.0.0</MicrosoftExtensionsLoggingVersion>
<MicrosoftExtensionsLoggingConsoleVersion>5.0.0</MicrosoftExtensionsLoggingConsoleVersion>
<MicrosoftIdentityModelClientsActiveDirectoryVersion>3.13.8</MicrosoftIdentityModelClientsActiveDirectoryVersion>
Expand Down
12 changes: 6 additions & 6 deletions eng/test-build-correctness.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ try {

# Verify no PROTOTYPE marker left in main
if ($env:SYSTEM_PULLREQUEST_TARGETBRANCH -eq "main") {
Write-Host "Checking no PROTOTYPE markers in compiler source"
$prototypes = Get-ChildItem -Path src/Compilers/*.cs, src/Compilers/*.vb,src/Compilers/*.xml -Recurse | Select-String -Pattern 'PROTOTYPE' -CaseSensitive -SimpleMatch
Write-Host "Checking no PROTOTYPE markers in source"
$prototypes = Get-ChildItem -Path src, eng, scripts -Exclude *.dll,*.exe,*.pdb,*.xlf,test-build-correctness.ps1 -Recurse | Select-String -Pattern 'PROTOTYPE' -CaseSensitive -SimpleMatch
if ($prototypes) {
Write-Host "Found PROTOTYPE markers in compiler source:"
Write-Host "Found PROTOTYPE markers in source:"
Write-Host $prototypes
throw "PROTOTYPE markers disallowed in compiler source"
}
Expand All @@ -59,15 +59,15 @@ try {
# Verify the state of our various build artifacts
Write-Host "Running BuildBoss"
$buildBossPath = GetProjectOutputBinary "BuildBoss.exe"
Exec-Console $buildBossPath "-r `"$RepoRoot`" -c $configuration" -p Roslyn.sln
Exec-Console $buildBossPath "-r `"$RepoRoot/`" -c $configuration" -p Roslyn.sln
Write-Host ""

# Verify the state of our generated syntax files
Write-Host "Checking generated compiler files"
Exec-Block { & (Join-Path $PSScriptRoot "generate-compiler-code.ps1") -test -configuration:$configuration }
Exec-Console dotnet "format . --include-generated --include src/Compilers/CSharp/Portable/Generated/ src/Compilers/VisualBasic/Portable/Generated/ src/ExpressionEvaluator/VisualBasic/Source/ResultProvider/Generated/ --check -f"
Write-Host ""
Write-Host ""

exit 0
}
catch [exception] {
Expand Down
35 changes: 17 additions & 18 deletions eng/test-determinism.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if ($help) {
}

# List of binary names that should be skipped because they have a known issue that
# makes them non-deterministic.
# makes them non-deterministic.
$script:skipList = @(
# Added to work around https://github.com/dotnet/roslyn/issues/48417
"Microsoft.CodeAnalysis.EditorFeatures2.UnitTests.dll"
Expand Down Expand Up @@ -67,11 +67,11 @@ function Run-Build([string]$rootDir, [string]$logFileName) {
Stop-Processes
}

function Get-ObjDir([string]$rootDir) {
function Get-ObjDir([string]$rootDir) {
return Join-Path $rootDir "artifacts\obj"
}

function Get-BinDir([string]$rootDir) {
function Get-BinDir([string]$rootDir) {
return Join-Path $rootDir "artifacts\bin"
}

Expand All @@ -80,7 +80,7 @@ function Get-BinDir([string]$rootDir) {
function Get-FilesToProcess([string]$rootDir) {
$objDir = Get-ObjDir $rootDir
foreach ($item in Get-ChildItem -re -in *.dll,*.exe,*.pdb,*.sourcelink.json $objDir) {
$filePath = $item.FullName
$filePath = $item.FullName
$fileName = Split-Path -leaf $filePath
$relativeDirectory = Split-Path -parent $filePath
$relativeDirectory = $relativeDirectory.Substring($objDir.Length)
Expand All @@ -103,7 +103,7 @@ function Get-FilesToProcess([string]$rootDir) {

$keyFilePath = $filePath + ".key"
$keyFileName = Split-Path -leaf $keyFilePath
if (Test-Path $keyFilePath) {
if (Test-Path $keyFilePath) {
$data.KeyFileName = $keyFileName
$data.KeyFilePath = $keyFilePath
$data.KeyFileContent = [IO.File]::ReadAllBytes($keyFilePath)
Expand All @@ -124,7 +124,7 @@ function Record-Binaries([string]$rootDir) {
Write-Host "Recording file hashes"

$map = @{ }
foreach ($fileData in Get-FilesToProcess $rootDir) {
foreach ($fileData in Get-FilesToProcess $rootDir) {
Write-Host "`t$($fileData.FileId) = $($fileData.Hash)"
$map[$fileData.FileId] = $fileData
}
Expand All @@ -134,9 +134,9 @@ function Record-Binaries([string]$rootDir) {
}

# 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) {
# 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.
Expand All @@ -151,16 +151,16 @@ function Test-MapContents($dataMap) {
"Microsoft.CodeAnalysis.Workspaces.dll",
"Microsoft.VisualStudio.LanguageServices.Implementation.dll")

foreach ($fileName in $list) {
foreach ($fileName in $list) {
$found = $false
foreach ($value in $dataMap.Values) {
if ($value.FileName -eq $fileName) {
foreach ($value in $dataMap.Values) {
if ($value.FileName -eq $fileName) {
$found = $true
break;
}
}

if (-not $found) {
if (-not $found) {
throw "Did not find the expected binary $fileName"
}
}
Expand All @@ -187,7 +187,7 @@ function Test-Build([string]$rootDir, $dataMap, [string]$logFileName) {
}

$oldfileData = $datamap[$fileId]
if ($fileData.Hash -ne $oldFileData.Hash) {
if ($fileData.Hash -ne $oldFileData.Hash) {
Write-Host "`tERROR! $relativeDir\$fileName contents don't match"
$allGood = $false
$errorList += $fileName
Expand Down Expand Up @@ -242,13 +242,13 @@ function Run-Test() {
# Run a test against the source in the same directory location
Test-Build -rootDir $RepoRoot -dataMap $dataMap -logFileName "test1"

# 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
# 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 artifacts\q directory and run a build from there.
Write-Host "Building in a different directory"
Exec-Command "subst" "$altRootDrive $(Split-Path -parent $RepoRoot)"
try {
$altRootDir = Join-Path "$($altRootDrive)\" (Split-Path -leaf $RepoRoot)
$altRootDir = Join-Path (Join-Path "$($altRootDrive)\" (Split-Path -leaf $RepoRoot)) "\"
Test-Build -rootDir $altRootDir -dataMap $dataMap -logFileName "test2"
}
finally {
Expand Down Expand Up @@ -292,4 +292,3 @@ finally {
Get-Process VBCSCompiler -ErrorAction SilentlyContinue | Stop-Process
Write-Host "Stopped VBCSCompiler"
}

4 changes: 2 additions & 2 deletions eng/test-rebuild.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#
This script tests that Roslyn artifacts are rebuildable--i.e. that the source code and resources can be identified
This script tests that Roslyn artifacts are rebuildable--i.e. that the source code and resources can be identified
#>

[CmdletBinding(PositionalBinding=$false)]
Expand Down Expand Up @@ -63,7 +63,7 @@ try {
" --exclude net472\Zip\tools\vsixexpinstaller\VSIXExpInstaller.exe" +

" --debugPath `"$ArtifactsDir/BuildValidator`"" +
" --sourcePath `"$RepoRoot`"" +
" --sourcePath `"$RepoRoot/`"" +
" --referencesPath `"$ArtifactsDir/bin`"" +
" --referencesPath `"$dotnetInstallDir/packs`"")
Exec-Console "$ArtifactsDir/bin/BuildValidator/$configuration/net472/BuildValidator.exe" $rebuildArgs
Expand Down

0 comments on commit d5b10a6

Please sign in to comment.