From 002f86637ac063805833c1794f414a1fc5be903a Mon Sep 17 00:00:00 2001 From: sarathrajsrinivasan <159180023+sarathrajsrinivasan@users.noreply.github.com> Date: Fri, 31 Jan 2025 11:45:21 -0600 Subject: [PATCH] [macOS] Update condition for mono test case (#11515) --- images/macos/scripts/tests/Mono.Tests.ps1 | 92 ++++++++++++----------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/images/macos/scripts/tests/Mono.Tests.ps1 b/images/macos/scripts/tests/Mono.Tests.ps1 index 5d2822306..9cfa326f4 100644 --- a/images/macos/scripts/tests/Mono.Tests.ps1 +++ b/images/macos/scripts/tests/Mono.Tests.ps1 @@ -14,61 +14,63 @@ BeforeAll { } } -Describe "Mono" -Skip:($os.IsSequoia) { - $MONO_VERSIONS_PATH = "/Library/Frameworks/Mono.framework/Versions" - $monoToolsetVersion = @((Get-ToolsetContent).mono.framework.version) - $versionFolderPath = Join-Path $MONO_VERSIONS_PATH ([System.Version]::Parse($monoToolsetVersion).ToString(3)) - $testCase = @{ MonoVersion = $monoToolsetVersion; VersionFolderPath = $versionFolderPath; MonoVersionsPath = $MONO_VERSIONS_PATH } +if ($os.IsVentura -or $os.IsSonoma) { + Describe "Mono" { + $MONO_VERSIONS_PATH = "/Library/Frameworks/Mono.framework/Versions" + $monoToolsetVersion = @((Get-ToolsetContent).mono.framework.version) + $versionFolderPath = Join-Path $MONO_VERSIONS_PATH ([System.Version]::Parse($monoToolsetVersion).ToString(3)) + $testCase = @{ MonoVersion = $monoToolsetVersion; VersionFolderPath = $versionFolderPath; MonoVersionsPath = $MONO_VERSIONS_PATH } - It "is installed" -TestCases $testCase { - param ( [string] $VersionFolderPath ) + It "is installed" -TestCases $testCase { + param ( [string] $VersionFolderPath ) - $monoBinPath = Join-Path $VersionFolderPath "bin" "mono" - $VersionFolderPath | Should -Exist - $monoBinPath | Should -Exist - } + $monoBinPath = Join-Path $VersionFolderPath "bin" "mono" + $VersionFolderPath | Should -Exist + $monoBinPath | Should -Exist + } - It "is available via short link" -TestCases $testCase { - param ( - [string] $MonoVersion, - [string] $MonoVersionsPath, - [string] $VersionFolderPath - ) + It "is available via short link" -TestCases $testCase { + param ( + [string] $MonoVersion, + [string] $MonoVersionsPath, + [string] $VersionFolderPath + ) - $shortSymlink = Get-ShortSymlink $MonoVersion # only 'major.minor' - $shortSymlinkFolderPath = Join-Path $MonoVersionsPath $shortSymlink - if ($shortSymlink -eq "4.8") { return } # Skip this test for Mono 4.8 because it doesn't contain VERSION file - $shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION" - $fullVersionPath = Join-Path $VersionFolderPath "VERSION" - Confirm-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath - } + $shortSymlink = Get-ShortSymlink $MonoVersion # only 'major.minor' + $shortSymlinkFolderPath = Join-Path $MonoVersionsPath $shortSymlink + if ($shortSymlink -eq "4.8") { return } # Skip this test for Mono 4.8 because it doesn't contain VERSION file + $shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION" + $fullVersionPath = Join-Path $VersionFolderPath "VERSION" + Confirm-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath + } - It "NUnit console is installed" -TestCases $testCase { - param ( [string] $VersionFolderPath ) + It "NUnit console is installed" -TestCases $testCase { + param ( [string] $VersionFolderPath ) - $nunitPath = Join-Path $VersionFolderPath "Commands" "nunit3-console" - $nunitPath | Should -Exist - } + $nunitPath = Join-Path $VersionFolderPath "Commands" "nunit3-console" + $nunitPath | Should -Exist + } - It "Nuget is installed" -TestCases $testCase { - param ( [string] $VersionFolderPath ) + It "Nuget is installed" -TestCases $testCase { + param ( [string] $VersionFolderPath ) - $nugetBinaryPath = Join-Path $VersionFolderPath "lib" "mono" "nuget" "nuget.exe" - $nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget" - $nugetCommandPath = Join-Path $VersionFolderPath "Commands" "nuget" - $nugetBinaryPath | Should -Exist - $nugetCommandPath | Should -Exist - $nugetBinaryWrapperPath | Should -Exist - } + $nugetBinaryPath = Join-Path $VersionFolderPath "lib" "mono" "nuget" "nuget.exe" + $nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget" + $nugetCommandPath = Join-Path $VersionFolderPath "Commands" "nuget" + $nugetBinaryPath | Should -Exist + $nugetCommandPath | Should -Exist + $nugetBinaryWrapperPath | Should -Exist + } - It "Nuget is valid" -TestCases $testCase { - param ( [string] $VersionFolderPath ) + It "Nuget is valid" -TestCases $testCase { + param ( [string] $VersionFolderPath ) - $nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget" - "$nugetBinaryWrapperPath" | Should -ReturnZeroExitCode - } + $nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget" + "$nugetBinaryWrapperPath" | Should -ReturnZeroExitCode + } - It "MSBuild is available" { - "msbuild -version" | Should -ReturnZeroExitCode + It "MSBuild is available" { + "msbuild -version" | Should -ReturnZeroExitCode + } } }