...
1# ex: .\scripts\Run-Tests.ps1 -vb -TestExe Functional -Count 2 -BenchTime "2x"
2
3[CmdletBinding()]
4param (
5 [ValidateSet('Test', 'Bench', 'List')]
6 [alias('a')]
7 [string]
8 $Action = 'Bench',
9
10 [string]
11 $Note,
12
13 [string]
14 $OutDirectory = '.\test\results',
15
16 [string]
17 $TestDirectory = '.\bin\test',
18
19 [ValidateSet('Functional', 'CRI')]
20 [string]
21 $TestExe = 'CRI',
22
23 [string]
24 $BenchstatPath = 'benchstat.exe',
25
26 # test parameters
27 [switch]
28 $Shuffle,
29
30 [int]
31 $Count = 1,
32
33 [string]
34 $BenchTime = '5s',
35
36 [string]
37 $Timeout = '10m',
38
39 [alias('tv')]
40 [switch]
41 $TestVerbose,
42
43 [string]
44 $Run,
45
46 [string[]]
47 $Features
48)
49$ErrorActionPreference = 'Stop'
50Import-Module ( Join-Path $PSScriptRoot Testing.psm1 ) -Force
51
52$exe = Switch ($TestExe) {
53 'Functional' { 'functional.test.exe'; break }
54 'CRI' { 'cri-containerd.test.exe'; break }
55}
56$test = Join-Path $TestDirectory $exe
57
58$date = Get-Date
59$testcmd, $out = New-TestCommand `
60 -Action $Action `
61 -Path $test `
62 -Name ($exe -replace '.test.exe$', '') `
63 -OutDirectory $OutDirectory `
64 -Date $date `
65 -Note $Note `
66 -Shuffle:$Shuffle `
67 -TestVerbose:$TestVerbose `
68 -Count $Count `
69 -BenchTime $BenchTime `
70 -Timeout $Timeout `
71 -Run $Run `
72 -Features $Features `
73 -Verbose:$Verbose
74
75Invoke-TestCommand `
76 -TestCmd $testcmd `
77 -OutputFile $out `
78 -OutputCmd (& { if ( $Action -eq 'Bench' ) { $BenchstatPath } }) `
79 -Preamble `
80 -Date $Date `
81 -Note $Note `
82 -Verbose:$Verbose
View as plain text