aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/packages/chocolatey/test.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/packages/chocolatey/test.ps1')
-rw-r--r--scripts/packages/chocolatey/test.ps151
1 files changed, 42 insertions, 9 deletions
diff --git a/scripts/packages/chocolatey/test.ps1 b/scripts/packages/chocolatey/test.ps1
index 91db5b7763..febbc2f417 100644
--- a/scripts/packages/chocolatey/test.ps1
+++ b/scripts/packages/chocolatey/test.ps1
@@ -1,23 +1,56 @@
param(
- [string] $version = "0.3.2"
+ [switch] $prerelease
)
choco uninstall bazel --force -y
+if ($prerelease) {
+ choco install bazel --verbose --debug --prerelease --force -y -s ".;https://chocolatey.org/api/v2/"
+} else {
+ choco install bazel --verbose --debug --force -y -s ".;https://chocolatey.org/api/v2/"
+}
-choco install bazel --verbose --debug --force -y -s ".;https://chocolatey.org/api/v2/"
+if ($LASTEXITCODE -ne 0)
+{
+ write-error @"
+`$LASTEXITCODE was not zero.
+Inspect the output from choco install above.
+It should not have had errors.
+"@
+ exit 1
+}
+& bazel version
if ($LASTEXITCODE -ne 0)
{
- write-error "`$LASTEXITCODE was not zero. Inspect the output from choco install above."
+ write-error @"
+`$LASTEXITCODE was not zero.
+Inspect the output from ``bazel version`` above.
+It should have shown you bazel's version number.
+"@
+ exit 1
+}
+
+& bazel info
+if ($LASTEXITCODE -ne 0)
+{
+ write-error @"
+`$LASTEXITCODE was not zero.
+Inspect the output from ``bazel info`` above.
+It should have shown you bazel's information about the current workspace.
+"@
exit 1
}
write-host @"
-The package should have installed without errors.
+This test just:
+* uninstalled bazel (if it was installed)
+* installed bazel from the package you built
+* asserted that the installation did not return an error exit code
+* ran ``bazel version`` and asserted non-error exit code
+* ran ``bazel info`` and asserted non-error exit code
-Now:
-* open a new shell (this should work in msys2, cmd, powershell)
-* Make sure your environment is accurate (see ``./tools/chocolateyinstall.ps1`` output)
-* run ``bazel version`` in that shell
-* ... and you should get a version number back
+The bazel commands should now be repeated in the other shells. Should work in:
+* powershell (probably what you just ran this in)
+* cmd
+* msys2
"@