forked from microsoft/Quantum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.ps1
49 lines (38 loc) · 1.46 KB
/
test.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
$ErrorActionPreference = 'Stop'
& "$PSScriptRoot/set-env.ps1"
$all_ok = $True
function Test-One {
Param($project)
Write-Host "##[info]Testing $project..."
dotnet test (Join-Path $PSScriptRoot $project) `
-c $Env:BUILD_CONFIGURATION `
-v $Env:BUILD_VERBOSITY `
--logger trx `
/property:DefineConstants=$Env:ASSEMBLY_CONSTANTS `
/property:Version=$Env:ASSEMBLY_VERSION
if ($LastExitCode -ne 0) {
Write-Host "##vso[task.logissue type=error;]Failed to test $project"
$script:all_ok = $False
}
}
function Validate-Integrals {
if (($null -ne $Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Win"))) {
Push-Location (Join-Path $PSScriptRoot "..\Chemistry\Schema\")
python validator.py $PSScriptRoot/Samples/chemistry/IntegralData/**/*.yaml broombridge-0.1.schema.json
if ($LastExitCode -ne 0) {
Write-Host "##vso[task.logissue type=error;]Failed to validate IntegralData"
$script:all_ok = $False
}
Pop-Location
} else {
Write-Host "##vso[task.logissue type=warning;]Validation of IntegralData only supported in Windows."
}
}
Validate-Integrals
Test-One '../samples/tests/sample-tests'
Test-One '../samples/diagnostics/unit-testing'
if (-not $all_ok) {
throw "At least one project failed to compile. Check the logs."
}