CI/Appveyor: set powershell strict mode

Set-PSDebug produces too much noise and has global scope.
Strict mode is scoped to the script context and catches errors.
This commit is contained in:
Jan Edmund Lazo 2019-10-22 20:28:56 -04:00
parent c065b0d75f
commit 9b22b69454
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
1 changed files with 2 additions and 6 deletions

View File

@ -1,10 +1,10 @@
Set-StrictMode -Version Latest
$ErrorActionPreference = 'stop'
Set-PSDebug -Strict -Trace 1
$isPullRequest = ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -ne $null)
$env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$'
$compiler = $Matches.compiler
$compileOption = $Matches.option
$compileOption = if ($Matches -contains 'option') {$Matches.option} else {''}
$bits = $Matches.bits
$cmakeBuildType = $(if ($env:CMAKE_BUILD_TYPE -ne $null) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'});
$buildDir = [System.IO.Path]::GetFullPath("$(pwd)")
@ -23,7 +23,6 @@ $uploadToCodeCov = $false
function exitIfFailed() {
if ($LastExitCode -ne 0) {
Set-PSDebug -Off
exit $LastExitCode
}
}
@ -146,8 +145,6 @@ if ($env:USE_LUACOV -eq 1) {
# Functional tests
# The $LastExitCode from MSBuild can't be trusted
$failed = $false
# Temporarily turn off tracing to reduce log file output
Set-PSDebug -Off
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
foreach { $failed = $failed -or
$_ -match 'functional tests failed with error'; $_ }
@ -161,7 +158,6 @@ if ($uploadToCodecov) {
if ($failed) {
exit $LastExitCode
}
Set-PSDebug -Strict -Trace 1
# Old tests
# Add MSYS to path, required for e.g. `find` used in test scripts.