From 0dfb1b07ddda289fb7cce7f9d9f8b7ff3b38a2a2 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Thu, 1 Oct 2020 17:53:12 +0300 Subject: [PATCH 1/3] Enable Java tests since Java switching was fixed in MacOS 11.0 beta 9 --- images/macos/software-report/SoftwareReport.Generator.ps1 | 6 ++---- images/macos/tests/Java.Tests.ps1 | 2 +- images/macos/tests/Python.Tests.ps1 | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/images/macos/software-report/SoftwareReport.Generator.ps1 b/images/macos/software-report/SoftwareReport.Generator.ps1 index 87c944598fa3..b403cd788c2c 100644 --- a/images/macos/software-report/SoftwareReport.Generator.ps1 +++ b/images/macos/software-report/SoftwareReport.Generator.ps1 @@ -80,6 +80,7 @@ $homebrewVersion = Run-Command "brew --version" | Select-Object -First 1 $npmVersion = Run-Command "npm --version" $yarnVersion = Run-Command "yarn --version" $nugetVersion = Run-Command "nuget help" | Select-Object -First 1 | Take-Part -Part 2 +$pipVersion = Get-PipVersion -Version 2 $pip3Version = Get-PipVersion -Version 3 $condaVersion = Invoke-Expression "conda --version" $rubyGemsVersion = Run-Command "gem --version" @@ -90,12 +91,9 @@ if ($os.IsHigherThanMojave) { $vcpkgVersion = Get-VcpkgVersion $markdown += New-MDList -Lines $vcpkgVersion -Style Unordered -NoNewLine } -if ($os.IsLessThanBigSur) { - $pipVersion = Get-PipVersion -Version 2 - $markdown += New-MDList -Style Unordered -Lines @("Pip ${pipVersion}") -NoNewLine -} $markdown += New-MDList -Style Unordered -Lines @( + "Pip ${pipVersion}", "Pip ${pip3Version}", $bundlerVersion, "Carthage ${carthageVersion}", diff --git a/images/macos/tests/Java.Tests.ps1 b/images/macos/tests/Java.Tests.ps1 index 9171eb5b1c59..450c23ecc4c3 100644 --- a/images/macos/tests/Java.Tests.ps1 +++ b/images/macos/tests/Java.Tests.ps1 @@ -11,7 +11,7 @@ function Get-NativeVersionFormat { return $Version } -Describe "Java" -Skip:($os.IsBigSur) { +Describe "Java" { BeforeAll { function Validate-JavaVersion { param($JavaCommand, $ExpectedVersion) diff --git a/images/macos/tests/Python.Tests.ps1 b/images/macos/tests/Python.Tests.ps1 index 76cd8941b198..76e5b497c6fd 100644 --- a/images/macos/tests/Python.Tests.ps1 +++ b/images/macos/tests/Python.Tests.ps1 @@ -12,7 +12,7 @@ Describe "Python" { (Get-CommandResult "python --version").Output | Should -BeLike "Python 2.*" } - It "Python 2 is installed under /usr/local/bin" -Skip:($os.IsBigSur) { + It "Python 2 is installed under /usr/local/bin" { Get-WhichTool "python" | Should -BeLike "/usr/local/bin*" } @@ -24,7 +24,7 @@ Describe "Python" { Get-WhichTool "python3" | Should -BeLike "/usr/local/bin*" } - It "Pip 2 is available" -Skip:($os.IsBigSur) { + It "Pip 2 is available" { "pip --version" | Should -ReturnZeroExitCode } From 5ec18c4b3d47230b0bca0da4b615f348a171e55a Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Mon, 2 Nov 2020 15:47:58 +0300 Subject: [PATCH 2/3] Update Java.Tests.ps1 --- images/macos/tests/Java.Tests.ps1 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/images/macos/tests/Java.Tests.ps1 b/images/macos/tests/Java.Tests.ps1 index 450c23ecc4c3..9e21a5e40d48 100644 --- a/images/macos/tests/Java.Tests.ps1 +++ b/images/macos/tests/Java.Tests.ps1 @@ -38,17 +38,15 @@ Describe "Java" { } It "Version is valid" -TestCases $_ { - $javaRootPath = (Get-CommandResult "/usr/libexec/java_home -v${Version}").Output + $javaRootPath = "/Library/Java/JavaVirtualMachines/adoptopenjdk-${Title}.jdk//Contents/Home" $javaBinPath = Join-Path $javaRootPath "/bin/java" Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version } It "" -TestCases $_ { $envVariablePath = Get-EnvironmentVariable $EnvVariable - $commandResult = Get-CommandResult "/usr/libexec/java_home -v${Version}" - $commandResult.ExitCode | Should -Be 0 - $commandResult.Output | Should -Not -BeNullOrEmpty - $commandResult.Output | Should -Be $envVariablePath + $javaBinPath = Join-Path $envVariablePath "/bin/java" + Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version } if ($_.Title -eq "Default") { From 43e905b4bd90fa014a531a7cfce12b7d781cce4b Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Tue, 3 Nov 2020 16:58:07 +0300 Subject: [PATCH 3/3] Update Java.Tests.ps1 --- images/macos/tests/Java.Tests.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/images/macos/tests/Java.Tests.ps1 b/images/macos/tests/Java.Tests.ps1 index 9e21a5e40d48..3ece545f40d6 100644 --- a/images/macos/tests/Java.Tests.ps1 +++ b/images/macos/tests/Java.Tests.ps1 @@ -1,8 +1,6 @@ Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -#Java tests are disabled because Java is not working properly on macOS 11.0 yet. -$os = Get-OSVersion function Get-NativeVersionFormat { param($Version) if ($Version -in "7", "8") { @@ -37,10 +35,13 @@ Describe "Java" { "/usr/libexec/java_home -v${Version}" | Should -ReturnZeroExitCode } - It "Version is valid" -TestCases $_ { - $javaRootPath = "/Library/Java/JavaVirtualMachines/adoptopenjdk-${Title}.jdk//Contents/Home" - $javaBinPath = Join-Path $javaRootPath "/bin/java" - Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version + if ($_.Title -ne "Default") { + It "Version is valid" -TestCases $_ { + $javaRootPath = "/Library/Java/JavaVirtualMachines/adoptopenjdk-${Title}.jdk/Contents/Home" + if ($Title -eq "7") { $javaRootPath = "/Library/Java/JavaVirtualMachines/zulu-7.jdk/Contents/Home" } + $javaBinPath = Join-Path $javaRootPath "/bin/java" + Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version + } } It "" -TestCases $_ {