Skip to content

Commit

Permalink
moar tests
Browse files Browse the repository at this point in the history
  • Loading branch information
strega-nil committed Dec 21, 2020
1 parent b6e9125 commit 0a9b960
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 10 deletions.
95 changes: 86 additions & 9 deletions scripts/azure-pipelines/end-to-end-tests-dir/registries.ps1
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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`",
Expand All @@ -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`": [
Expand All @@ -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
{
Expand Down
4 changes: 3 additions & 1 deletion scripts/e2e_ports/port_versions/baseline.json
Original file line number Diff line number Diff line change
@@ -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" }
}
}

0 comments on commit 0a9b960

Please sign in to comment.