-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[vcpkg] Implement --x-write-nuget-packages-config= setting for install and x-set-installed
#12138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ras0219-msft
merged 5 commits into
microsoft:master
from
ras0219:dev/roschuma/set-installed
Jul 1, 2020
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5bb23d5
[vcpkg] Implement --x-write-nuget-packages-config= setting for `insta…
ras0219-msft e2e7215
[vcpkg] Add end-to-end testing suite for install, remove, and binary …
ras0219-msft d684e0d
[vcpkg] Define `$TestingRoot in end-to-end-tests.ps1
ras0219-msft 6d48fe7
Merge remote-tracking branch 'origin/master' into dev/roschuma/set-in…
ras0219-msft 485465e
[vcpkg] Address CR comments
ras0219-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| <# | ||
| .SYNOPSIS | ||
| End-to-End tests for the vcpkg executable. | ||
|
|
||
| .DESCRIPTION | ||
| These tests cover the command line interface and broad functions of vcpkg, including `install`, `remove` and certain | ||
| binary caching scenarios. They use the vcpkg executable in the current directory. | ||
|
|
||
| .PARAMETER Triplet | ||
| The triplet to use for testing purposes. | ||
|
|
||
| .PARAMETER WorkingRoot | ||
| The location used as scratch space for testing. | ||
|
|
||
| #> | ||
|
|
||
| [CmdletBinding()] | ||
| Param( | ||
| [Parameter(Mandatory = $true)] | ||
| [ValidateNotNullOrEmpty()] | ||
| [string]$Triplet, | ||
| [Parameter(Mandatory = $true)] | ||
| [ValidateNotNullOrEmpty()] | ||
| [string]$WorkingRoot | ||
| ) | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| $TestingRoot = Join-Path $WorkingRoot 'testing' | ||
ras0219 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $buildtreesRoot = Join-Path $TestingRoot 'buildtrees' | ||
| $installRoot = Join-Path $TestingRoot 'installed' | ||
| $packagesRoot = Join-Path $TestingRoot 'packages' | ||
| $NuGetRoot = Join-Path $TestingRoot 'nuget' | ||
| $NuGetRoot2 = Join-Path $TestingRoot 'nuget2' | ||
| $ArchiveRoot = Join-Path $TestingRoot 'archives' | ||
| $commonArgs = @( | ||
| "--triplet", | ||
| $Triplet, | ||
| "--x-buildtrees-root=$buildtreesRoot", | ||
| "--x-install-root=$installRoot", | ||
| "--x-packages-root=$packagesRoot" | ||
| ) | ||
|
|
||
| Remove-Item -Recurse -Force $TestingRoot -ErrorAction SilentlyContinue | ||
| mkdir $TestingRoot | ||
| mkdir $NuGetRoot | ||
|
|
||
| function Require-FileExists { | ||
| [CmdletBinding()] | ||
| Param( | ||
| [string]$File | ||
| ) | ||
| if (-Not (Test-Path $File)) { | ||
| throw "'$CurrentTest' failed to create file '$File'" | ||
| } | ||
| } | ||
| function Require-FileNotExists { | ||
| [CmdletBinding()] | ||
| Param( | ||
| [string]$File | ||
| ) | ||
| if (Test-Path $File) { | ||
| throw "'$CurrentTest' should not have created file '$File'" | ||
| } | ||
| } | ||
|
|
||
| # Test simple installation | ||
| $args = $commonArgs + @("install","rapidjson","--binarycaching","--x-binarysource=clear;files,$ArchiveRoot,write;nuget,$NuGetRoot,upload") | ||
| $CurrentTest = "./vcpkg $($args -join ' ')" | ||
| Write-Host $CurrentTest | ||
| ./vcpkg @args | ||
|
|
||
| Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h" | ||
|
|
||
| # Test simple removal | ||
| $args = $commonArgs + @("remove", "rapidjson") | ||
| $CurrentTest = "./vcpkg $($args -join ' ')" | ||
| Write-Host $CurrentTest | ||
| ./vcpkg @args | ||
|
|
||
| Require-FileNotExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h" | ||
|
|
||
| # Test restoring from files archive | ||
| $args = $commonArgs + @("install","rapidjson","--binarycaching","--x-binarysource=clear;files,$ArchiveRoot,read") | ||
| $CurrentTest = "./vcpkg $($args -join ' ')" | ||
| Remove-Item -Recurse -Force $installRoot | ||
| Remove-Item -Recurse -Force $buildtreesRoot | ||
| Write-Host $CurrentTest | ||
| ./vcpkg @args | ||
|
|
||
| Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h" | ||
| Require-FileNotExists "$buildtreesRoot/rapidjson/src" | ||
|
|
||
| # Test restoring from nuget | ||
| $args = $commonArgs + @("install","rapidjson","--binarycaching","--x-binarysource=clear;nuget,$NuGetRoot") | ||
| $CurrentTest = "./vcpkg $($args -join ' ')" | ||
| Remove-Item -Recurse -Force $installRoot | ||
| Remove-Item -Recurse -Force $buildtreesRoot | ||
| Write-Host $CurrentTest | ||
| ./vcpkg @args | ||
|
|
||
| Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h" | ||
| Require-FileNotExists "$buildtreesRoot/rapidjson/src" | ||
|
|
||
| # Test four-phase flow | ||
| $args = $commonArgs + @("install","rapidjson","--dry-run","--x-write-nuget-packages-config=$TestingRoot/packages.config") | ||
| $CurrentTest = "./vcpkg $($args -join ' ')" | ||
| Remove-Item -Recurse -Force $installRoot -ErrorAction SilentlyContinue | ||
| Write-Host $CurrentTest | ||
| ./vcpkg @args | ||
| Require-FileNotExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h" | ||
| Require-FileNotExists "$buildtreesRoot/rapidjson/src" | ||
| Require-FileExists "$TestingRoot/packages.config" | ||
|
|
||
| & $(./vcpkg fetch nuget) restore $TestingRoot/packages.config -OutputDirectory "$NuGetRoot2" -Source "$NuGetRoot" | ||
|
|
||
| Remove-Item -Recurse -Force $NuGetRoot -ErrorAction SilentlyContinue | ||
| mkdir $NuGetRoot | ||
|
|
||
| $args = $commonArgs + @("install","rapidjson","tinyxml","--binarycaching","--x-binarysource=clear;nuget,$NuGetRoot2;nuget,$NuGetRoot,upload") | ||
| $CurrentTest = "./vcpkg $($args -join ' ')" | ||
| Write-Host $CurrentTest | ||
| ./vcpkg @args | ||
| Require-FileExists "$installRoot/$Triplet/include/rapidjson/rapidjson.h" | ||
| Require-FileExists "$installRoot/$Triplet/include/tinyxml.h" | ||
| Require-FileNotExists "$buildtreesRoot/rapidjson/src" | ||
| Require-FileExists "$buildtreesRoot/tinyxml/src" | ||
|
|
||
| if ((Get-ChildItem $NuGetRoot -Filter '*.nupkg' | Measure-Object).Count -ne 1) { | ||
| throw "In '$CurrentTest': did not create exactly 1 NuGet package" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.