From 4d136ef25f4fab5b744c7ae6acfa04d44f254f2b Mon Sep 17 00:00:00 2001 From: Billy O'Neal Date: Wed, 20 Jan 2021 12:07:41 -0800 Subject: [vcpkg] Add vcpkg_minimum_required as a replacement for VERSION.txt. (#15638) --- .../end-to-end-tests-dir/backcompat-helpers.ps1 | 8 +++----- .../end-to-end-tests-dir/binarycaching.ps1 | 5 +++++ .../vcpkg-minimum-required.ps1 | 22 ++++++++++++++++++++++ scripts/azure-pipelines/end-to-end-tests.ps1 | 5 +++++ scripts/azure-pipelines/linux/azure-pipelines.yml | 7 +++++++ scripts/azure-pipelines/osx/azure-pipelines.yml | 2 ++ 6 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 scripts/azure-pipelines/end-to-end-tests-dir/vcpkg-minimum-required.ps1 (limited to 'scripts/azure-pipelines') diff --git a/scripts/azure-pipelines/end-to-end-tests-dir/backcompat-helpers.ps1 b/scripts/azure-pipelines/end-to-end-tests-dir/backcompat-helpers.ps1 index 5b6b1c10f..704b52752 100644 --- a/scripts/azure-pipelines/end-to-end-tests-dir/backcompat-helpers.ps1 +++ b/scripts/azure-pipelines/end-to-end-tests-dir/backcompat-helpers.ps1 @@ -6,18 +6,16 @@ foreach ($backcompatFeaturePort in $backcompatFeaturePorts) { $succeedArgs = $commonArgs + @('install',$backcompatFeaturePort,'--no-binarycaching') $failArgs = $succeedArgs + @('--x-prohibit-backcompat-features') $CurrentTest = "Should fail: ./vcpkg $($failArgs -join ' ')" - Write-Host $CurrentTest - ./vcpkg @failArgs + Run-Vcpkg @failArgs if ($LastExitCode -ne 0) { - Write-Host "... failed (this is good!)" + Write-Host "... failed (this is good!)." } else { throw $CurrentTest } # Install failed when prohibiting backcompat features, so it should succeed if we allow them $CurrentTest = "Should succeeed: ./vcpkg $($succeedArgs -join ' ')" - Write-Host $CurrentTest - ./vcpkg @succeedArgs + Run-Vcpkg @succeedArgs if ($LastExitCode -ne 0) { throw $CurrentTest } else { diff --git a/scripts/azure-pipelines/end-to-end-tests-dir/binarycaching.ps1 b/scripts/azure-pipelines/end-to-end-tests-dir/binarycaching.ps1 index 2b7e84fbd..e4ee6e698 100644 --- a/scripts/azure-pipelines/end-to-end-tests-dir/binarycaching.ps1 +++ b/scripts/azure-pipelines/end-to-end-tests-dir/binarycaching.ps1 @@ -1,3 +1,8 @@ +if ($IsLinux) { + # The tests below need a mono installation not currently available on the Linux agents. + return +} + . $PSScriptRoot/../end-to-end-tests-prelude.ps1 # Test simple installation diff --git a/scripts/azure-pipelines/end-to-end-tests-dir/vcpkg-minimum-required.ps1 b/scripts/azure-pipelines/end-to-end-tests-dir/vcpkg-minimum-required.ps1 new file mode 100644 index 000000000..8f512ae7a --- /dev/null +++ b/scripts/azure-pipelines/end-to-end-tests-dir/vcpkg-minimum-required.ps1 @@ -0,0 +1,22 @@ +. $PSScriptRoot/../end-to-end-tests-prelude.ps1 + +$successCases = @('vcpkg-requires-current-date', 'vcpkg-requires-old-date') +foreach ($successCase in $successCases) { + $CurrentTest = "Should succeeed: ./vcpkg install $successCase" + Write-Host $CurrentTest + Run-Vcpkg install $successCase @commonArgs + if ($LastExitCode -ne 0) { + throw $CurrentTest + } else { + Write-Host "... succeeded." + } +} + +$CurrentTest = "Should fail: ./vcpkg install vcpkg-requires-future-date" +Write-Host $CurrentTest +Run-Vcpkg install vcpkg-requires-future-date @commonArgs +if ($LastExitCode -ne 0) { + Write-Host "... failed (this is good!)." +} else { + throw $CurrentTest +} diff --git a/scripts/azure-pipelines/end-to-end-tests.ps1 b/scripts/azure-pipelines/end-to-end-tests.ps1 index 3c9dd067f..8858b362e 100644 --- a/scripts/azure-pipelines/end-to-end-tests.ps1 +++ b/scripts/azure-pipelines/end-to-end-tests.ps1 @@ -32,6 +32,10 @@ Param( $ErrorActionPreference = "Stop" +if (-Not (Test-Path $WorkingRoot)) { + New-Item -Path $WorkingRoot -ItemType Directory +} + $WorkingRoot = (Get-Item $WorkingRoot).FullName $AllTests = Get-ChildItem $PSScriptRoot/end-to-end-tests-dir/*.ps1 @@ -47,4 +51,5 @@ $AllTests | % { $n += 1 } +Write-Host "[end-to-end-tests.ps1] All tests passed." $LASTEXITCODE = 0 diff --git a/scripts/azure-pipelines/linux/azure-pipelines.yml b/scripts/azure-pipelines/linux/azure-pipelines.yml index 018203a6a..40089bc24 100644 --- a/scripts/azure-pipelines/linux/azure-pipelines.yml +++ b/scripts/azure-pipelines/linux/azure-pipelines.yml @@ -36,12 +36,19 @@ jobs: arguments: '-buildTests' - bash: toolsrc/build.rel/vcpkg-test displayName: 'Run vcpkg tests' + - task: PowerShell@2 + displayName: 'Run vcpkg end-to-end tests' + inputs: + filePath: 'scripts/azure-pipelines/end-to-end-tests.ps1' + arguments: '-Triplet x64-linux -WorkingRoot ${{ variables.WORKING_ROOT }}' + pwsh: true - task: PowerShell@2 displayName: '*** Test Modified Ports and Prepare Test Logs ***' inputs: failOnStderr: true filePath: 'scripts/azure-pipelines/test-modified-ports.ps1' arguments: '-Triplet x64-linux -BuildReason $(Build.Reason) -UseEnvironmentSasToken -WorkingRoot ${{ variables.WORKING_ROOT }} -ArtifactStagingDirectory $(Build.ArtifactStagingDirectory)' + pwsh: true - bash: | df -h displayName: 'Report on Disk Space After Build' diff --git a/scripts/azure-pipelines/osx/azure-pipelines.yml b/scripts/azure-pipelines/osx/azure-pipelines.yml index c0e1c3a26..fa0d0e056 100644 --- a/scripts/azure-pipelines/osx/azure-pipelines.yml +++ b/scripts/azure-pipelines/osx/azure-pipelines.yml @@ -38,12 +38,14 @@ jobs: inputs: filePath: 'scripts/azure-pipelines/end-to-end-tests.ps1' arguments: '-Triplet x64-osx -WorkingRoot ${{ variables.WORKING_ROOT }}' + pwsh: true - task: PowerShell@2 displayName: '*** Test Modified Ports and Prepare Test Logs ***' inputs: failOnStderr: true filePath: 'scripts/azure-pipelines/test-modified-ports.ps1' arguments: '-Triplet x64-osx -BuildReason $(Build.Reason) -BinarySourceStub "$(BINARY_SOURCE_STUB)" -WorkingRoot ${{ variables.WORKING_ROOT }} -ArtifactStagingDirectory $(Build.ArtifactStagingDirectory)' + pwsh: true - bash: | df -h displayName: 'Report on Disk Space After Build' -- cgit v1.2.3