From 9802e2ce71fd328b0d9c5f964793fd251e4f7226 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Wed, 21 Mar 2018 16:12:49 -0700 Subject: [PATCH 1/5] add application manifest dictating compatibility so that osversion shows appropriate os version on Windows --- assets/pwsh.1.manifest | 26 ++++++++++++++++++++++ build.psm1 | 3 ++- test/powershell/Host/ConsoleHost.Tests.ps1 | 15 +++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 assets/pwsh.1.manifest diff --git a/assets/pwsh.1.manifest b/assets/pwsh.1.manifest new file mode 100644 index 00000000000..3584aba51b5 --- /dev/null +++ b/assets/pwsh.1.manifest @@ -0,0 +1,26 @@ + + + PowerShell Core 6 + + + + + + + + + + + + + + + + + + + + diff --git a/build.psm1 b/build.psm1 index 43d9363ce12..330be4a1176 100644 --- a/build.psm1 +++ b/build.psm1 @@ -630,7 +630,8 @@ Fix steps: Start-NativeExecution { & "~/.rcedit/rcedit-x64.exe" $pwshPath --set-icon "$PSScriptRoot\assets\Powershell_black.ico" ` --set-file-version $fileVersion --set-product-version $ReleaseVersion --set-version-string "ProductName" "PowerShell Core 6" ` - --set-requested-execution-level "asInvoker" --set-version-string "LegalCopyright" "(C) Microsoft Corporation. All Rights Reserved." } | Write-Verbose + --set-version-string "LegalCopyright" "(C) Microsoft Corporation. All Rights Reserved." ` + --application-manifest "$PSScriptRoot\assets\pwsh.manifest" } | Write-Verbose } # download modules from powershell gallery. diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index 09d0889afde..2d8e1846bc4 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -663,3 +663,18 @@ 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 + $pwsh.VersionInfo.ProductVersion.Replace("-dirty","") | Should -BeExactly $PSVersionTable.GitCommitId.Replace("v","") + $pwsh.VersionInfo.ProductName | Should -BeExactly "PowerShell Core 6" + } + + It "Manifest contains compatibility section" -Skip:(!$IsWindows) { + $osversion = [System.Environment]::OSVersion.Version + $osversionString = $psversiontable.os -replace "^Microsoft Windows (\d+\.\d+).*$",'$1' + "$($osversion.Major).$($osversion.Minor)" | Should -BeExactly $osversionString + } +} From 1cd3c42f4fe97d1b08a6c2baed67a40baaa2df1c Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 27 Mar 2018 09:22:41 -0700 Subject: [PATCH 2/5] address PR feedback from Ilya --- assets/{pwsh.1.manifest => pwsh.manifest} | 0 test/powershell/Host/ConsoleHost.Tests.ps1 | 3 +-- 2 files changed, 1 insertion(+), 2 deletions(-) rename assets/{pwsh.1.manifest => pwsh.manifest} (100%) diff --git a/assets/pwsh.1.manifest b/assets/pwsh.manifest similarity index 100% rename from assets/pwsh.1.manifest rename to assets/pwsh.manifest diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index 2d8e1846bc4..a3c0c0d45d1 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -674,7 +674,6 @@ Describe "Pwsh exe resources tests" -Tag CI { It "Manifest contains compatibility section" -Skip:(!$IsWindows) { $osversion = [System.Environment]::OSVersion.Version - $osversionString = $psversiontable.os -replace "^Microsoft Windows (\d+\.\d+).*$",'$1' - "$($osversion.Major).$($osversion.Minor)" | Should -BeExactly $osversionString + $psversiontable.os | Should -Match "$($osversion.Major).$($osversion.Minor)" } } From b310e6555337b1fca2af2638a0f0e7b0134f06b0 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 27 Mar 2018 12:34:35 -0700 Subject: [PATCH 3/5] fix test to remove semantic version label for validation --- test/powershell/Host/ConsoleHost.Tests.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index a3c0c0d45d1..96dc955b8d1 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -667,13 +667,17 @@ 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 + $fileVersion = $PSVersionTable.PSVersion.ToString() + if ($fileVersion.Contains("-")) { + $fileVersion = $fileVersion.Split("-")[0] + } + $pwsh.VersionInfo.FileVersion | Should -BeExactly $fileVersion $pwsh.VersionInfo.ProductVersion.Replace("-dirty","") | Should -BeExactly $PSVersionTable.GitCommitId.Replace("v","") $pwsh.VersionInfo.ProductName | Should -BeExactly "PowerShell Core 6" } It "Manifest contains compatibility section" -Skip:(!$IsWindows) { $osversion = [System.Environment]::OSVersion.Version - $psversiontable.os | Should -Match "$($osversion.Major).$($osversion.Minor)" + $psversiontable.os | Should -MatchExactly "$($osversion.Major).$($osversion.Minor)" } } From 488fe4f0f1c055b24fad342658543b79d0cd8b55 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 27 Mar 2018 13:08:26 -0700 Subject: [PATCH 4/5] fix gitcommitid validation --- test/powershell/Host/ConsoleHost.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index 96dc955b8d1..526aea5b680 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -672,7 +672,7 @@ Describe "Pwsh exe resources tests" -Tag CI { $fileVersion = $fileVersion.Split("-")[0] } $pwsh.VersionInfo.FileVersion | Should -BeExactly $fileVersion - $pwsh.VersionInfo.ProductVersion.Replace("-dirty","") | Should -BeExactly $PSVersionTable.GitCommitId.Replace("v","") + "v" + $pwsh.VersionInfo.ProductVersion.Replace("-dirty","") | Should -BeExactly $PSVersionTable.GitCommitId $pwsh.VersionInfo.ProductName | Should -BeExactly "PowerShell Core 6" } From 447a545a550a2ab034128ee5337b29edc2c233ef Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 27 Mar 2018 21:38:11 -0700 Subject: [PATCH 5/5] address Ilya's feedback --- test/powershell/Host/ConsoleHost.Tests.ps1 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index 526aea5b680..9fc8851ddbd 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -667,11 +667,7 @@ 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" - $fileVersion = $PSVersionTable.PSVersion.ToString() - if ($fileVersion.Contains("-")) { - $fileVersion = $fileVersion.Split("-")[0] - } - $pwsh.VersionInfo.FileVersion | Should -BeExactly $fileVersion + $pwsh.VersionInfo.FileVersion | Should -BeExactly $PSVersionTable.PSVersion.ToString().Split("-")[0] "v" + $pwsh.VersionInfo.ProductVersion.Replace("-dirty","") | Should -BeExactly $PSVersionTable.GitCommitId $pwsh.VersionInfo.ProductName | Should -BeExactly "PowerShell Core 6" }