From e10603c4f062319b8d394285be8bdeb5e58de2be Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 5 Apr 2019 15:49:30 -0700 Subject: [PATCH] Make sure non-Windows CI fails when a test fails (#9303) Make sure non-Windows CI fails when a test fails ## PR Context We discovered that some tests were failing after a PR and the CI was not failing --- tools/ci.psm1 | 52 +-------------------------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/tools/ci.psm1 b/tools/ci.psm1 index ab3e3dbd73..14f0bb071b 100644 --- a/tools/ci.psm1 +++ b/tools/ci.psm1 @@ -122,7 +122,6 @@ function Invoke-CIInstall ) # Make sure we have all the tags Sync-PSTags -AddRemoteIfMissing - $releaseTag = Get-ReleaseTag if(Test-DailyBuild) { @@ -588,8 +587,6 @@ function Invoke-LinuxTestsCore 'ExcludeTag' = $testExcludeTag 'OutputFile' = $testResultsNoSudo } - # create packages if it is a full build - $isFullBuild = Test-DailyBuild # Get the experimental feature names and the tests associated with them $ExperimentalFeatureTests = Get-ExperimentalFeatureTests @@ -662,7 +659,7 @@ function Invoke-LinuxTestsCore # Determine whether the build passed try { $allTestResultsWithNoExpFeature = @($pesterPassThruNoSudoObject, $pesterPassThruSudoObject) - $allTestResultsWithExpFeatures = $noSudoResultsWithExpFeatures + $sudoResultsWithExpFeatures + $allTestResultsWithExpFeatures = @($noSudoResultsWithExpFeatures, $sudoResultsWithExpFeatures) # This throws if there was an error: $allTestResultsWithNoExpFeature | ForEach-Object { Test-PSPesterResults -ResultObject $_ } $allTestResultsWithExpFeatures | ForEach-Object { Test-PSPesterResults -ResultObject $_ -CanHaveNoResult } @@ -672,53 +669,6 @@ function Invoke-LinuxTestsCore $resultError = $_ $result = "FAIL" } -} - -# Build and test script for Linux and macOS: -function Invoke-LinuxTests -{ - param( - [switch] - $SkipBuild - ) - - if(!$SkipBuild.IsPresent) - { - $releaseTag = Get-ReleaseTag - Write-Log -Message "Executing ci.psm1 build and test on a Linux based operating system." - $originalProgressPreference = $ProgressPreference - $ProgressPreference = 'SilentlyContinue' - try { - # We use CrossGen build to run tests only if it's the daily build. - Start-PSBuild -CrossGen -PSModuleRestore -CI -ReleaseTag $releaseTag -Configuration 'Release' - } - finally - { - $ProgressPreference = $originalProgressPreference - } - } - - Invoke-LinuxTestsCore - - try { - $xUnitTestResultsFile = "$pwd/xUnitTestResults.xml" - Start-PSxUnit -xUnitTestResultsFile $xUnitTestResultsFile - # If there are failures, Test-XUnitTestResults throws - Test-XUnitTestResults -TestResultsFile $xUnitTestResultsFile - } catch { - $result = "FAIL" - if (!$resultError) - { - $resultError = $_ - } - } - - $createPackages = $isFullBuild - - if ($createPackages) - { - New-LinuxPackage -NugetKey $env:NugetKey - } # If the tests did not pass, throw the reason why if ( $result -eq "FAIL" )