aboutsummaryrefslogtreecommitdiff
path: root/scripts/azure-pipelines
diff options
context:
space:
mode:
authorVictor Romero <romerosanchezv@gmail.com>2021-01-07 18:04:11 -0800
committerGitHub <noreply@github.com>2021-01-07 18:04:11 -0800
commit2a42024b53ebb512fb5dd63c523338bf26c8489c (patch)
tree3941b7e312699c3ae6e45a036360cabd8a6565f3 /scripts/azure-pipelines
parentd717d4119e51d24787ee21a0ae4d8873e0889c93 (diff)
downloadvcpkg-2a42024b53ebb512fb5dd63c523338bf26c8489c.tar.gz
vcpkg-2a42024b53ebb512fb5dd63c523338bf26c8489c.zip
[vcpkg] Add commands to maintain and verify versions db integrity (#14999)
* [vcpkg] Add x-ci-verify-versions command * Code cleanup * Remove port version splitting from x-history * Fix wrong message on success * Parallelize versions file generator * Use cpu_count()/2 to avoid crashes * Check db SHA against local SHA * Check baseline version with x-ci-verify-versions and make baseline generator much faster * Implement x-add-version to update version db files * Better checks for x-add-info and make x-ci-verify-versions silent on success * Use find() instead of [] on maps * Create version file if does not exist * Allow redirection of ports/ and port_versions/ * add test ports * WIP end-to-end tests * Change pats in e2e tests * Fix e2e args * e2e once more * Pass ersions feature flag to e2e * Exit with code 1 if there are errors * Files to test for failure cases * Update test files * Add test for x-add-version * fix redirected ports in last test * Add CI check (use dummy data) * Add feature-flags=versions * Ignore subdirectories inside ports * Add --verify-git-trees switch * [vcpkg] Fix build breaks * [x-ci-verify-versions] PR comments * [x-add-version] PR comments * Fix merge conflicts * Modify tests and pipeline * Baselines should only have version-string * Refactor x-add-version * [vcpkg] Fix help message * [vcpkg] Fix minor warnings * `x-add-version --all` doesn't stop on first failure and reduced default verbosity * [vcpkg] Fix default-baseline * Load file instead of using paths provider * Format * Remove ci test * Add fish port for testing * Update version files * Update fish port to cause SHA discrepancy * Test for discrepancy between local SHA and declared SHA * Missing = operator * Check for error message since x-add-version exits with code 0 * Make x-add-version fail with non-zero exit code if not run with --all Co-authored-by: Robert Schumacher <roschuma@microsoft.com> Co-authored-by: Robert Schumacher <ras0219@outlook.com>
Diffstat (limited to 'scripts/azure-pipelines')
-rw-r--r--scripts/azure-pipelines/end-to-end-tests-dir/versions.ps175
1 files changed, 75 insertions, 0 deletions
diff --git a/scripts/azure-pipelines/end-to-end-tests-dir/versions.ps1 b/scripts/azure-pipelines/end-to-end-tests-dir/versions.ps1
new file mode 100644
index 000000000..5d61b2101
--- /dev/null
+++ b/scripts/azure-pipelines/end-to-end-tests-dir/versions.ps1
@@ -0,0 +1,75 @@
+. $PSScriptRoot/../end-to-end-tests-prelude.ps1
+
+# Test verify versions
+mkdir $VersionFilesRoot
+Copy-Item -Recurse "scripts/testing/version-files/port_versions_incomplete" $VersionFilesRoot
+$portsRedirectArgsOK = @(
+ "--feature-flags=versions",
+ "--x-builtin-ports-root=scripts/testing/version-files/ports",
+ "--x-builtin-port-versions-dir=scripts/testing/version-files/port_versions"
+)
+$portsRedirectArgsIncomplete = @(
+ "--feature-flags=versions",
+ "--x-builtin-ports-root=scripts/testing/version-files/ports_incomplete",
+ "--x-builtin-port-versions-dir=$VersionFilesRoot/port_versions_incomplete"
+)
+$CurrentTest = "x-verify-ci-versions (All files OK)"
+Write-Host $CurrentTest
+./vcpkg $portsRedirectArgsOK x-ci-verify-versions --verbose
+Throw-IfFailed
+
+$CurrentTest = "x-verify-ci-versions (Incomplete)"
+./vcpkg $portsRedirectArgsIncomplete x-ci-verify-versions --verbose
+Throw-IfNotFailed
+
+$CurrentTest = "x-add-version cat"
+# Do not fail if there's nothing to update
+./vcpkg $portsRedirectArgsIncomplete x-add-version cat
+Throw-IfFailed
+
+$CurrentTest = "x-add-version dog"
+# Local version is not in baseline and versions file
+./vcpkg $portsRedirectArgsIncomplete x-add-version dog
+Throw-IfFailed
+
+$CurrentTest = "x-add-version duck"
+# Missing versions file
+./vcpkg $portsRedirectArgsIncomplete x-add-version duck
+Throw-IfFailed
+
+$CurrentTest = "x-add-version ferret"
+# Missing versions file and missing baseline entry
+./vcpkg $portsRedirectArgsIncomplete x-add-version ferret
+Throw-IfFailed
+
+$CurrentTest = "x-add-version fish (must fail)"
+# Discrepancy between local SHA and SHA in fish.json. Requires --overwrite-version.
+$out = ./vcpkg $portsRedirectArgsIncomplete x-add-version fish
+Throw-IfNotFailed
+$CurrentTest = "x-add-version fish --overwrite-version"
+./vcpkg $portsRedirectArgsIncomplete x-add-version fish --overwrite-version
+Throw-IfFailed
+
+$CurrentTest = "x-add-version mouse"
+# Missing baseline entry
+./vcpkg $portsRedirectArgsIncomplete x-add-version mouse
+Throw-IfFailed
+# Validate changes
+./vcpkg $portsRedirectArgsIncomplete x-ci-verify-versions --verbose
+Throw-IfFailed
+
+$CurrentTest = "default baseline"
+$out = ./vcpkg $commonArgs "--feature-flags=versions" install --x-manifest-root=scripts/testing/version-files/default-baseline-1
+Throw-IfNotFailed
+# if ($out -notmatch "Error: while checking out baseline" -or $out -notmatch " does not exist in ")
+# {
+# $out
+# throw "Expected to fail due to missing baseline"
+# }
+
+git fetch https://github.com/vicroms/test-registries
+$CurrentTest = "default baseline"
+./vcpkg $commonArgs "--feature-flags=versions" install `
+ "--x-manifest-root=scripts/testing/version-files/default-baseline-2" `
+ "--x-builtin-port-versions-dir=scripts/testing/version-files/default-baseline-2/port_versions"
+Throw-IfFailed