diff --git a/PowerShell.Common.props b/PowerShell.Common.props index 81224a9a873..f8c90bf678b 100644 --- a/PowerShell.Common.props +++ b/PowerShell.Common.props @@ -62,6 +62,8 @@ Tracking Issue https://github.com/dotnet/sdk/issues/1557 --> $(PSCoreBuildVersion) + ..\..\assets\Powershell_av_colors.ico + ..\..\assets\Powershell_black.ico @@ -93,9 +95,8 @@ Microsoft Corporation (c) Microsoft Corporation. All rights reserved. - netcoreapp2.1 - 2.1.8 - Latest + netcoreapp3.0 + 8.0 true true diff --git a/assets/files.wxs b/assets/files.wxs index f7aad3a4fae..cdb95aa16ad 100644 --- a/assets/files.wxs +++ b/assets/files.wxs @@ -46,6 +46,15 @@ + + + + + + + + + @@ -1196,434 +1205,449 @@ - - + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + @@ -2188,11 +2212,134 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -2212,6 +2359,9 @@ + + + @@ -2596,149 +2746,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2873,6 +2880,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2880,8 +2924,10 @@ - - + + + + diff --git a/build.psm1 b/build.psm1 index 3a318614b2d..3f66cc3020a 100644 --- a/build.psm1 +++ b/build.psm1 @@ -5,7 +5,7 @@ # On Windows paths is separated by semicolon $script:TestModulePathSeparator = [System.IO.Path]::PathSeparator -$dotnetCLIChannel = "release" +$dotnetCLIChannel = 'preview' # TODO: Change this to 'release' once .Net Core 3.0 goes RTM $dotnetCLIRequiredVersion = $(Get-Content $PSScriptRoot/global.json | ConvertFrom-Json).Sdk.Version # Track if tags have been sync'ed @@ -410,7 +410,7 @@ Fix steps: Pop-Location } - # publish netcoreapp2.1 reference assemblies + # publish reference assemblies try { Push-Location "$PSScriptRoot/src/TypeCatalogGen" $refAssemblies = Get-Content -Path $incFileName | Where-Object { $_ -like "*microsoft.netcore.app*" } | ForEach-Object { $_.TrimEnd(';') } @@ -449,51 +449,6 @@ Fix steps: } } - if ($Environment.IsWindows) { - ## need RCEdit to modify the binaries embedded resources - $rcedit = "~/.rcedit/rcedit-x64.exe" - if (-not (Test-Path -Type Leaf $rcedit)) { - $rcedit = Get-Command "rcedit-x64.exe" -CommandType Application -ErrorAction Ignore | Select-Object -First 1 | ForEach-Object Name - } - if (-not $rcedit) { - throw "RCEdit is required to modify pwsh.exe resources, please run 'Start-PSBootStrap' to install" - } - - $ReleaseVersion = "" - if ($ReleaseTagToUse) { - $ReleaseVersion = $ReleaseTagToUse - } else { - $ReleaseVersion = (Get-PSCommitId -WarningAction SilentlyContinue) -replace '^v' - } - # in VSCode, depending on where you started it from, the git commit id may be empty so provide a default value - if (!$ReleaseVersion) { - $ReleaseVersion = "6.0.0" - $fileVersion = "6.0.0" - } else { - $fileVersion = $ReleaseVersion.Split("-")[0] - } - - # in VSCode, the build output folder doesn't include the name of the exe so we have to add it for rcedit - $pwshPath = $Options.Output - if (!$pwshPath.EndsWith("pwsh.exe")) { - $pwshPath = Join-Path $Options.Output "pwsh.exe" - } - - if (Test-IsPreview $ReleaseVersion) { - $iconPath = "$PSScriptRoot\assets\Powershell_av_colors.ico" - } else { - $iconPath = "$PSScriptRoot\assets\Powershell_black.ico" - } - - # fxdependent package does not have an executable to set iconPath etc. - if ($Options.Runtime -ne 'fxdependent') { - Start-NativeExecution { & $rcedit $pwshPath --set-icon $iconPath ` - --set-file-version $fileVersion --set-product-version $ReleaseVersion --set-version-string "ProductName" "PowerShell 7" ` - --set-version-string "LegalCopyright" "(C) Microsoft Corporation. All Rights Reserved." ` - --application-manifest "$PSScriptRoot\assets\pwsh.manifest" } | Write-Verbose - } - } - # download modules from powershell gallery. # - PowerShellGet, PackageManagement, Microsoft.PowerShell.Archive if ($PSModuleRestore) { @@ -617,8 +572,8 @@ function New-PSOptions { [ValidateSet("Debug", "Release", "CodeCoverage", '')] [string]$Configuration, - [ValidateSet("netcoreapp2.1")] - [string]$Framework, + [ValidateSet("netcoreapp3.0")] + [string]$Framework = "netcoreapp3.0", # These are duplicated from Start-PSBuild # We do not use ValidateScript since we want tab completion @@ -656,6 +611,7 @@ function New-PSOptions { } Write-Verbose "Using configuration '$Configuration'" + Write-Verbose "Using framework '$Framework'" if (-not $Runtime) { if ($Environment.IsLinux) { @@ -1741,19 +1697,6 @@ function Start-PSBootstrap { $psInstallFile = [System.IO.Path]::Combine($PSScriptRoot, "tools", "install-powershell.ps1") & $psInstallFile -AddToPath } - - ## need RCEdit to modify the binaries embedded resources - if (-not (Test-Path "~/.rcedit/rcedit-x64.exe")) - { - Write-Log "Install RCEdit for modifying exe resources" - $rceditUrl = "https://github.com/electron/rcedit/releases/download/v1.0.0/rcedit-x64.exe" - New-Item -Path "~/.rcedit" -Type Directory -Force > $null - - ## need to specify TLS version 1.2 since GitHub API requires it - [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 - - Invoke-WebRequest -OutFile "~/.rcedit/rcedit-x64.exe" -Uri $rceditUrl - } } } finally { Pop-Location @@ -1854,12 +1797,13 @@ function Start-TypeGen - <_RefAssemblyPath Include="%(_ReferencesFromRAR.HintPath)%3B" Condition=" '%(_ReferencesFromRAR.NuGetPackageId)' != 'Microsoft.Management.Infrastructure' "/> + <_RefAssemblyPath Include="%(_ReferencesFromRAR.OriginalItemSpec)%3B" Condition=" '%(_ReferencesFromRAR.NuGetPackageId)' != 'Microsoft.Management.Infrastructure' "/> '@ + New-Item -ItemType Directory -Path (Split-Path -Path $GetDependenciesTargetPath -Parent) -Force > $null Set-Content -Path $GetDependenciesTargetPath -Value $GetDependenciesTargetValue -Force -Encoding Ascii Push-Location "$PSScriptRoot/src/Microsoft.PowerShell.SDK" @@ -2317,7 +2261,7 @@ function Copy-PSGalleryModules Remove-Item -Force -ErrorAction Ignore -Recurse "$Destination/$name" New-Item -Path $dest -ItemType Directory -Force -ErrorAction Stop > $null # Exclude files/folders that are not needed. The fullclr folder is coming from the PackageManagement module - $dontCopy = '*.nupkg', '*.nupkg.sha512', '*.nuspec', 'System.Runtime.InteropServices.RuntimeInformation.dll', 'fullclr' + $dontCopy = '*.nupkg', '*.nupkg.metadata', '*.nupkg.sha512', '*.nuspec', 'System.Runtime.InteropServices.RuntimeInformation.dll', 'fullclr' Copy-Item -Exclude $dontCopy -Recurse $src/* $dest } } diff --git a/docs/building/linux.md b/docs/building/linux.md index f648f1d5170..351f02cef4c 100644 --- a/docs/building/linux.md +++ b/docs/building/linux.md @@ -71,7 +71,7 @@ Start-PSBuild Congratulations! If everything went right, PowerShell is now built. The `Start-PSBuild` script will output the location of the executable: -`./src/powershell-unix/bin/Debug/netcoreapp2.1/linux-x64/publish/pwsh`. +`./src/powershell-unix/bin/Debug/netcoreapp3.0/linux-x64/publish/pwsh`. You should now be running the PowerShell Core that you just built, if your run the above executable. You can run our cross-platform Pester tests with `Start-PSPester`, and our xUnit tests with `Start-PSxUnit`. diff --git a/docs/building/macos.md b/docs/building/macos.md index 8ace4198e86..d6f3cac5480 100644 --- a/docs/building/macos.md +++ b/docs/building/macos.md @@ -36,4 +36,4 @@ We cannot do this for you in the build module due to #[847][]. Start a PowerShell session by running `pwsh`, and then use `Start-PSBuild` from the module. -After building, PowerShell will be at `./src/powershell-unix/bin/Debug/netcoreapp2.1/osx-x64/publish/pwsh`. +After building, PowerShell will be at `./src/powershell-unix/bin/Debug/netcoreapp3.0/osx-x64/publish/pwsh`. diff --git a/docs/building/windows-core.md b/docs/building/windows-core.md index 92755f323db..ed45a2ae958 100644 --- a/docs/building/windows-core.md +++ b/docs/building/windows-core.md @@ -58,11 +58,11 @@ Import-Module ./build.psm1 Start-PSBuild ``` -Congratulations! If everything went right, PowerShell is now built and executable as `./src/powershell-win-core/bin/Debug/netcoreapp2.1/win7-x64/publish/pwsh.exe`. +Congratulations! If everything went right, PowerShell is now built and executable as `./src/powershell-win-core/bin/Debug/netcoreapp3.0/win7-x64/publish/pwsh.exe`. This location is of the form `./[project]/bin/[configuration]/[framework]/[rid]/publish/[binary name]`, and our project is `powershell`, configuration is `Debug` by default, -framework is `netcoreapp2.1`, runtime identifier is `win7-x64` by default, +framework is `netcoreapp3.0`, runtime identifier is `win7-x64` by default, and binary name is `pwsh`. The function `Get-PSOutput` will return the path to the executable; thus you can execute the development copy via `& (Get-PSOutput)`. diff --git a/global.json b/global.json index 4ac738bc323..7ffac575022 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "2.1.504" + "version": "3.0.100-preview5-011568" } } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs index 7966e8b8a31..20cca320883 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs @@ -663,7 +663,7 @@ private void LoadAssemblies(IEnumerable assemblies) /// private static IEnumerable InitDefaultRefAssemblies() { - // netcoreapp2.1 currently comes with 144 reference assemblies (maybe more in future), so we use a capacity of '150'. + // netcoreapp3.0 currently comes with 148 reference assemblies (maybe more in future), so we use a capacity of '150'. var defaultRefAssemblies = new List(150); foreach (string file in Directory.EnumerateFiles(s_netcoreAppRefFolder, "*.dll", SearchOption.TopDirectoryOnly)) diff --git a/src/ResGen/ResGen.csproj b/src/ResGen/ResGen.csproj index 28c8385af8c..fc0dcd7c6a0 100644 --- a/src/ResGen/ResGen.csproj +++ b/src/ResGen/ResGen.csproj @@ -2,10 +2,11 @@ Generates C# typed bindings for .resx files - netcoreapp2.1 + netcoreapp3.0 resgen Exe true + true win7-x86;win7-x64;osx-x64;linux-x64 diff --git a/src/System.Management.Automation/engine/PSVersionInfo.cs b/src/System.Management.Automation/engine/PSVersionInfo.cs index 513fb06581e..7140c3e243c 100644 --- a/src/System.Management.Automation/engine/PSVersionInfo.cs +++ b/src/System.Management.Automation/engine/PSVersionInfo.cs @@ -60,7 +60,8 @@ public class PSVersionInfo private static Version s_psV4Version = new Version(4, 0); private static Version s_psV5Version = new Version(5, 0); private static Version s_psV51Version = new Version(5, 1, NTVerpVars.PRODUCTBUILD, NTVerpVars.PRODUCTBUILD_QFE); - private static SemanticVersion s_psV6Version; + private static SemanticVersion s_psV6Version = new SemanticVersion(6, 0, 0, null, null); + private static SemanticVersion s_psV7Version; /// /// A constant to track current PowerShell Edition. @@ -99,12 +100,12 @@ static PSVersionInfo() rawGitCommitId = mainVersion; } - s_psV6Version = new SemanticVersion(mainVersion); + s_psV7Version = new SemanticVersion(mainVersion); - s_psVersionTable[PSVersionInfo.PSVersionName] = s_psV6Version; + s_psVersionTable[PSVersionInfo.PSVersionName] = s_psV7Version; s_psVersionTable[PSVersionInfo.PSEditionName] = PSEditionValue; s_psVersionTable[PSGitCommitIdName] = rawGitCommitId; - s_psVersionTable[PSCompatibleVersionsName] = new Version[] { s_psV1Version, s_psV2Version, s_psV3Version, s_psV4Version, s_psV5Version, s_psV51Version, s_psV6Version }; + s_psVersionTable[PSCompatibleVersionsName] = new Version[] { s_psV1Version, s_psV2Version, s_psV3Version, s_psV4Version, s_psV5Version, s_psV51Version, s_psV6Version, s_psV7Version }; s_psVersionTable[PSVersionInfo.SerializationVersionName] = new Version(InternalSerializer.DefaultVersion); s_psVersionTable[PSVersionInfo.PSRemotingProtocolVersionName] = RemotingConstants.ProtocolVersion; s_psVersionTable[PSVersionInfo.WSManStackVersionName] = GetWSManStackVersion(); @@ -271,6 +272,11 @@ internal static string FeatureVersionString internal static bool IsValidPSVersion(Version version) { + if (version.Major == s_psV7Version.Major) + { + return version.Minor == s_psV7Version.Minor; + } + if (version.Major == s_psV6Version.Major) { return version.Minor == s_psV6Version.Minor; @@ -321,6 +327,11 @@ internal static SemanticVersion PSV6Version get { return s_psV6Version; } } + internal static SemanticVersion PSV7Version + { + get { return s_psV7Version; } + } + #endregion } diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index 808596e6f79..bda39429fdc 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -1182,8 +1182,6 @@ internal static bool IsReservedDeviceName(string destinationPath) string compareName = Path.GetFileName(destinationPath); string noExtensionCompareName = Path.GetFileNameWithoutExtension(destinationPath); - // See if it's the correct length. If it's shorter than CON, AUX, etc, it can't be a device name. - // Likewise, if it's longer than 'CLOCK$', it can't be a device name. if (((compareName.Length < 3) || (compareName.Length > 6)) && ((noExtensionCompareName.Length < 3) || (noExtensionCompareName.Length > 6))) { diff --git a/src/System.Management.Automation/namespaces/NavigationProviderBase.cs b/src/System.Management.Automation/namespaces/NavigationProviderBase.cs index ef44eaeff20..5458e54b1ea 100644 --- a/src/System.Management.Automation/namespaces/NavigationProviderBase.cs +++ b/src/System.Management.Automation/namespaces/NavigationProviderBase.cs @@ -335,7 +335,7 @@ protected string MakePath(string parent, string child, bool childIsLeaf) // If the parent is empty but the child is not, return the // child - result = child.Replace(StringLiterals.AlternatePathSeparator, StringLiterals.DefaultPathSeparator); + result = NormalizePath(child); } else if (!string.IsNullOrEmpty(parent) && string.IsNullOrEmpty(child)) @@ -369,8 +369,8 @@ protected string MakePath(string parent, string child, bool childIsLeaf) // Normalize the path so that only the default path separator is used as a // separator even if the user types the alternate slash. - parent = parent.Replace(StringLiterals.AlternatePathSeparator, StringLiterals.DefaultPathSeparator); - child = child.Replace(StringLiterals.AlternatePathSeparator, StringLiterals.DefaultPathSeparator); + parent = NormalizePath(parent); + child = NormalizePath(child); } // Joins the paths diff --git a/src/TypeCatalogGen/TypeCatalogGen.csproj b/src/TypeCatalogGen/TypeCatalogGen.csproj index 431cd31b926..7b963b907c4 100644 --- a/src/TypeCatalogGen/TypeCatalogGen.csproj +++ b/src/TypeCatalogGen/TypeCatalogGen.csproj @@ -2,10 +2,11 @@ Generates CorePsTypeCatalog.cs given powershell.inc - netcoreapp2.1 + netcoreapp3.0 TypeCatalogGen Exe true + true win7-x86;win7-x64;osx-x64;linux-x64 diff --git a/src/powershell-native/Install-PowerShellRemoting.ps1 b/src/powershell-native/Install-PowerShellRemoting.ps1 index c143127c008..19a80fdc8a1 100644 --- a/src/powershell-native/Install-PowerShellRemoting.ps1 +++ b/src/powershell-native/Install-PowerShellRemoting.ps1 @@ -67,7 +67,7 @@ function Register-WinRmPlugin SDKVersion="2" XmlRenderingType="text" Enabled="True" OutputBufferingMode="Block" ProcessIdleTimeoutSec="0" Architecture="{2}" UseSharedProcess="false" RunAsUser="" RunAsPassword="" AutoRestart="false"> - + diff --git a/src/powershell-unix/powershell-unix.csproj b/src/powershell-unix/powershell-unix.csproj index d2619f9990a..0da368c68bf 100644 --- a/src/powershell-unix/powershell-unix.csproj +++ b/src/powershell-unix/powershell-unix.csproj @@ -7,6 +7,7 @@ pwsh Exe true + true linux-x64;osx-x64; diff --git a/src/powershell-win-core/powershell-win-core.csproj b/src/powershell-win-core/powershell-win-core.csproj index aed9a90c8f8..66f248ae69d 100644 --- a/src/powershell-win-core/powershell-win-core.csproj +++ b/src/powershell-win-core/powershell-win-core.csproj @@ -1,14 +1,23 @@ - + + PowerShell on Windows top-level project pwsh Exe true + true win7-x86;win7-x64 Microsoft.PowerShell + ..\..\assets\pwsh.manifest + + + + + + diff --git a/test/Test.Common.props b/test/Test.Common.props index 5a58ed5591e..ea20813e328 100644 --- a/test/Test.Common.props +++ b/test/Test.Common.props @@ -4,9 +4,8 @@ Microsoft Corporation (c) Microsoft Corporation. All rights reserved. - netcoreapp2.1 - 2.1.8 - Latest + netcoreapp3.0 + 8.0 true true diff --git a/test/hosting/hosting.tests.csproj b/test/hosting/hosting.tests.csproj index 92224de7e8a..f25b83635e9 100644 --- a/test/hosting/hosting.tests.csproj +++ b/test/hosting/hosting.tests.csproj @@ -18,7 +18,7 @@ - + diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index db2bc8ebaaa..1e967dfa50e 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -824,9 +824,14 @@ Describe "Console host api tests" -Tag CI { Describe "Pwsh exe resources tests" -Tag CI { It "Resource strings are embedded in the executable" -Skip:(!$IsWindows) { $pwsh = Get-Item -Path "$PSHOME\pwsh.exe" - $pwsh.VersionInfo.FileVersion | Should -BeExactly $PSVersionTable.PSVersion.ToString().Split("-")[0] - $pwsh.VersionInfo.ProductVersion.Replace("-dirty","") | Should -BeExactly $PSVersionTable.GitCommitId - $pwsh.VersionInfo.ProductName | Should -BeExactly "PowerShell 7" + $pwsh.VersionInfo.FileVersion | Should -Match $PSVersionTable.PSVersion.ToString().Split("-")[0] + $productVersion = $pwsh.VersionInfo.ProductVersion.Replace("-dirty","").Replace(" Commits: ","-").Replace(" SHA: ","-g") + if ($PSVersionTable.GitCommitId.Contains("-g")) { + $productVersion | Should -BeExactly $PSVersionTable.GitCommitId + } else { + $productVersion | Should -Match $PSVersionTable.GitCommitId + } + $pwsh.VersionInfo.ProductName | Should -BeExactly "PowerShell" } It "Manifest contains compatibility section" -Skip:(!$IsWindows) { diff --git a/test/powershell/Host/PSVersionTable.Tests.ps1 b/test/powershell/Host/PSVersionTable.Tests.ps1 index c1e0d5ef837..573a0a8216e 100644 --- a/test/powershell/Host/PSVersionTable.Tests.ps1 +++ b/test/powershell/Host/PSVersionTable.Tests.ps1 @@ -45,7 +45,7 @@ Describe "PSVersionTable" -Tags "CI" { $PSVersionTable.PSVersion | Should -BeOfType "System.Management.Automation.SemanticVersion" $PSVersionTable.PSVersion | Should -BeExactly $expectedPSVersion $PSVersionTable.PSVersion | Should -Match $expectedVersionPattern - $PSVersionTable.PSVersion.Major | Should -Be 6 + $PSVersionTable.PSVersion.Major | Should -Be 7 } It "GitCommitId property" { diff --git a/test/powershell/Host/Startup.Tests.ps1 b/test/powershell/Host/Startup.Tests.ps1 index 8570d6c8a67..af8936411bc 100644 --- a/test/powershell/Host/Startup.Tests.ps1 +++ b/test/powershell/Host/Startup.Tests.ps1 @@ -72,6 +72,7 @@ Describe "Validate start of console host" -Tag CI { 'System.Threading.Tasks.dll' 'System.Threading.Tasks.Parallel.dll' 'System.Threading.Thread.dll' + 'System.Threading.ThreadPool.dll' 'System.Threading.Timer.dll' 'System.Xml.ReaderWriter.dll' 'System.Xml.XDocument.dll' diff --git a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 index 06f29a40b1e..8a30a9b00cb 100644 --- a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 +++ b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 @@ -488,7 +488,7 @@ Describe "TabCompletion" -Tags CI { @{ inputStr = 'function Get-ScrumData {}; Get-Scrum'; expected = 'Get-ScrumData'; setup = $null } @{ inputStr = 'function write-output {param($abcd) $abcd};Write-Output -a'; expected = '-abcd'; setup = $null } @{ inputStr = 'function write-output {param($abcd) $abcd};Microsoft.PowerShell.Utility\Write-Output -'; expected = '-InputObject'; setup = $null } - @{ inputStr = '[math]::Co'; expected = 'Cos('; setup = $null } + @{ inputStr = '[math]::Co'; expected = 'CopySign('; setup = $null } @{ inputStr = '[math]::PI.GetT'; expected = 'GetType('; setup = $null } @{ inputStr = '[math]'; expected = '::E'; setup = $null } @{ inputStr = '[math].'; expected = 'Assembly'; setup = $null } diff --git a/test/powershell/Language/Parser/Parser.Tests.ps1 b/test/powershell/Language/Parser/Parser.Tests.ps1 index 28c40682446..bfaf9a721ef 100644 --- a/test/powershell/Language/Parser/Parser.Tests.ps1 +++ b/test/powershell/Language/Parser/Parser.Tests.ps1 @@ -667,7 +667,7 @@ foo``u{2195}abc #Exponential @{ Script = "0e0"; ExpectedValue = "0"; ExpectedType = [double] } @{ Script = "0e1"; ExpectedValue = "0"; ExpectedType = [double] } - @{ Script = "-0e2"; ExpectedValue = "0"; ExpectedType = [double] } + @{ Script = "-0e2"; ExpectedValue = "-0"; ExpectedType = [double] } @{ Script = "3e0"; ExpectedValue = "3"; ExpectedType = [double] } @{ Script = "5e-2"; ExpectedValue = "0.05"; ExpectedType = [double] } @{ Script = "5e2"; ExpectedValue = "500"; ExpectedType = [double] } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Core/TestGetCommand.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Core/Get-Command.Tests.ps1 similarity index 100% rename from test/powershell/Modules/Microsoft.PowerShell.Core/TestGetCommand.Tests.ps1 rename to test/powershell/Modules/Microsoft.PowerShell.Core/Get-Command.Tests.ps1 diff --git a/test/powershell/Modules/Microsoft.PowerShell.Core/Remove-Module.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Core/Remove-Module.Tests.ps1 index 37739cdb7ad..a12c1e45115 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Core/Remove-Module.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Core/Remove-Module.Tests.ps1 @@ -216,42 +216,42 @@ Describe "Remove-Module : module is readOnly | Constant" -Tags "CI" { New-ModuleManifest -Path "$testdrive\Modules\Foo\Foo_ro.psd1" New-ModuleManifest -Path "$testdrive\Modules\Foo\Foo_rw.psd1" New-ModuleManifest -Path "$testdrive\Modules\Bar\Bar_rw.psd1" - New-ModuleManifest -Path "$testdrive\Modules\Baz\Baz_const.psd1" + New-ModuleManifest -Path "$testdrive\Modules\Baz\Const_module.psd1" New-Item -ItemType File -Path "$testdrive\Modules\Foo\Foo_ro.psm1" > $null New-Item -ItemType File -Path "$testdrive\Modules\Foo\Foo_rw.psm1" > $null New-Item -ItemType File -Path "$testdrive\Modules\Bar\Bar_rw.psm1" > $null - New-Item -ItemType File -Path "$testdrive\Modules\Baz\Baz_const.psm1" > $null + New-Item -ItemType File -Path "$testdrive\Modules\Baz\Const_module.psm1" > $null $removeReadOnlyModulesTestCases = @( # Simple patterns - @{ NamesToRemove = "Foo_ro"; ShouldBeRemoved = ""; ShouldBePresent = "Bar_rw", "Baz_const", "Foo_ro", "Foo_rw"} - @{ NamesToRemove = "Foo_ro", "Foo_rw"; ShouldBeRemoved = "Foo_rw"; ShouldBePresent = "Bar_rw", "Baz_const", "Foo_ro"} - @{ NamesToRemove = "Bar_rw", "Foo_ro", "Foo_rw"; ShouldBeRemoved = "Bar_rw", "Foo_rw"; ShouldBePresent = "Baz_const", "Foo_ro"} + @{ NamesToRemove = "Foo_ro"; ShouldBeRemoved = ""; ShouldBePresent = "Bar_rw", "Const_module", "Foo_ro", "Foo_rw"} + @{ NamesToRemove = "Foo_ro", "Foo_rw"; ShouldBeRemoved = "Foo_rw"; ShouldBePresent = "Bar_rw", "Const_module", "Foo_ro"} + @{ NamesToRemove = "Bar_rw", "Foo_ro", "Foo_rw"; ShouldBeRemoved = "Bar_rw", "Foo_rw"; ShouldBePresent = "Const_module", "Foo_ro"} # Regex patterns - @{ NamesToRemove = "Foo_*"; ShouldBeRemoved = "Foo_rw"; ShouldBePresent = "Bar_rw", "Baz_const", "Foo_ro"} - @{ NamesToRemove = "Foo_*", "Bar_*"; ShouldBeRemoved = "Bar_rw", "Foo_rw"; ShouldBePresent = "Baz_const", "Foo_ro"} + @{ NamesToRemove = "Foo_*"; ShouldBeRemoved = "Foo_rw"; ShouldBePresent = "Bar_rw", "Const_module", "Foo_ro"} + @{ NamesToRemove = "Foo_*", "Bar_*"; ShouldBeRemoved = "Bar_rw", "Foo_rw"; ShouldBePresent = "Const_module", "Foo_ro"} ) $removeForceReadOnlyModulesTestCases = @( # Simple patterns - @{ NamesToRemove = "Foo_ro"; ShouldBeRemoved = "Foo_ro"; ShouldBePresent = "Bar_rw", "Baz_const", "Foo_rw"} - @{ NamesToRemove = "Foo_ro", "Foo_rw"; ShouldBeRemoved = "Foo_ro", "Foo_rw"; ShouldBePresent = "Bar_rw", "Baz_const"} - @{ NamesToRemove = "Bar_rw", "Foo_ro", "Foo_rw"; ShouldBeRemoved = "Bar_rw", "Foo_ro", "Foo_rw"; ShouldBePresent = "Baz_const"} + @{ NamesToRemove = "Foo_ro"; ShouldBeRemoved = "Foo_ro"; ShouldBePresent = "Bar_rw", "Const_module", "Foo_rw"} + @{ NamesToRemove = "Foo_ro", "Foo_rw"; ShouldBeRemoved = "Foo_ro", "Foo_rw"; ShouldBePresent = "Bar_rw", "Const_module"} + @{ NamesToRemove = "Bar_rw", "Foo_ro", "Foo_rw"; ShouldBeRemoved = "Bar_rw", "Foo_ro", "Foo_rw"; ShouldBePresent = "Const_module"} # Regex patterns - @{ NamesToRemove = "Foo_*"; ShouldBeRemoved = "Foo_ro", "Foo_rw"; ShouldBePresent = "Bar_rw", "Baz_const"} - @{ NamesToRemove = "Foo_*", "Bar_*"; ShouldBeRemoved = "Bar_rw", "Foo_ro", "Foo_rw"; ShouldBePresent = "Baz_const"} + @{ NamesToRemove = "Foo_*"; ShouldBeRemoved = "Foo_ro", "Foo_rw"; ShouldBePresent = "Bar_rw", "Const_module"} + @{ NamesToRemove = "Foo_*", "Bar_*"; ShouldBeRemoved = "Bar_rw", "Foo_ro", "Foo_rw"; ShouldBePresent = "Const_module"} ) $removeConstantModulesTestCases = @( # Simple patterns - @{ NamesToRemove = "Baz_const"; ShouldBeRemoved = ""; ShouldBePresent = "Bar_rw", "Baz_const", "Foo_ro", "Foo_rw"} - @{ NamesToRemove = "Baz_const", "Foo_ro", "Foo_rw"; ShouldBeRemoved = "Foo_ro", "Foo_rw"; ShouldBePresent = "Bar_rw", "Baz_const"} + @{ NamesToRemove = "Const_module"; ShouldBeRemoved = ""; ShouldBePresent = "Bar_rw", "Const_module", "Foo_ro", "Foo_rw"} + @{ NamesToRemove = "Const_module", "Foo_ro", "Foo_rw"; ShouldBeRemoved = "Foo_ro", "Foo_rw"; ShouldBePresent = "Bar_rw", "Const_module"} # Regex patterns - @{ NamesToRemove = "Foo_*", "Ba*"; ShouldBeRemoved = "Bar_rw", "Foo_ro", "Foo_rw"; ShouldBePresent = "Baz_const"} + @{ NamesToRemove = "Foo_*", "Ba*", "Const*"; ShouldBeRemoved = "Bar_rw", "Foo_ro", "Foo_rw"; ShouldBePresent = "Const_module"} ) } @@ -264,8 +264,15 @@ Describe "Remove-Module : module is readOnly | Constant" -Tags "CI" { (Get-Module -Name "Foo_ro").AccessMode = "readOnly" Import-Module -Name "$testdrive\Modules\Foo\Foo_rw.psd1" -Force Import-Module -Name "$testdrive\Modules\Bar\Bar_rw.psd1" -Force - Import-Module -Name "$testdrive\Modules\Baz\Baz_const.psd1" -Force - (Get-Module -Name "Baz_const").AccessMode = "Constant" + + # If this test is run again in the same session, this test module + # will already be loaded and can't be removed because it sets + # AccessMode to Constant, so only import this test module and + # set AccessMode if it isn't already loaded + if ($null -eq (Get-Module -Name "Const_module")) { + Import-Module -Name "$testdrive\Modules\Baz\Const_module.psd1" -Force + (Get-Module -Name "Const_module").AccessMode = "Constant" + } } It "Remove-Module (ReadOnly modules): " -TestCases $removeReadOnlyModulesTestCases { @@ -304,7 +311,7 @@ Describe "Remove-Module : module is readOnly | Constant" -Tags "CI" { It "Remove-Module -Force (Constant modules): " -TestCases $removeConstantModulesTestCases { param([string[]]$NamesToRemove, [string[]]$ShouldBeRemoved, [string[]]$ShouldBePresent) - (Get-Module -Name "Bar_rw", "Baz_const", "Foo_ro", "Foo_rw").Name | Should -BeExactly "Bar_rw", "Baz_const", "Foo_ro", "Foo_rw" + (Get-Module -Name "Bar_rw", "Const_module", "Foo_ro", "Foo_rw").Name | Should -BeExactly "Bar_rw", "Const_module", "Foo_ro", "Foo_rw" { Remove-Module -Force -Name $NamesToRemove -ErrorAction Stop } | Should -Throw -ErrorId "Modules_ModuleIsConstant,Microsoft.PowerShell.Commands.RemoveModuleCommand" { Remove-Module -Force -Name $NamesToRemove -ErrorAction SilentlyContinue } | Should -Not -Throw diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 index cb5bf66c085..01f866aaaa0 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 @@ -22,9 +22,33 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" { $newTestFile = "NewTestFile.txt" $testContent = "Some Content" $testContent2 = "More Content" - $reservedNames = "CON", "PRN", "AUX", "CLOCK$", "NUL", - "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", - "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9" + $reservedNamesTests = @( + @{ deviceName = 'CON' } + @{ deviceName = 'PRN' } + @{ deviceName = 'AUX' } + @{ deviceName = 'CLOCK$' } + @{ deviceName = 'NUL' } + @{ deviceName = 'COM0' } + @{ deviceName = 'COM1' } + @{ deviceName = 'COM2' } + @{ deviceName = 'COM3' } + @{ deviceName = 'COM4' } + @{ deviceName = 'COM5' } + @{ deviceName = 'COM6' } + @{ deviceName = 'COM7' } + @{ deviceName = 'COM8' } + @{ deviceName = 'COM9' } + @{ deviceName = 'LPT0' } + @{ deviceName = 'LPT1' } + @{ deviceName = 'LPT2' } + @{ deviceName = 'LPT3' } + @{ deviceName = 'LPT4' } + @{ deviceName = 'LPT5' } + @{ deviceName = 'LPT6' } + @{ deviceName = 'LPT7' } + @{ deviceName = 'LPT8' } + @{ deviceName = 'LPT9' } + ) } BeforeEach { @@ -154,51 +178,39 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" { $contentAfter.Count | Should -Be 0 } - It "Copy-Item on Windows rejects Windows reserved device names" -Skip:(-not $IsWindows) { - foreach ($deviceName in $reservedNames) - { - { Copy-Item -Path $testFile -Destination $deviceName -ErrorAction Stop } | Should -Throw -ErrorId "CopyError,Microsoft.PowerShell.Commands.CopyItemCommand" - } + It "Copy-Item on Windows rejects Windows reserved device name: " -Skip:(-not $IsWindows) -TestCases $reservedNamesTests { + param($deviceName) + { Copy-Item -Path $testFile -Destination $deviceName -ErrorAction Stop } | Should -Throw -ErrorId "CopyError,Microsoft.PowerShell.Commands.CopyItemCommand" } - It "Move-Item on Windows rejects Windows reserved device names" -Skip:(-not $IsWindows) { - foreach ($deviceName in $reservedNames) - { - { Move-Item -Path $testFile -Destination $deviceName -ErrorAction Stop } | Should -Throw -ErrorId "MoveError,Microsoft.PowerShell.Commands.MoveItemCommand" - } + It "Move-Item on Windows rejects Windows reserved device name: " -Skip:(-not $IsWindows) -TestCases $reservedNamesTests { + param($deviceName) + { Move-Item -Path $testFile -Destination $deviceName -ErrorAction Stop } | Should -Throw -ErrorId "MoveError,Microsoft.PowerShell.Commands.MoveItemCommand" } - It "Rename-Item on Windows rejects Windows reserved device names" -Skip:(-not $IsWindows) { - foreach ($deviceName in $reservedNames) - { - { Rename-Item -Path $testFile -NewName $deviceName -ErrorAction Stop } | Should -Throw -ErrorId "RenameError,Microsoft.PowerShell.Commands.RenameItemCommand" - } + It "Rename-Item on Windows rejects Windows reserved device name: " -Skip:(-not $IsWindows) -TestCases $reservedNamesTests { + param($deviceName) + { Rename-Item -Path $testFile -NewName $deviceName -ErrorAction Stop } | Should -Throw -ErrorId "RenameError,Microsoft.PowerShell.Commands.RenameItemCommand" } - It "Copy-Item on Unix succeeds with Windows reserved device names" -Skip:($IsWindows) { - foreach ($deviceName in $reservedNames) - { - Copy-Item -Path $testFile -Destination $deviceName -Force -ErrorAction SilentlyContinue - Test-Path $deviceName | Should -BeTrue - } + It "Copy-Item on Unix succeeds with Windows reserved device name: " -Skip:($IsWindows) -TestCases $reservedNamesTests { + param($deviceName) + Copy-Item -Path $testFile -Destination $deviceName -Force -ErrorAction SilentlyContinue + Test-Path $deviceName | Should -BeTrue } - It "Move-Item on Unix succeeds with Windows reserved device names" -Skip:($IsWindows) { - foreach ($deviceName in $reservedNames) - { - Move-Item -Path $testFile -Destination $deviceName -Force -ErrorAction SilentlyContinue - Test-Path $deviceName | Should -BeTrue - New-Item -Path $testFile -ItemType File -Force -ErrorAction SilentlyContinue - } + It "Move-Item on Unix succeeds with Windows reserved device name: " -Skip:($IsWindows) -TestCases $reservedNamesTests { + param($deviceName) + Move-Item -Path $testFile -Destination $deviceName -Force -ErrorAction SilentlyContinue + Test-Path $deviceName | Should -BeTrue + New-Item -Path $testFile -ItemType File -Force -ErrorAction SilentlyContinue } - It "Rename-Item on Unix succeeds with Windows reserved device names" -Skip:($IsWindows) { - foreach ($deviceName in $reservedNames) - { - Rename-Item -Path $testFile -NewName $deviceName -Force -ErrorAction SilentlyContinue - Test-Path $deviceName | Should -BeTrue - New-Item -Path $testFile -ItemType File -Force -ErrorAction SilentlyContinue - } + It "Rename-Item on Unix succeeds with Windows reserved device name: " -Skip:($IsWindows) -TestCases $reservedNamesTests { + param($deviceName) + Rename-Item -Path $testFile -NewName $deviceName -Force -ErrorAction SilentlyContinue + Test-Path $deviceName | Should -BeTrue + New-Item -Path $testFile -ItemType File -Force -ErrorAction SilentlyContinue } It "Set-Location on Unix succeeds with folder with colon: " -Skip:($IsWindows) -TestCases @( @@ -426,7 +438,7 @@ Describe "Hard link and symbolic link tests" -Tags "CI", "RequireAdminOnWindows" { $item = Get-Item $TestPath $dirName = $item.BaseName - $item = Get-Item $item.PSParentPath + $item = Get-Item $item.PSParentPath -Force if ($item.LinkType -eq "SymbolicLink") { $TestPath = Join-Path $item.Target $dirName @@ -451,50 +463,50 @@ Describe "Hard link and symbolic link tests" -Tags "CI", "RequireAdminOnWindows" Context "New-Item and hard/symbolic links" { It "New-Item can create a hard link to a file" { - New-Item -ItemType HardLink -Path $hardLinkToFile -Value $realFile + New-Item -ItemType HardLink -Path $hardLinkToFile -Value $realFile > $null Test-Path $hardLinkToFile | Should -BeTrue $link = Get-Item -Path $hardLinkToFile $link.LinkType | Should -BeExactly "HardLink" Get-Content -Path $hardLinkToFile | Should -Be $fileContent } It "New-Item can create symbolic link to file" { - New-Item -ItemType SymbolicLink -Path $symLinkToFile -Value $realFile + New-Item -ItemType SymbolicLink -Path $symLinkToFile -Value $realFile > $null Test-Path $symLinkToFile | Should -BeTrue $real = Get-Item -Path $realFile $link = Get-Item -Path $symLinkToFile $link.LinkType | Should -BeExactly "SymbolicLink" - $link.Target | Should -Be $real.FullName + $link.Target | Should -BeExactly $real.ToString() Get-Content -Path $symLinkToFile | Should -Be $fileContent } It "New-Item can create a symbolic link to nothing" { - New-Item -ItemType SymbolicLink -Path $symLinkToNothing -Value $nonFile + New-Item -ItemType SymbolicLink -Path $symLinkToNothing -Value $nonFile > $null Test-Path $symLinkToNothing | Should -BeTrue $link = Get-Item -Path $symLinkToNothing $link.LinkType | Should -BeExactly "SymbolicLink" - $link.Target | Should -Be $nonFile + $link.Target | Should -Be $nonFile.ToString() } It "New-Item emits an error when path to symbolic link already exists." { { New-Item -ItemType SymbolicLink -Path $realDir -Value $symLinkToDir -ErrorAction Stop } | Should -Throw -ErrorId "SymLinkExists,Microsoft.PowerShell.Commands.NewItemCommand" } It "New-Item can create a symbolic link to a directory" -Skip:($IsWindows) { - New-Item -ItemType SymbolicLink -Path $symLinkToDir -Value $realDir + New-Item -ItemType SymbolicLink -Path $symLinkToDir -Value $realDir > $null Test-Path $symLinkToDir | Should -BeTrue $real = Get-Item -Path $realDir $link = Get-Item -Path $symLinkToDir $link.LinkType | Should -BeExactly "SymbolicLink" - $link.Target | Should -Be $real.FullName + $link.Target | Should -BeExactly $real.ToString() } It "New-Item can create a directory symbolic link to a directory" -Skip:(-Not $IsWindows) { - New-Item -ItemType SymbolicLink -Path $symLinkToDir -Value $realDir + New-Item -ItemType SymbolicLink -Path $symLinkToDir -Value $realDir > $null Test-Path $symLinkToDir | Should -BeTrue $real = Get-Item -Path $realDir $link = Get-Item -Path $symLinkToDir $link | Should -BeOfType System.IO.DirectoryInfo $link.LinkType | Should -BeExactly "SymbolicLink" - $link.Target | Should -BeExactly $real.FullName + $link.Target | Should -BeExactly $real.ToString() } It "New-Item can create a directory junction to a directory" -Skip:(-Not $IsWindows) { - New-Item -ItemType Junction -Path $junctionToDir -Value $realDir + New-Item -ItemType Junction -Path $junctionToDir -Value $realDir > $null Test-Path $junctionToDir | Should -BeTrue } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 index db1d117a4c7..ed35c6437cc 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 @@ -16,10 +16,14 @@ Describe "Get-Process for admin" -Tags @('CI', 'RequireAdminOnWindows') { It "Should support -FileVersionInfo" { $pwshVersion = Get-Process -Id $pid -FileVersionInfo if ($IsWindows) { - $PSVersionTable.PSVersion | Should -MatchExactly $pwshVersion.FileVersion + $pwshVersion.FileVersion | Should -Match $PSVersionTable.PSVersion.ToString().Split("-")[0] + $pwshVersion.FileMajorPart | Should -BeExactly $PSVersionTable.PSVersion.Major + $pwshVersion.FileMinorPart | Should -BeExactly $PSVersionTable.PSVersion.Minor + $pwshVersion.FileBuildPart | Should -BeExactly $PSVersionTable.PSVersion.Patch $gitCommitId = $PSVersionTable.GitCommitId if ($gitCommitId.StartsWith("v")) { $gitCommitId = $gitCommitId.Substring(1) } - $pwshVersion.ProductVersion.Replace("-dirty","") | Should -BeExactly $gitCommitId + $productVersion = $pwshVersion.ProductVersion.Replace(" Commits: ","-").Replace(" SHA: ","-g") + $productVersion | Should -Match $gitCommitId } else { $pwshVersion.FileVersion | Should -BeNullOrEmpty } 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 8eb68012492..a4a2c14433f 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 @@ -78,7 +78,7 @@ Describe "Test-Connection" -tags "CI" { { $result = Test-Connection "fakeHost" -Count 1 -Quiet -ErrorAction Stop } | Should -Throw -ErrorId "TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand" # Error code = 11001 - Host not found. if (!$isWindows) { - $Error[0].Exception.InnerException.ErrorCode | Should -Be 6 + $Error[0].Exception.InnerException.ErrorCode | Should -Be -131073 } else { $Error[0].Exception.InnerException.ErrorCode | Should -Be 11001 } @@ -113,8 +113,9 @@ Describe "Test-Connection" -tags "CI" { $result2.Replies[0].Status | Should -BeIn "TtlExpired","TimedOut","Success" } else { $result1.Replies[0].Options.DontFragment | Should -BeFalse - # We expect 'TtlExpired' but if a router don't reply we get `TimeOut` - $result2.Replies[0].Status | Should -BeIn "TtlExpired","TimedOut" + # We expect 'TtlExpired' but if a router don't reply we get `TimedOut` + # AzPipelines returns $null + $result2.Replies[0].Status | Should -BeIn "TtlExpired","TimedOut",$null } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Pester.Commands.Cmdlets.Json.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Json.Tests.ps1 similarity index 99% rename from test/powershell/Modules/Microsoft.PowerShell.Utility/Pester.Commands.Cmdlets.Json.Tests.ps1 rename to test/powershell/Modules/Microsoft.PowerShell.Utility/Json.Tests.ps1 index 35d3bc68ba2..da7c67f875b 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Pester.Commands.Cmdlets.Json.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Json.Tests.ps1 @@ -1210,13 +1210,13 @@ Describe "Validate Json serialization" -Tags "CI" { # Single @{ TestInput = '[single]::MaxValue' - FromJson = "3.40282347E+38" - ToJson = "3.40282347E+38" + FromJson = "3.4028235E+38" + ToJson = "3.4028235E+38" } @{ TestInput = '[single]::MinValue' - FromJson = "-3.40282347E+38" - ToJson = "-3.40282347E+38" + FromJson = "-3.4028235E+38" + ToJson = "-3.4028235E+38" } # Double diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Measure-Object.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Measure-Object.Tests.ps1 index 4f363fe972b..55ddd830671 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Measure-Object.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Measure-Object.Tests.ps1 @@ -182,7 +182,7 @@ Describe "Measure-Object" -Tags "CI" { $result.Sum | Should -Be 55 $result.Minimum | Should -Be 1 $result.Maximum | Should -Be 10 - ($result.StandardDeviation).ToString() | Should -Be '3.02765035409749' + ($result.StandardDeviation).ToString() | Should -Be '3.0276503540974917' } } diff --git a/test/powershell/engine/Basic/Assembly.LoadWithPartialName.Tests.ps1 b/test/powershell/engine/Basic/Assembly.LoadWithPartialName.Tests.ps1 index edf54b703dc..8d618d21c6f 100644 --- a/test/powershell/engine/Basic/Assembly.LoadWithPartialName.Tests.ps1 +++ b/test/powershell/engine/Basic/Assembly.LoadWithPartialName.Tests.ps1 @@ -6,6 +6,8 @@ Describe "Assembly::LoadWithPartialName Validation Test" -Tags "CI" { $defaultErrorId = 'FileLoadException' $testcases = @( # verify winforms is blocked + # winforms assembly is supported for .Net Core 3.0, if a new assembly needs to be blocked + # enable this test and add to list below @{ Name = 'system.windows.forms' ErrorId = $defaultErrorId @@ -19,7 +21,11 @@ Describe "Assembly::LoadWithPartialName Validation Test" -Tags "CI" { # All existing cases should fail on all platforms either because it doesn't exist or # because the assembly is blacklisted - It "Assembly::LoadWithPartialName should fail to load blacklisted assembly: " -TestCases $testcases { + + # This test is currently being skipped because System.Windows.Forms is part of .NET Core 3.0 so it gets + # load and thus no exception is thrown failing this test. + + It "Assembly::LoadWithPartialName should fail to load blacklisted assembly: " -Pending -TestCases $testcases { param( [Parameter(Mandatory)] [string] diff --git a/test/powershell/engine/Basic/TypeResolution.Tests.ps1 b/test/powershell/engine/Basic/TypeResolution.Tests.ps1 new file mode 100644 index 00000000000..c192622868a --- /dev/null +++ b/test/powershell/engine/Basic/TypeResolution.Tests.ps1 @@ -0,0 +1,11 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +Describe "Resolve types in additional referenced assemblies" -Tag CI { + It "Will resolve DirectoryServices type " -TestCases @( + @{ typename = "[System.DirectoryServices.AccountManagement.AdvancedFilters]"; name = "AdvancedFilters" } + ){ + param ($typename, $name) + pwsh -noprofile -command "$typename.Name" | Should -BeExactly $name + } +} diff --git a/test/tools/OpenCover/OpenCover.psm1 b/test/tools/OpenCover/OpenCover.psm1 index c6892ae714e..488a20ac7b9 100644 --- a/test/tools/OpenCover/OpenCover.psm1 +++ b/test/tools/OpenCover/OpenCover.psm1 @@ -624,7 +624,7 @@ function Invoke-OpenCover [parameter()]$OutputLog = "$home/Documents/OpenCover.xml", [parameter()]$TestPath = "${script:psRepoPath}/test/powershell", [parameter()]$OpenCoverPath = "$home/OpenCover", - [parameter()]$PowerShellExeDirectory = "${script:psRepoPath}/src/powershell-win-core/bin/CodeCoverage/netcoreapp2.1/win7-x64/publish", + [parameter()]$PowerShellExeDirectory = "${script:psRepoPath}/src/powershell-win-core/bin/CodeCoverage/netcoreapp3.0/win7-x64/publish", [parameter()]$PesterLogElevated = "$HOME/Documents/TestResultsElevated.xml", [parameter()]$PesterLogUnelevated = "$HOME/Documents/TestResultsUnelevated.xml", [parameter()]$PesterLogFormat = "NUnitXml", diff --git a/test/tools/TestExe/TestExe.csproj b/test/tools/TestExe/TestExe.csproj index d1e58bb8534..a57ff9b8e9d 100644 --- a/test/tools/TestExe/TestExe.csproj +++ b/test/tools/TestExe/TestExe.csproj @@ -7,6 +7,7 @@ testexe Exe true + true win7-x86;win7-x64;osx-x64;linux-x64 diff --git a/test/tools/TestService/TestService.csproj b/test/tools/TestService/TestService.csproj index f414855d473..3da35830db7 100644 --- a/test/tools/TestService/TestService.csproj +++ b/test/tools/TestService/TestService.csproj @@ -7,6 +7,7 @@ TestService Exe true + true win7-x86;win7-x64 diff --git a/test/tools/WebListener/Controllers/MultipartController.cs b/test/tools/WebListener/Controllers/MultipartController.cs index 43c43681932..435347470ad 100644 --- a/test/tools/WebListener/Controllers/MultipartController.cs +++ b/test/tools/WebListener/Controllers/MultipartController.cs @@ -17,9 +17,9 @@ namespace mvc.Controllers { public class MultipartController : Controller { - private IHostingEnvironment _environment; + private IWebHostEnvironment _environment; - public MultipartController(IHostingEnvironment environment) + public MultipartController(IWebHostEnvironment environment) { _environment = environment; } diff --git a/test/tools/WebListener/Program.cs b/test/tools/WebListener/Program.cs index a5535500fc2..54af72860fe 100644 --- a/test/tools/WebListener/Program.cs +++ b/test/tools/WebListener/Program.cs @@ -23,7 +23,7 @@ public static void Main(string[] args) if (args.Count() != 6) { System.Console.WriteLine("Required: "); - Environment.Exit(1); + Environment.Exit(1); } BuildWebHost(args).Run(); @@ -33,6 +33,7 @@ public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder() .UseStartup().UseKestrel(options => { + options.AllowSynchronousIO = true; options.Listen(IPAddress.Loopback, int.Parse(args[2])); options.Listen(IPAddress.Loopback, int.Parse(args[3]), listenOptions => { diff --git a/test/tools/WebListener/Startup.cs b/test/tools/WebListener/Startup.cs index 96aca01e2f6..4cf2685cadc 100644 --- a/test/tools/WebListener/Startup.cs +++ b/test/tools/WebListener/Startup.cs @@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Routing.Constraints; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; namespace mvc { @@ -25,11 +26,14 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc(); + services.AddMvc(options => { + options.EnableEndpointRouting = false; + }) + .AddNewtonsoftJson(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { diff --git a/test/tools/WebListener/WebListener.csproj b/test/tools/WebListener/WebListener.csproj index 50fc0964d53..4836fa84b4d 100644 --- a/test/tools/WebListener/WebListener.csproj +++ b/test/tools/WebListener/WebListener.csproj @@ -7,7 +7,7 @@ - + diff --git a/tools/metadata.json b/tools/metadata.json index 41340363b50..70d9c37d4ce 100644 --- a/tools/metadata.json +++ b/tools/metadata.json @@ -1,7 +1,7 @@ { "StableReleaseTag": "v6.2.0", - "PreviewReleaseTag": "v6.2.0-rc.1", + "PreviewReleaseTag": "v7.0.0-preview.1", "ServicingReleaseTag": "v6.0.5", - "ReleaseTag": "v6.2.0", - "NextReleaseTag": "v6.2.0-rc.1" + "ReleaseTag": "v7.0.0", + "NextReleaseTag": "v7.0.0-preview.1" } diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 99f6bc95e0f..3cba50d5fdb 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -125,14 +125,14 @@ function Start-PSPackage { -not $Script:Options -or ## Start-PSBuild hasn't been executed yet -not $PSModuleRestoreCorrect -or ## Last build didn't specify '-PSModuleRestore' correctly $Script:Options.Configuration -ne $Configuration -or ## Last build was with configuration other than 'Release' - $Script:Options.Framework -ne "netcoreapp2.1" ## Last build wasn't for CoreCLR + $Script:Options.Framework -ne "netcoreapp3.0" ## Last build wasn't for CoreCLR } else { -not $Script:Options -or ## Start-PSBuild hasn't been executed yet -not $crossGenCorrect -or ## Last build didn't specify '-CrossGen' correctly -not $PSModuleRestoreCorrect -or ## Last build didn't specify '-PSModuleRestore' correctly $Script:Options.Runtime -ne $Runtime -or ## Last build wasn't for the required RID $Script:Options.Configuration -ne $Configuration -or ## Last build was with configuration other than 'Release' - $Script:Options.Framework -ne "netcoreapp2.1" ## Last build wasn't for CoreCLR + $Script:Options.Framework -ne "netcoreapp3.0" ## Last build wasn't for CoreCLR } # Make sure the most recent build satisfies the package requirement @@ -1437,7 +1437,7 @@ function CreateNugetPlatformFolder [string] $PlatformBinPath ) - $destPath = New-Item -ItemType Directory -Path (Join-Path $PackageRuntimesFolder "$Platform/lib/netcoreapp2.1") + $destPath = New-Item -ItemType Directory -Path (Join-Path $PackageRuntimesFolder "$Platform/lib/netcoreapp3.0") $fullPath = Join-Path $PlatformBinPath $file if (-not(Test-Path $fullPath)) { @@ -1535,7 +1535,7 @@ function New-ILNugetPackage $packageRuntimesFolder = New-Item (Join-Path $filePackageFolder.FullName 'runtimes') -ItemType Directory #region ref - $refFolder = New-Item (Join-Path $filePackageFolder.FullName 'ref/netcoreapp2.1') -ItemType Directory -Force + $refFolder = New-Item (Join-Path $filePackageFolder.FullName 'ref/netcoreapp3.0') -ItemType Directory -Force CopyReferenceAssemblies -assemblyName $fileBaseName -refBinPath $refBinPath -refNugetPath $refFolder -assemblyFileList $fileList #endregion ref @@ -1655,7 +1655,7 @@ function New-ILNugetPackage } <# - Copy the generated reference assemblies to the 'ref/netcoreapp2.1' folder properly. + Copy the generated reference assemblies to the 'ref/netcoreapp3.0' folder properly. This is a helper function used by 'New-ILNugetPackage' #> function CopyReferenceAssemblies @@ -1892,7 +1892,7 @@ function New-ReferenceAssembly Write-Log "Running: dotnet $arguments" Start-NativeExecution -sb {dotnet $arguments} - $refBinPath = Join-Path $projectFolder "bin/Release/netcoreapp2.1/$assemblyName.dll" + $refBinPath = Join-Path $projectFolder "bin/Release/netcoreapp3.0/$assemblyName.dll" if ($null -eq $refBinPath) { throw "Reference assembly was not built." } @@ -2546,7 +2546,7 @@ function New-MSIPatch # This example shows how to produce a Debug-x64 installer for development purposes. cd $RootPathOfPowerShellRepo Import-Module .\build.psm1; Import-Module .\tools\packaging\packaging.psm1 - New-MSIPackage -Verbose -ProductCode (New-Guid) -ProductSourcePath '.\src\powershell-win-core\bin\Debug\netcoreapp2.1\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3' + New-MSIPackage -Verbose -ProductCode (New-Guid) -ProductSourcePath '.\src\powershell-win-core\bin\Debug\netcoreapp3.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3' #> function New-MSIPackage { @@ -2746,7 +2746,7 @@ function New-MSIPackage # This example shows how to produce a Debug-x64 installer for development purposes. cd $RootPathOfPowerShellRepo Import-Module .\build.psm1; Import-Module .\tools\packaging\packaging.psm1 - New-MSIXPackage -Verbose -ProductSourcePath '.\src\powershell-win-core\bin\Debug\netcoreapp2.1\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3' + New-MSIXPackage -Verbose -ProductSourcePath '.\src\powershell-win-core\bin\Debug\netcoreapp3.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3' #> function New-MSIXPackage { @@ -2923,7 +2923,6 @@ function Test-FileWxs { $passed = $false $folder = Split-Path -Path $file - $name = Split-Path -Path $file -Leaf $heatNode = $heatNodesByFile[$file] $compGroupNode = Get-ComponentGroupNode -XmlDoc $newFilesAssetXml -XmlNsManager $xmlns $filesNode = Get-DirectoryNode -Node $heatNode -XmlDoc $newFilesAssetXml -XmlNsManager $xmlns @@ -3263,7 +3262,7 @@ function New-GlobalToolNupkg } $packageInfo | ForEach-Object { - $ridFolder = New-Item -Path (Join-Path $_.RootFolder "tools/netcoreapp2.1/any") -ItemType Directory + $ridFolder = New-Item -Path (Join-Path $_.RootFolder "tools/netcoreapp3.0/any") -ItemType Directory $packageType = $_.Type diff --git a/tools/packaging/packaging.strings.psd1 b/tools/packaging/packaging.strings.psd1 index 239e61e47cc..6fce2ea65da 100644 --- a/tools/packaging/packaging.strings.psd1 +++ b/tools/packaging/packaging.strings.psd1 @@ -132,7 +132,7 @@ open {0} - + diff --git a/tools/packaging/projects/nuget/package.csproj b/tools/packaging/projects/nuget/package.csproj index bb6c3dbef85..4703f78e341 100644 --- a/tools/packaging/projects/nuget/package.csproj +++ b/tools/packaging/projects/nuget/package.csproj @@ -11,6 +11,6 @@ runtime=$(RID);version=$(SemVer);PackageName=$(PackageName) $(StagingPath) True - netcoreapp2.1 + netcoreapp3.0