From 99c0b270f29cb4085f573108bfe2520d560b4247 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 12 Jul 2021 17:07:29 -0700 Subject: [PATCH 01/21] Update build to use crossgen2 --- build.psm1 | 175 ++++++++++++++++++++++------------------------------- 1 file changed, 72 insertions(+), 103 deletions(-) diff --git a/build.psm1 b/build.psm1 index db3bdb5fae7..967b15ae5c6 100644 --- a/build.psm1 +++ b/build.psm1 @@ -124,7 +124,7 @@ function Get-EnvironmentInformation if ($environment.IsWindows) { $environment += @{'IsAdmin' = (New-Object Security.Principal.WindowsPrincipal ([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)} - $environment += @{'nugetPackagesRoot' = "${env:USERPROFILE}\.nuget\packages"} + $environment += @{'nugetPackagesRoot' = "${env:USERPROFILE}\.nuget\packages", "${env:NUGET_PACKAGES}"} } else { @@ -2323,78 +2323,80 @@ function Start-CrossGen { function New-CrossGenAssembly { param ( - [Parameter(Mandatory= $true)] + [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [String] + [String[]] $AssemblyPath, - [Parameter(Mandatory= $true)] - [ValidateNotNullOrEmpty()] - [String] - $CrossgenPath - ) - - $outputAssembly = $AssemblyPath.Replace(".dll", ".ni.dll") - $platformAssembliesPath = Split-Path $AssemblyPath -Parent - $crossgenFolder = Split-Path $CrossgenPath - $niAssemblyName = Split-Path $outputAssembly -Leaf - - try { - Push-Location $crossgenFolder - - # Generate the ngen assembly - Write-Verbose "Generating assembly $niAssemblyName" - Start-NativeExecution { - & $CrossgenPath /ReadyToRun /MissingDependenciesOK /in $AssemblyPath /out $outputAssembly /Platform_Assemblies_Paths $platformAssembliesPath - } | Write-Verbose - } finally { - Pop-Location - } - } - function New-CrossGenSymbol { - param ( - [Parameter(Mandatory= $true)] - [ValidateNotNullOrEmpty()] - [String] - $AssemblyPath, - [Parameter(Mandatory= $true)] + [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] - $CrossgenPath + $CrossgenPath, + + [Parameter(Mandatory = $true)] + [ValidateSet("alpine-x64", + "linux-arm", + "linux-arm64", + "linux-x64", + "osx-arm64", + "osx-x64", + "win-arm", + "win-arm64", + "win7-x64", + "win7-x86")] + [string] + $Runtime ) + $platformAssembliesPath = Split-Path $AssemblyPath[0] -Parent - $platformAssembliesPath = Split-Path $AssemblyPath -Parent - $crossgenFolder = Split-Path $CrossgenPath - - try { - Push-Location $crossgenFolder - - $symbolsPath = [System.IO.Path]::ChangeExtension($assemblyPath, ".pdb") - - $createSymbolOptionName = $null - if($Environment.IsWindows) - { - $createSymbolOptionName = '-CreatePDB' + $targetOS, $targetArch = $Runtime -split '-' + # Special cases where OS / Arch does not conform with runtime names + switch ($Runtime) { + 'alpine-x64' { + $targetOS = 'linux' + $targetArch = 'x64' + } + 'win-arm' { + $targetOS = 'windows' + $targetArch = 'arm' } - elseif ($Environment.IsLinux) - { - $createSymbolOptionName = '-CreatePerfMap' + 'win-arm64' { + $targetOS = 'windows' + $targetArch = 'arm64' } - - if($createSymbolOptionName) - { - Start-NativeExecution { - & $CrossgenPath -readytorun -platform_assemblies_paths $platformAssembliesPath $createSymbolOptionName $platformAssembliesPath $AssemblyPath - } | Write-Verbose + 'win7-x64' { + $targetOS = 'windows' + $targetArch = 'x64' + } + 'win7-x86' { + $targetOS = 'windows' + $targetArch = 'x86' } + } - # Rename the corresponding ni.dll assembly to be the same as the IL assembly - $niSymbolsPath = [System.IO.Path]::ChangeExtension($symbolsPath, "ni.pdb") - Rename-Item $niSymbolsPath $symbolsPath -Force -ErrorAction Stop - } finally { - Pop-Location + # The path to folder must end with directory separator + $dirSep = [System.IO.Path]::DirectorySeparatorChar + $platformAssembliesPath = if (-not $platformAssembliesPath.EndsWith($dirSep)) { $platformAssembliesPath + $dirSep } + + Start-NativeExecution { + $crossgen2Params = @( + "-r" + $platformAssembliesPath + "--out-near-input" + "--single-file-compilation" + "-O" + "--pdb" + "--targetos" + $targetOS + "--targetarch" + $targetArch + ) + + $crossgen2Params += $AssemblyPath + + & $CrossgenPath $crossgen2Params } } @@ -2403,8 +2405,7 @@ function Start-CrossGen { } # Get the path to crossgen - $crossGenExe = if ($environment.IsWindows) { "crossgen.exe" } else { "crossgen" } - $generateSymbols = $false + $crossGenExe = if ($environment.IsWindows) { "crossgen2.exe" } else { "crossgen2" } # The crossgen tool is only published for these particular runtimes $crossGenRuntime = if ($environment.IsWindows) { @@ -2412,15 +2413,9 @@ function Start-CrossGen { "win-x86" } elseif ($Runtime -match "-x64") { "win-x64" - $generateSymbols = $true - } elseif (!($env:PROCESSOR_ARCHITECTURE -match "arm")) { - throw "crossgen for 'win-arm' and 'win-arm64' must be run on that platform" + } else { + $Runtime } - } elseif ($Runtime -eq "linux-arm") { - throw "crossgen is not available for 'linux-arm'" - } elseif ($Runtime -eq "linux-x64") { - $Runtime - # We should set $generateSymbols = $true, but the code needs to be adjusted for different extension on Linux } else { $Runtime } @@ -2440,31 +2435,9 @@ function Start-CrossGen { Select-Object -First 1 | ` ForEach-Object { $_.FullName } if (-not $crossGenPath) { - throw "Unable to find latest version of crossgen.exe. 'Please run Start-PSBuild -Clean' first, and then try again." - } - Write-Verbose "Matched CrossGen.exe: $crossGenPath" -Verbose - - # Crossgen.exe requires the following assemblies: - # mscorlib.dll - # System.Private.CoreLib.dll - # clrjit.dll on Windows or libclrjit.so/dylib on Linux/OS X - $crossGenRequiredAssemblies = @("mscorlib.dll", "System.Private.CoreLib.dll") - - $crossGenRequiredAssemblies += if ($environment.IsWindows) { - "clrjit.dll" - } elseif ($environment.IsLinux) { - "libclrjit.so" - } elseif ($environment.IsMacOS) { - "libclrjit.dylib" - } - - # Make sure that all dependencies required by crossgen are at the directory. - $crossGenFolder = Split-Path $crossGenPath - foreach ($assemblyName in $crossGenRequiredAssemblies) { - if (-not (Test-Path "$crossGenFolder\$assemblyName")) { - Copy-Item -Path "$PublishPath\$assemblyName" -Destination $crossGenFolder -Force -ErrorAction Stop - } + throw "Unable to find latest version of crossgen2.exe. 'Please run Start-PSBuild -Clean' first, and then try again." } + Write-Verbose "Matched CrossGen2.exe: $crossGenPath" -Verbose # Common assemblies used by Add-Type or assemblies with high JIT and no pdbs to crossgen $commonAssembliesForAddType = @( @@ -2495,11 +2468,13 @@ function Start-CrossGen { $fullAssemblyList = $commonAssembliesForAddType - foreach ($assemblyName in $fullAssemblyList) { - $assemblyPath = Join-Path $PublishPath $assemblyName - New-CrossGenAssembly -CrossgenPath $crossGenPath -AssemblyPath $assemblyPath + $assemblyFullPaths = @() + $assemblyFullPaths += foreach ($assemblyName in $fullAssemblyList) { + Join-Path $PublishPath $assemblyName } + New-CrossGenAssembly -CrossgenPath $crossGenPath -AssemblyPath $assemblyFullPaths -Runtime $Runtime + # # With the latest dotnet.exe, the default load context is only able to load TPAs, and TPA # only contains IL assembly names. In order to make the default load context able to load @@ -2523,12 +2498,6 @@ function Start-CrossGen { # Microsoft.CodeAnalysis.VisualBasic.dll, and Microsoft.CSharp.dll. if ($commonAssembliesForAddType -notcontains $assemblyName) { Remove-Item $symbolsPath -Force -ErrorAction Stop - - if($generateSymbols) - { - Write-Verbose "Generating Symbols for $assemblyPath" - New-CrossGenSymbol -CrossgenPath $crossGenPath -AssemblyPath $assemblyPath - } } } } From a5e9a0c5c20bff0ca4f5a925fdd4768793ac2f06 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 12 Jul 2021 17:11:22 -0700 Subject: [PATCH 02/21] Remove fallback to crossgen --- PowerShell.Common.props | 1 - 1 file changed, 1 deletion(-) diff --git a/PowerShell.Common.props b/PowerShell.Common.props index cbfc342851b..45e1f2788c1 100644 --- a/PowerShell.Common.props +++ b/PowerShell.Common.props @@ -138,7 +138,6 @@ net6.0 9.0 true - false true true From 9de4a23922c258b0cec68a840bbe7f5b456653bd Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 12 Jul 2021 17:32:37 -0700 Subject: [PATCH 03/21] Fix CA1846 issues --- .../engine/NativeCommandParameterBinder.cs | 2 +- .../engine/remoting/common/RemoteSessionNamedPipe.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs b/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs index 462eee91e6d..35c956e2802 100644 --- a/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs +++ b/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs @@ -427,7 +427,7 @@ private void PossiblyGlobArg(string arg, CommandParameterInternal parameter, Str } else if (arg.StartsWith("~/", StringComparison.OrdinalIgnoreCase)) { - var replacementString = home + arg.Substring(1); + string replacementString = string.Concat(home, arg.AsSpan(1)); _arguments.Append(replacementString); AddToArgumentList(parameter, replacementString); argExpanded = true; diff --git a/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs b/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs index 5be1cbf673a..2c154f79990 100644 --- a/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs +++ b/src/System.Management.Automation/engine/remoting/common/RemoteSessionNamedPipe.cs @@ -110,7 +110,7 @@ internal static string CreateProcessPipeName( // There is a limit of 104 characters in total including the temp path to the named pipe file // on non-Windows systems, so we'll convert the starttime to hex and just take the first 8 characters. #if UNIX - .Append(proc.StartTime.ToFileTime().ToString("X8").Substring(1, 8)) + .Append(proc.StartTime.ToFileTime().ToString("X8").AsSpan(1, 8)) #else .Append(proc.StartTime.ToFileTime().ToString(CultureInfo.InvariantCulture)) #endif From 9e018313e50abc65735ec9754773ee09d3e1fc26 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Wed, 14 Jul 2021 00:56:57 -0700 Subject: [PATCH 04/21] Remove --no-restore switch from dotnet publish --- build.psm1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index 967b15ae5c6..c5308912b8c 100644 --- a/build.psm1 +++ b/build.psm1 @@ -419,7 +419,8 @@ Fix steps: # setup arguments # adding ErrorOnDuplicatePublishOutputFiles=false due to .NET SDk issue: https://github.com/dotnet/sdk/issues/15748 - $Arguments = @("publish","--no-restore","/property:GenerateFullPaths=true", "/property:ErrorOnDuplicatePublishOutputFiles=false") + # $Arguments = @("publish","--no-restore","/property:GenerateFullPaths=true", "/property:ErrorOnDuplicatePublishOutputFiles=false") + $Arguments = @("publish","/property:GenerateFullPaths=true", "/property:ErrorOnDuplicatePublishOutputFiles=false") if ($Output -or $SMAOnly) { $Arguments += "--output", (Split-Path $Options.Output) } From d877f063e2073c64afaa79eedca6034ae1e88ccb Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Wed, 14 Jul 2021 10:59:08 -0700 Subject: [PATCH 05/21] Update to .NET 6 Preview 6 --- assets/wix/files.wxs | 34 +++++++++++++++++-- global.json | 2 +- ...soft.PowerShell.Commands.Management.csproj | 2 +- ...crosoft.PowerShell.Commands.Utility.csproj | 6 ++-- ...crosoft.PowerShell.CoreCLR.Eventing.csproj | 2 +- .../Microsoft.PowerShell.SDK.csproj | 20 +++++------ .../Microsoft.WSMan.Management.csproj | 2 +- .../System.Management.Automation.csproj | 20 +++++------ test/tools/TestService/TestService.csproj | 2 +- test/tools/WebListener/WebListener.csproj | 4 +-- ...crosoft.PowerShell.Commands.Utility.csproj | 2 +- .../System.Management.Automation.csproj | 4 +-- 12 files changed, 64 insertions(+), 36 deletions(-) diff --git a/assets/wix/files.wxs b/assets/wix/files.wxs index e6dc09ea608..f205226a49d 100644 --- a/assets/wix/files.wxs +++ b/assets/wix/files.wxs @@ -1620,6 +1620,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -3033,8 +3054,8 @@ - - + + @@ -4013,7 +4034,14 @@ - + + + + + + + + diff --git a/global.json b/global.json index c36bb3376e9..26b49e6e30a 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "6.0.100-preview.4.21255.9" + "version": "6.0.100-preview.6.21355.2" } } diff --git a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj index d74f77126a7..1fb088cfdd7 100644 --- a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj +++ b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj @@ -47,7 +47,7 @@ - + diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 86f7a8ded3a..823d99e5b84 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -31,9 +31,9 @@ - - - + + + diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj index 3e20f19b03a..fc257238436 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj index 4f24cdcbbca..975a0cbbca4 100644 --- a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj +++ b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj @@ -18,19 +18,19 @@ - - - + + + - - - - - - + + + + + + - + diff --git a/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj b/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj index 2bd11329423..d32fb47a456 100644 --- a/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj +++ b/src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/System.Management.Automation/System.Management.Automation.csproj b/src/System.Management.Automation/System.Management.Automation.csproj index b7b407b167c..f11ab82db0d 100644 --- a/src/System.Management.Automation/System.Management.Automation.csproj +++ b/src/System.Management.Automation/System.Management.Automation.csproj @@ -16,16 +16,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/test/tools/TestService/TestService.csproj b/test/tools/TestService/TestService.csproj index da9976c3a42..e29c59bd5be 100644 --- a/test/tools/TestService/TestService.csproj +++ b/test/tools/TestService/TestService.csproj @@ -13,7 +13,7 @@ - + diff --git a/test/tools/WebListener/WebListener.csproj b/test/tools/WebListener/WebListener.csproj index 02cf0993928..4217232a67d 100644 --- a/test/tools/WebListener/WebListener.csproj +++ b/test/tools/WebListener/WebListener.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/tools/packaging/projects/reference/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/tools/packaging/projects/reference/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index b9ffef2c91b..189fab2c02e 100644 --- a/tools/packaging/projects/reference/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/tools/packaging/projects/reference/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -14,7 +14,7 @@ - + diff --git a/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj b/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj index 2228c06a4cc..406fea6d78b 100644 --- a/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj +++ b/tools/packaging/projects/reference/System.Management.Automation/System.Management.Automation.csproj @@ -9,7 +9,7 @@ - - + + From 7d941f669eab9ac5fe92d21aeacb1259922c7008 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Wed, 14 Jul 2021 13:10:52 -0700 Subject: [PATCH 06/21] Remove pdb generation for crossgen assembly as it fails on linux --- build.psm1 | 1 - 1 file changed, 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index c5308912b8c..171b97ad3d9 100644 --- a/build.psm1 +++ b/build.psm1 @@ -2388,7 +2388,6 @@ function Start-CrossGen { "--out-near-input" "--single-file-compilation" "-O" - "--pdb" "--targetos" $targetOS "--targetarch" From e320bc284d0a30ec18db70a5fa9be2051ce47993 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Wed, 14 Jul 2021 14:34:16 -0700 Subject: [PATCH 07/21] Disable tests --- test/powershell/Language/Parser/Parser.Tests.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/powershell/Language/Parser/Parser.Tests.ps1 b/test/powershell/Language/Parser/Parser.Tests.ps1 index b3163ba2f27..d5dd267619a 100644 --- a/test/powershell/Language/Parser/Parser.Tests.ps1 +++ b/test/powershell/Language/Parser/Parser.Tests.ps1 @@ -864,7 +864,10 @@ foo``u{2195}abc @{ Script = "0x0"; ExpectedValue = "0"; ExpectedType = [int] } @{ Script = "0x12"; ExpectedValue = "18"; ExpectedType = [int] } @{ Script = "-0x12"; ExpectedValue = "-18"; ExpectedType = [int] } - @{ Script = "0x80000000"; ExpectedValue = $([int32]::MinValue); ExpectedType = [int] } + + # Disabling this because https://github.com/dotnet/runtime/issues/54251 + # @{ Script = "0x80000000"; ExpectedValue = $([int32]::MinValue); ExpectedType = [int] } + @{ Script = "0x7fffffff"; ExpectedValue = $([int32]::MaxValue); ExpectedType = [int] } @{ Script = "0x100000000"; ExpectedValue = [int64]0x100000000; ExpectedType = [long] } @{ Script = "0xFF"; ExpectedValue = "255"; ExpectedType = [int] } @@ -1057,7 +1060,10 @@ foo``u{2195}abc @{ Script = "0b10u"; ExpectedValue = "2"; ExpectedType = [uint] } @{ Script = "0b11111111u"; ExpectedValue = "255"; ExpectedType = [uint] } @{ Script = "0b1111111111111111u"; ExpectedValue = "65535"; ExpectedType = [uint] } - @{ Script = "0b11111111111111111111111111111111u"; ExpectedValue = "4294967295"; ExpectedType = [uint] } + + # Disabling this because https://github.com/dotnet/runtime/issues/54251 + # @{ Script = "0b11111111111111111111111111111111u"; ExpectedValue = "4294967295"; ExpectedType = [uint] } + @{ Script = "0b1111111111111111111111111111111111111111111111111111111111111111u"; ExpectedValue = "18446744073709551615"; ExpectedType = [ulong] } #Multipliers @{ Script = "1ukb"; ExpectedValue = "1024"; ExpectedType = [uint] } From ff274f612d6fd53e2d6c2ed76b9fb44b2edd83e5 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Wed, 14 Jul 2021 15:46:49 -0700 Subject: [PATCH 08/21] Update the startup assemblies list --- test/powershell/Host/Startup.Tests.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/test/powershell/Host/Startup.Tests.ps1 b/test/powershell/Host/Startup.Tests.ps1 index 34a298beff9..bb775d0ca2f 100644 --- a/test/powershell/Host/Startup.Tests.ps1 +++ b/test/powershell/Host/Startup.Tests.ps1 @@ -26,7 +26,6 @@ Describe "Validate start of console host" -Tag CI { 'System.Diagnostics.TraceSource.dll' 'System.Diagnostics.Tracing.dll' 'System.IO.FileSystem.AccessControl.dll' - 'System.IO.FileSystem.dll' 'System.IO.FileSystem.DriveInfo.dll' 'System.IO.Pipes.dll' 'System.Linq.dll' From bc7a84c0d4b6067a2b350b1c637c700fb0d728e3 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Wed, 14 Jul 2021 15:47:05 -0700 Subject: [PATCH 09/21] Fix another parser test --- test/powershell/Language/Parser/Parser.Tests.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/powershell/Language/Parser/Parser.Tests.ps1 b/test/powershell/Language/Parser/Parser.Tests.ps1 index d5dd267619a..0f8a6c74726 100644 --- a/test/powershell/Language/Parser/Parser.Tests.ps1 +++ b/test/powershell/Language/Parser/Parser.Tests.ps1 @@ -1050,7 +1050,10 @@ foo``u{2195}abc @{ Script = "0xFFu"; ExpectedValue = "255"; ExpectedType = [uint] } @{ Script = "0xFFFFu"; ExpectedValue = "65535"; ExpectedType = [uint] } @{ Script = "0xFFFFFFu"; ExpectedValue = "16777215"; ExpectedType = [uint] } - @{ Script = "0xFFFFFFFFu"; ExpectedValue = "$([uint]::MaxValue)"; ExpectedType = [uint] } + + # Disabling this because https://github.com/dotnet/runtime/issues/54251 + # @{ Script = "0xFFFFFFFFu"; ExpectedValue = "$([uint]::MaxValue)"; ExpectedType = [uint] } + @{ Script = "0xFFFFFFFFFFu"; ExpectedValue = "1099511627775"; ExpectedType = [ulong] } @{ Script = "0xFFFFFFFFFFFFu"; ExpectedValue = "281474976710655"; ExpectedType = [ulong] } @{ Script = "0xFFFFFFFFFFFFFFu"; ExpectedValue = "72057594037927935"; ExpectedType = [ulong] } From dea13a049cb49c251136eab5154fa7ea0c62e4b5 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 15 Jul 2021 12:01:28 -0700 Subject: [PATCH 10/21] Install crossgen package --- .vsts-ci/templates/nix-test.yml | 6 ++++++ .vsts-ci/templates/windows-test.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.vsts-ci/templates/nix-test.yml b/.vsts-ci/templates/nix-test.yml index 6a1b6e6f9de..9ce70149793 100644 --- a/.vsts-ci/templates/nix-test.yml +++ b/.vsts-ci/templates/nix-test.yml @@ -45,6 +45,12 @@ jobs: Invoke-CIInstall -SkipUser displayName: Bootstrap + - pwsh: | + $pkgName = if ($IsLinux) { 'Microsoft.NETCore.App.Crossgen2.linux-x64' } else { 'Microsoft.NETCore.App.Crossgen2.osx-x64' } + $pkg = Find-Package -Name $pkgName -AllowPrereleaseVersions -AllVersions -Source https://api.nuget.org/v3/index.json + Install-Package -Name $pkgName -RequiredVersion $pkg[0].Version + displayName: Install CrossGen2 nuget package + - task: ExtractFiles@1 displayName: 'Extract Build ZIP' inputs: diff --git a/.vsts-ci/templates/windows-test.yml b/.vsts-ci/templates/windows-test.yml index b021e45f000..647f240bd84 100644 --- a/.vsts-ci/templates/windows-test.yml +++ b/.vsts-ci/templates/windows-test.yml @@ -50,6 +50,12 @@ jobs: Invoke-CIInstall displayName: Bootstrap + - pwsh: | + $pkg = Find-Package -Name Microsoft.NETCore.App.Crossgen2.win-x64 -AllowPrereleaseVersions -AllVersions -Source https://api.nuget.org/v3/index.json + Install-Package -Name Microsoft.NETCore.App.Crossgen2.win-x64 -RequiredVersion $pkg[0].Version + displayName: Install CrossGen2 nuget package + + - pwsh: | Import-Module .\tools\ci.psm1 Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json' From b4e967be6d5094aa447d4fde102b2cb4d60dd364 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 15 Jul 2021 12:30:05 -0700 Subject: [PATCH 11/21] Add logging --- .vsts-ci/templates/nix-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.vsts-ci/templates/nix-test.yml b/.vsts-ci/templates/nix-test.yml index 9ce70149793..3ab98e46c74 100644 --- a/.vsts-ci/templates/nix-test.yml +++ b/.vsts-ci/templates/nix-test.yml @@ -48,6 +48,9 @@ jobs: - pwsh: | $pkgName = if ($IsLinux) { 'Microsoft.NETCore.App.Crossgen2.linux-x64' } else { 'Microsoft.NETCore.App.Crossgen2.osx-x64' } $pkg = Find-Package -Name $pkgName -AllowPrereleaseVersions -AllVersions -Source https://api.nuget.org/v3/index.json + + Write-Verbose -Verbose "Package: $pkgName Version: $($pkg[0].Version)" + Install-Package -Name $pkgName -RequiredVersion $pkg[0].Version displayName: Install CrossGen2 nuget package From 3dbec6f79a33eb37483d673cb8a9cbae61e90f3a Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 15 Jul 2021 15:01:08 -0700 Subject: [PATCH 12/21] Use x64 crossgen for all windows --- build.psm1 | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/build.psm1 b/build.psm1 index 171b97ad3d9..d5d519c1c88 100644 --- a/build.psm1 +++ b/build.psm1 @@ -2409,13 +2409,7 @@ function Start-CrossGen { # The crossgen tool is only published for these particular runtimes $crossGenRuntime = if ($environment.IsWindows) { - if ($Runtime -match "-x86") { - "win-x86" - } elseif ($Runtime -match "-x64") { - "win-x64" - } else { - $Runtime - } + "win-x64" } else { $Runtime } From cce7ee40297c7690de95d030e5ba49b13949d95e Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 15 Jul 2021 15:20:37 -0700 Subject: [PATCH 13/21] Remove crossgen install --- .vsts-ci/templates/nix-test.yml | 9 --------- .vsts-ci/templates/windows-test.yml | 6 ------ 2 files changed, 15 deletions(-) diff --git a/.vsts-ci/templates/nix-test.yml b/.vsts-ci/templates/nix-test.yml index 3ab98e46c74..6a1b6e6f9de 100644 --- a/.vsts-ci/templates/nix-test.yml +++ b/.vsts-ci/templates/nix-test.yml @@ -45,15 +45,6 @@ jobs: Invoke-CIInstall -SkipUser displayName: Bootstrap - - pwsh: | - $pkgName = if ($IsLinux) { 'Microsoft.NETCore.App.Crossgen2.linux-x64' } else { 'Microsoft.NETCore.App.Crossgen2.osx-x64' } - $pkg = Find-Package -Name $pkgName -AllowPrereleaseVersions -AllVersions -Source https://api.nuget.org/v3/index.json - - Write-Verbose -Verbose "Package: $pkgName Version: $($pkg[0].Version)" - - Install-Package -Name $pkgName -RequiredVersion $pkg[0].Version - displayName: Install CrossGen2 nuget package - - task: ExtractFiles@1 displayName: 'Extract Build ZIP' inputs: diff --git a/.vsts-ci/templates/windows-test.yml b/.vsts-ci/templates/windows-test.yml index 647f240bd84..b021e45f000 100644 --- a/.vsts-ci/templates/windows-test.yml +++ b/.vsts-ci/templates/windows-test.yml @@ -50,12 +50,6 @@ jobs: Invoke-CIInstall displayName: Bootstrap - - pwsh: | - $pkg = Find-Package -Name Microsoft.NETCore.App.Crossgen2.win-x64 -AllowPrereleaseVersions -AllVersions -Source https://api.nuget.org/v3/index.json - Install-Package -Name Microsoft.NETCore.App.Crossgen2.win-x64 -RequiredVersion $pkg[0].Version - displayName: Install CrossGen2 nuget package - - - pwsh: | Import-Module .\tools\ci.psm1 Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json' From 75354eea9df56da929edc21476af42346212ead4 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 16 Jul 2021 11:33:46 -0700 Subject: [PATCH 14/21] Add logging --- tools/ci.psm1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/ci.psm1 b/tools/ci.psm1 index afdf5b81bab..c669a446bc0 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -171,6 +171,9 @@ function Invoke-CIInstall } Set-BuildVariable -Name TestPassed -Value False + + Get-Content $PSScriptRoot\..\global.json | Write-Verbose -Verbose + Start-PSBootstrap } From 42cb0fa381a6793eeabad2b746e9ec2fabac5823 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 16 Jul 2021 12:38:34 -0700 Subject: [PATCH 15/21] Verify PATH in test --- .vsts-ci/templates/windows-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.vsts-ci/templates/windows-test.yml b/.vsts-ci/templates/windows-test.yml index b021e45f000..7f1716dffde 100644 --- a/.vsts-ci/templates/windows-test.yml +++ b/.vsts-ci/templates/windows-test.yml @@ -51,6 +51,9 @@ jobs: displayName: Bootstrap - pwsh: | + + Write-Host $env:Path + Import-Module .\tools\ci.psm1 Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json' $options = (Get-PSOptions) From 88a662d4b7d9e90fe5226b978b51b41f45a79e83 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 16 Jul 2021 13:33:14 -0700 Subject: [PATCH 16/21] Add PATH --- .vsts-ci/templates/windows-test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.vsts-ci/templates/windows-test.yml b/.vsts-ci/templates/windows-test.yml index 7f1716dffde..66fd124ddb9 100644 --- a/.vsts-ci/templates/windows-test.yml +++ b/.vsts-ci/templates/windows-test.yml @@ -51,9 +51,7 @@ jobs: displayName: Bootstrap - pwsh: | - - Write-Host $env:Path - + $env:PATH += ";${env:LOCALAPPDATA}\Microsoft\dotnet" Import-Module .\tools\ci.psm1 Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json' $options = (Get-PSOptions) From 70bbe96a47483ed00d7e3bd0f75bf955ea70e778 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 16 Jul 2021 14:06:55 -0700 Subject: [PATCH 17/21] Add bootstrap --- .vsts-ci/templates/windows-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vsts-ci/templates/windows-test.yml b/.vsts-ci/templates/windows-test.yml index 66fd124ddb9..b316f8f360e 100644 --- a/.vsts-ci/templates/windows-test.yml +++ b/.vsts-ci/templates/windows-test.yml @@ -51,7 +51,8 @@ jobs: displayName: Bootstrap - pwsh: | - $env:PATH += ";${env:LOCALAPPDATA}\Microsoft\dotnet" + Import-Module .\build.psm1 -force + Start-PSBootstrap Import-Module .\tools\ci.psm1 Restore-PSOptions -PSOptionsPath '$(System.ArtifactsDirectory)\build\psoptions.json' $options = (Get-PSOptions) From b7d7a557a60abbaf93086e5aed7509e8f79b6024 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Fri, 16 Jul 2021 16:44:41 -0700 Subject: [PATCH 18/21] Rollback since dependency is missing --- src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj | 2 +- test/tools/TestService/TestService.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj index 975a0cbbca4..0907eaa3736 100644 --- a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj +++ b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj @@ -30,7 +30,7 @@ - + diff --git a/test/tools/TestService/TestService.csproj b/test/tools/TestService/TestService.csproj index e29c59bd5be..da9976c3a42 100644 --- a/test/tools/TestService/TestService.csproj +++ b/test/tools/TestService/TestService.csproj @@ -13,7 +13,7 @@ - + From f0e1f196bbf4d483d8e188bc6fc4f68380bc9aad Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 19 Jul 2021 12:03:36 -0700 Subject: [PATCH 19/21] Cleanup debug messages --- build.psm1 | 7 +++++++ tools/ci.psm1 | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build.psm1 b/build.psm1 index d5d519c1c88..7da5a883472 100644 --- a/build.psm1 +++ b/build.psm1 @@ -419,6 +419,7 @@ Fix steps: # setup arguments # adding ErrorOnDuplicatePublishOutputFiles=false due to .NET SDk issue: https://github.com/dotnet/sdk/issues/15748 + # removing --no-restore due to .NET SDK issue: https://github.com/dotnet/sdk/issues/18999 # $Arguments = @("publish","--no-restore","/property:GenerateFullPaths=true", "/property:ErrorOnDuplicatePublishOutputFiles=false") $Arguments = @("publish","/property:GenerateFullPaths=true", "/property:ErrorOnDuplicatePublishOutputFiles=false") if ($Output -or $SMAOnly) { @@ -2377,6 +2378,8 @@ function Start-CrossGen { } } + $generatePdb = $targetos -eq 'windows' + # The path to folder must end with directory separator $dirSep = [System.IO.Path]::DirectorySeparatorChar $platformAssembliesPath = if (-not $platformAssembliesPath.EndsWith($dirSep)) { $platformAssembliesPath + $dirSep } @@ -2394,6 +2397,10 @@ function Start-CrossGen { $targetArch ) + if ($generatePdb) { + $crossgen2Params += "--pdb" + } + $crossgen2Params += $AssemblyPath & $CrossgenPath $crossgen2Params diff --git a/tools/ci.psm1 b/tools/ci.psm1 index c669a446bc0..afdf5b81bab 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -171,9 +171,6 @@ function Invoke-CIInstall } Set-BuildVariable -Name TestPassed -Value False - - Get-Content $PSScriptRoot\..\global.json | Write-Verbose -Verbose - Start-PSBootstrap } From 81fdb24c52c2e9727dc7dafa2da0342d5be6d195 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 19 Jul 2021 13:12:16 -0700 Subject: [PATCH 20/21] Disable tests for Test-Connection on macOS --- .../Test-Connection.Tests.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 index 10f39bca320..6d9892c6126 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 @@ -261,7 +261,8 @@ Describe "Test-Connection" -tags "CI" { Context "MTUSizeDetect" { # We skip the MtuSize detection tests when in containers, as the environments throw raw exceptions # instead of returning a PacketTooBig response cleanly. - It "MTUSizeDetect works" -Pending:($env:__INCONTAINER -eq 1) { + # Test disabled due to .NET runtime issue: https://github.com/dotnet/runtime/issues/55961 + It "MTUSizeDetect works" -Pending:(($env:__INCONTAINER -eq 1) -or $true) { $result = Test-Connection $testAddress -MtuSize $result | Should -BeOfType Microsoft.PowerShell.Commands.TestConnectionCommand+PingMtuStatus @@ -270,7 +271,8 @@ Describe "Test-Connection" -tags "CI" { $result.MtuSize | Should -BeGreaterThan 0 } - It "Quiet works" -Pending:($env:__INCONTAINER -eq 1) { + # Test disabled due to .NET runtime issue: https://github.com/dotnet/runtime/issues/55961 + It "Quiet works" -Pending:(($env:__INCONTAINER -eq 1) -or $true) { $result = Test-Connection $gatewayAddress -MtuSize -Quiet $result | Should -BeOfType Int32 From 8b22cc8190d7f781e4fa4ba23992ca05bf6708e1 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 19 Jul 2021 15:16:48 -0700 Subject: [PATCH 21/21] Address comments from Travis --- build.psm1 | 2 ++ .../Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build.psm1 b/build.psm1 index 7da5a883472..8cfd5299c94 100644 --- a/build.psm1 +++ b/build.psm1 @@ -2416,6 +2416,8 @@ function Start-CrossGen { # The crossgen tool is only published for these particular runtimes $crossGenRuntime = if ($environment.IsWindows) { + # for windows the tool architecture is the host machine architecture, so it is always x64. + # we can cross compile for x86, arm and arm64 "win-x64" } else { $Runtime diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 index 6d9892c6126..fc5cf7a69d4 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 @@ -262,7 +262,7 @@ Describe "Test-Connection" -tags "CI" { # We skip the MtuSize detection tests when in containers, as the environments throw raw exceptions # instead of returning a PacketTooBig response cleanly. # Test disabled due to .NET runtime issue: https://github.com/dotnet/runtime/issues/55961 - It "MTUSizeDetect works" -Pending:(($env:__INCONTAINER -eq 1) -or $true) { + It "MTUSizeDetect works" -Pending:(($env:__INCONTAINER -eq 1) -or $IsMacOS) { $result = Test-Connection $testAddress -MtuSize $result | Should -BeOfType Microsoft.PowerShell.Commands.TestConnectionCommand+PingMtuStatus @@ -272,7 +272,7 @@ Describe "Test-Connection" -tags "CI" { } # Test disabled due to .NET runtime issue: https://github.com/dotnet/runtime/issues/55961 - It "Quiet works" -Pending:(($env:__INCONTAINER -eq 1) -or $true) { + It "Quiet works" -Pending:(($env:__INCONTAINER -eq 1) -or $IsMacOS) { $result = Test-Connection $gatewayAddress -MtuSize -Quiet $result | Should -BeOfType Int32