diff --git a/scripts/azure-pipelines/end-to-end-tests-dir/registries.ps1 b/scripts/azure-pipelines/end-to-end-tests-dir/registries.ps1 index 224e726d0a4cae..bb6f24e076f24d 100644 --- a/scripts/azure-pipelines/end-to-end-tests-dir/registries.ps1 +++ b/scripts/azure-pipelines/end-to-end-tests-dir/registries.ps1 @@ -1,24 +1,55 @@ . "$PSScriptRoot/../end-to-end-tests-prelude.ps1" -$commonArgs += @("--x-builtin-port-versions-dir=$PSScriptRoot/../../e2e_ports/port_versions") +$builtinRegistryArgs = $commonArgs + @("--x-builtin-port-versions-dir=$PSScriptRoot/../../e2e_ports/port_versions") -Run-Vcpkg install @commonArgs 'vcpkg-internal-e2e-test-port' +Run-Vcpkg install @builtinRegistryArgs 'vcpkg-internal-e2e-test-port' Throw-IfNotFailed -Run-Vcpkg install @commonArgs --feature-flags=registries 'vcpkg-internal-e2e-test-port' +Run-Vcpkg install @builtinRegistryArgs --feature-flags=registries 'vcpkg-internal-e2e-test-port' Throw-IfFailed -Run-Vcpkg install @commonArgs --feature-flags=registries 'zlib' +Run-Vcpkg install @builtinRegistryArgs --feature-flags=registries 'zlib' Throw-IfFailed -Run-Vcpkg x-set-installed @commonArgs --feature-flags=registries +Run-Vcpkg x-set-installed @builtinRegistryArgs --feature-flags=registries Throw-IfFailed -# Test git registries - +# Test git and filesystem registries +$filesystemRegistry = "$TestingRoot/filesystem-registry" $gitRegistryUpstream = "$TestingRoot/git-registry-upstream" +# build a filesystem registry +New-Item -Path $filesystemRegistry -ItemType Directory +$filesystemRegistry = (Get-Item $filesystemRegistry).FullName + +Copy-Item ` + -LiteralPath "$PSScriptRoot/../../e2e_ports/port_versions/baseline.json" ` + -Destination "$filesystemRegistry/baseline.json" +Copy-Item -Recurse ` + -LiteralPath "$PSScriptRoot/../../e2e_ports/vcpkg-internal-e2e-test-port" ` + -Destination "$filesystemRegistry" +New-Item ` + -Path "$filesystemRegistry/port_versions" ` + -ItemType Directory +New-Item ` + -Path "$filesystemRegistry/port_versions/v-" ` + -ItemType Directory +New-Item ` + -Path "$filesystemRegistry/port_versions/v-/vcpkg-internal-e2e-test-port.json" ` + -ItemType File -Value " +{ + `"versions`": [ + { + `"version-string`": `"1.0.0`", + `"path`": `"$/vcpkg-internal-e2e-test-port`" + } + ] +} +" + + +# build a git registry New-Item -Path $gitRegistryUpstream -ItemType Directory $gitRegistryUpstream = (Get-Item $gitRegistryUpstream).FullName @@ -50,6 +81,49 @@ finally Pop-Location } +# actually test the registries + +# test the filesystem registry +$manifestDir = "$TestingRoot/filesystem-registry-test-manifest-dir" + +New-Item -Path $manifestDir -ItemType Directory +$manifestDir = (Get-Item $manifestDir).FullName + +Push-Location $manifestDir +try +{ + New-Item -Path 'vcpkg.json' -ItemType File -Value " +{ + `"name`": `"manifest-test`", + `"version-string`": `"1.0.0`", + `"dependencies`": [ + `"vcpkg-internal-e2e-test-port`" + ] +} +" + New-Item -Path 'vcpkg-configuration.json' -ItemType File -Value " +{ + `"default-registry`": null, + `"registries`": [ + { + `"kind`": `"filesystem`", + `"path`": `"$($filesystemRegistry -Replace '\\','/')`", + `"packages`": [ `"vcpkg-internal-e2e-test-port`" ] + } + ] +} +" + Run-Vcpkg install @commonArgs '--feature-flags=registries,manifests' + Throw-IfFailed + Run-Vcpkg x-set-installed @commonArgs '--feature-flags=registries,manifests' + Throw-IfFailed +} +finally +{ + Pop-Location +} + +# test the git registry $manifestDir = "$TestingRoot/git-registry-test-manifest-dir" New-Item -Path $manifestDir -ItemType Directory @@ -58,7 +132,7 @@ $manifestDir = (Get-Item $manifestDir).FullName Push-Location $manifestDir try { - New-Item -Path 'vcpkg.json' -Type File -Value " + New-Item -Path 'vcpkg.json' -ItemType File -Value " { `"name`": `"manifest-test`", `"version-string`": `"1.0.0`", @@ -67,7 +141,7 @@ try ] } " - New-Item -Path 'vcpkg-configuration.json' -Type File -Value " + New-Item -Path 'vcpkg-configuration.json' -ItemType File -Value " { `"default-registry`": null, `"registries`": [ @@ -80,6 +154,9 @@ try } " Run-Vcpkg install @commonArgs '--feature-flags=registries,manifests' + Throw-IfFailed + Run-Vcpkg x-set-installed @commonArgs '--feature-flags=registries,manifests' + Throw-IfFailed } finally { diff --git a/scripts/e2e_ports/port_versions/baseline.json b/scripts/e2e_ports/port_versions/baseline.json index 953e8752d5ae58..15e19d7556e78e 100644 --- a/scripts/e2e_ports/port_versions/baseline.json +++ b/scripts/e2e_ports/port_versions/baseline.json @@ -1,3 +1,5 @@ { - "vcpkg-internal-e2e-test-port": { "version-string": "1.0.0" } + "default": { + "vcpkg-internal-e2e-test-port": { "version-string": "1.0.0" } + } }