Repository navigation
Expand file tree
/
Copy pathtest.ps1
More file actions
86 lines (77 loc) · 2.09 KB
/
Copy pathtest.ps1
File metadata and controls
86 lines (77 loc) · 2.09 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
[CmdletBinding()]
param(
[ValidateSet("Debug", "Release")]
[string]$Configuration = "Debug",
[string]$WslDistribution = "Ubuntu-24.04",
[switch]$RunLinux,
[switch]$RunWinCredLive
)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
$repoRoot = $PSScriptRoot
. (Join-Path $repoRoot "scripts\VisualStudio.ps1")
& cargo fmt --all -- --check
if ($LASTEXITCODE -ne 0)
{
throw "cargo fmt check failed."
}
$installationPath = Import-VisualStudioEnvironment
& cargo check --locked --workspace --all-targets
if ($LASTEXITCODE -ne 0)
{
throw "Windows Rust check failed."
}
& cargo test --locked --workspace --all-targets
if ($LASTEXITCODE -ne 0)
{
throw "Windows Rust tests failed."
}
& cargo clippy --locked --workspace --all-targets -- -D warnings
if ($LASTEXITCODE -ne 0)
{
throw "Windows Rust clippy failed."
}
$cmake = Join-Path $installationPath "Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
if (!(Test-Path -LiteralPath $cmake))
{
throw "Visual Studio CMake was not found at '$cmake'."
}
& $cmake --preset windows-x64
if ($LASTEXITCODE -ne 0)
{
throw "CMake configuration failed."
}
$buildPreset = "windows-x64-$($Configuration.ToLowerInvariant())"
& $cmake --build --preset $buildPreset
if ($LASTEXITCODE -ne 0)
{
throw "CMake build failed."
}
$ctest = Join-Path (Split-Path $cmake) "ctest.exe"
& $ctest --preset $buildPreset
if ($LASTEXITCODE -ne 0)
{
throw "CTest failed."
}
if ($RunWinCredLive)
{
$env:WINCRED_LIVE_TESTS = "1"
& cargo test --locked -p wincred-libsecret-broker --test wincred_integration -- --ignored --test-threads=1
if ($LASTEXITCODE -ne 0)
{
throw "Live WinCred integration test failed."
}
}
if ($RunLinux)
{
$wslPath = (& wsl.exe -d $WslDistribution -- wslpath -a ($repoRoot -replace "\\", "/")).Trim()
if (!$wslPath)
{
throw "Could not translate the repository path for WSL distribution '$WslDistribution'."
}
& wsl.exe -d $WslDistribution -- bash "$wslPath/scripts/test-linux.sh"
if ($LASTEXITCODE -ne 0)
{
throw "Linux component tests failed."
}
}