-
Notifications
You must be signed in to change notification settings - Fork 1
/
runtests.ps1
70 lines (60 loc) · 1.09 KB
/
runtests.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Script that runs the tests
#
# Version: 20220103
$ExitSuccess = 0
$ExitFailure = 1
$ExitIgnore = 77
Set-Location -Path "tests"
$Result = ${ExitSuccess}
$Lines = Get-Content "Makefile.am"
$InTests = $FALSE
Foreach (${Line} in ${Lines})
{
If (${InTests})
{
If (-Not ${Line})
{
${InTests} = $FALSE
Continue
}
${Line} = ${Line}.TrimStart()
If (${Line}.EndsWith(" \"))
{
${Line} = ${Line}.Substring(0, ${Line}.Length - 2)
}
If (-Not (${Line}.EndsWith(".sh")))
{
Continue
}
${Line} = ${Line}.Substring(0, ${Line}.Length - 3)
${Line} = ".\${Line}.ps1"
Try
{
Invoke-Expression ${Line}
}
Catch
{
$LastExitCode = ${ExitIgnore}
}
If (${LastExitCode} -eq ${ExitFailure})
{
$Result = ${ExitFailure}
Write-Host "FAIL" -foreground Red -nonewline
}
ElseIf (${LastExitCode} -eq ${ExitIgnore})
{
Write-Host "SKIP" -foreground Cyan -nonewline
}
Else
{
Write-Host "PASS" -foreground Green -nonewline
}
Write-Host ": ${Line}"
}
ElseIf (${Line}.StartsWith("TESTS = "))
{
${InTests} = $TRUE
}
}
Set-Location -Path ".."
Exit ${Result}