From 3771c88da34755c492c2a35a7d6fa93131e2077e Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Thu, 2 Nov 2017 18:03:34 -0700 Subject: [PATCH] Always run test with crossgen'ed assemblies in CI (#5315) --- .../Scripting.Classes.BasicParsing.Tests.ps1 | 22 ------------- .../scripting.Classes.inheritance.tests.ps1 | 22 ------------- .../HelpersLanguage/HelpersLanguage.psm1 | 33 +------------------ tools/travis.ps1 | 18 +--------- 4 files changed, 2 insertions(+), 93 deletions(-) diff --git a/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 b/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 index a06a38bceb..b9655a8bcc 100644 --- a/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 +++ b/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 @@ -2,24 +2,6 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # -try { -# -# CrossGen'ed assemblies cause a hang to happen intermittently when running this test suite in Linux and macOS. -# The issue has been reported to CoreCLR team. We need to work around it for now with the following approach: -# 1. For pull request and push commit, build without '-CrossGen' and run the parsing tests -# 2. For daily build, build with '-CrossGen' but don't run the parsing tests -# In this way, we will continue to exercise these parsing tests for each CI build, and skip them for daily -# build to avoid a hang. -# Note: this change should be reverted once the 'CrossGen' issue is fixed by CoreCLR. The issue is tracked by -# https://github.com/dotnet/coreclr/issues/9745 -# -$isDailyBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron' -or $env:TRAVIS_EVENT_TYPE -eq 'api' -$defaultParamValues = $PSdefaultParameterValues.Clone() -$IsSkipped = (!$IsWindows -and $isDailyBuild) -$PSDefaultParameterValues["it:skip"] = $IsSkipped -$PSDefaultParameterValues["ShouldBeParseError:SkipInTravisFullBuild"] = $IsSkipped - - Describe 'Positive Parse Properties Tests' -Tags "CI" { It 'PositiveParsePropertiesTest' { # Just a bunch of random basic things here @@ -859,7 +841,3 @@ Describe 'variable analysis' -Tags "CI" { [B]::getA().getFoo() | Should Be 'foo' } } - -} finally { - $global:PSdefaultParameterValues = $defaultParamValues -} diff --git a/test/powershell/Language/Classes/scripting.Classes.inheritance.tests.ps1 b/test/powershell/Language/Classes/scripting.Classes.inheritance.tests.ps1 index cf7e7f1b4c..13e71cc3bb 100644 --- a/test/powershell/Language/Classes/scripting.Classes.inheritance.tests.ps1 +++ b/test/powershell/Language/Classes/scripting.Classes.inheritance.tests.ps1 @@ -2,24 +2,6 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # -try { -# -# CrossGen'ed assemblies cause a hang to happen intermittently when running this test suite in Linux and macOS. -# The issue has been reported to CoreCLR team. We need to work around it for now with the following approach: -# 1. For pull request and push commit, build without '-CrossGen' and run the parsing tests -# 2. For daily build, build with '-CrossGen' but don't run the parsing tests -# In this way, we will continue to exercise these parsing tests for each CI build, and skip them for daily -# build to avoid a hang. -# Note: this change should be reverted once the 'CrossGen' issue is fixed by CoreCLR. The issue is tracked by -# https://github.com/dotnet/coreclr/issues/9745 -# -$isDailyBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron' -or $env:TRAVIS_EVENT_TYPE -eq 'api' -$defaultParamValues = $PSdefaultParameterValues.Clone() -$IsSkipped = (!$IsWindows -and $isDailyBuild) -$PSDefaultParameterValues["it:skip"] = $IsSkipped -$PSDefaultParameterValues["ShouldBeParseError:SkipInTravisFullBuild"] = $IsSkipped - - Describe 'Classes inheritance syntax' -Tags "CI" { It 'Base types' { @@ -539,7 +521,3 @@ class Derived : Base $sb.Invoke() | Should Be 200 } } - -} finally { - $global:PSdefaultParameterValues = $defaultParamValues -} diff --git a/test/tools/Modules/HelpersLanguage/HelpersLanguage.psm1 b/test/tools/Modules/HelpersLanguage/HelpersLanguage.psm1 index d4ee9eb2a2..6343395e22 100644 --- a/test/tools/Modules/HelpersLanguage/HelpersLanguage.psm1 +++ b/test/tools/Modules/HelpersLanguage/HelpersLanguage.psm1 @@ -65,40 +65,9 @@ function ShouldBeParseError # This is a temporary solution after moving type creation from parse time to runtime [switch]$SkipAndCheckRuntimeError, # for test coverarage purpose, tests validate columnNumber or offset - [switch]$CheckColumnNumber, - # Skip this test in Travis CI nightly build - [switch]$SkipInTravisFullBuild + [switch]$CheckColumnNumber ) - # - # CrossGen'ed assemblies cause a hang to happen when running tests with this helper function in Linux and macOS. - # The issue has been reported to CoreCLR team. We need to work around it for now with the following approach: - # 1. For pull request and push commit, build without '-CrossGen' and run the parsing tests - # 2. For nightly build, build with '-CrossGen' but don't run the parsing tests - # In this way, we will continue to exercise these parsing tests for each CI build, and skip them for nightly - # build to avoid a hang. - # Note: this change should be reverted once the 'CrossGen' issue is fixed by CoreCLR. The issue is tracked by - # https://github.com/dotnet/coreclr/issues/9745 - # - if ($SkipInTravisFullBuild) { - ## Report that we skipped the tests and return - ## be sure to report the same number of tests - ## it should have the same appearance as if the tests were run - Context "Parse error expected: <<$src>>" { - if ($SkipAndCheckRuntimeError) - { - It "error should happen at parse time, not at runtime" -Skip {} - } - It "Error count" -Skip { } - foreach($expectedError in $expectedErrors) - { - It "Error Id" -Skip { } - It "Error position" -Skip { } - } - } - return - } - Context "Parse error expected: <<$src>>" { # Test case error if this fails $expectedErrors.Count | Should Be $expectedOffsets.Count diff --git a/tools/travis.ps1 b/tools/travis.ps1 index 73c3a74808..dc7815ae02 100644 --- a/tools/travis.ps1 +++ b/tools/travis.ps1 @@ -173,23 +173,11 @@ elseif($Stage -eq 'Build') Write-Host -Foreground Green "Executing travis.ps1 `$isPR='$isPr' `$isFullBuild='$isFullBuild' - $commitMessage" $output = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions)) - # CrossGen'ed assemblies cause a hang to happen intermittently when running powershell class - # basic parsing tests in Linux/macOS. The hang seems to happen when generating dynamic assemblies. - # This issue has been reported to CoreCLR team. We need to work around it for now because - # the Travis CI build failures caused by this is draining our builder resource and severely - # affect our daily work. The workaround is: - # 1. For pull request and push commit, build without '-CrossGen' and run the parsing tests - # 2. For nightly build, build with '-CrossGen' but don't run the parsing tests - # With this workaround, CI builds triggered by pull request and push commit will exercise - # the parsing tests with IL assemblies, while nightly builds will exercise CrossGen'ed assemblies - # without running those class parsing tests so as to avoid the hang. - # NOTE: this change should be reverted once the 'CrossGen' issue is fixed by CoreCLR. The issue - # is tracked by https://github.com/dotnet/coreclr/issues/9745 $originalProgressPreference = $ProgressPreference $ProgressPreference = 'SilentlyContinue' try { ## We use CrossGen build to run tests only if it's the daily build. - Start-PSBuild -CrossGen:$isDailyBuild -PSModuleRestore + Start-PSBuild -CrossGen -PSModuleRestore } finally{ $ProgressPreference = $originalProgressPreference @@ -245,10 +233,6 @@ elseif($Stage -eq 'Build') } if (-not $isPr) { - # Run 'CrossGen' for push commit, so that we can generate package. - # It won't rebuild powershell, but only CrossGen the already built assemblies. - if (-not $isDailyBuild) { Start-PSBuild -CrossGen } - $packageParams = @{} if($env:TRAVIS_BUILD_NUMBER) {