forked from FirebirdSQL/NETProvider
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.ps1
More file actions
136 lines (116 loc) · 3.88 KB
/
tests.ps1
File metadata and controls
136 lines (116 loc) · 3.88 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
param(
[Parameter(Mandatory=$True)]$Configuration,
[Parameter(Mandatory=$True)]$FirebirdSelection,
[Parameter(Mandatory=$True)]$TestSuite)
$ErrorActionPreference = 'Stop'
$baseDir = Split-Path -Parent $PSCommandPath
. "$baseDir\include.ps1"
$FirebirdConfiguration = @{
FB40 = @{
Download = 'https://github.com/FirebirdSQL/NETProvider-tests-infrastructure/raw/master/fb40.7z';
Executable = '.\firebird.exe';
Args = @('-a');
};
FB30 = @{
Download = 'https://github.com/FirebirdSQL/NETProvider-tests-infrastructure/raw/master/fb30.7z';
Executable = '.\firebird.exe';
Args = @('-a');
};
}
$testsBaseDir = "$baseDir\src\FirebirdSql.Data.FirebirdClient.Tests"
$testsProviderDir = "$testsBaseDir\bin\$Configuration\$(Get-UsedTargetFramework)"
$startDir = $null
$firebirdProcess = $null
if ($env:tests_firebird_dir) {
$firebirdDir = $env:tests_firebird_dir
}
else {
$firebirdDir = 'I:\Downloads\fb_tests'
}
function Prepare() {
echo "=== $($MyInvocation.MyCommand.Name) ==="
$script:startDir = $pwd
$selectedConfiguration = $FirebirdConfiguration[$FirebirdSelection]
$fbDownload = $selectedConfiguration.Download
$fbDownloadName = $fbDownload -Replace '.+/(.+)$','$1'
if (Test-Path $firebirdDir) {
rm -Force -Recurse $firebirdDir
}
mkdir $firebirdDir | Out-Null
cd $firebirdDir
echo "Downloading $fbDownload"
Invoke-RestMethod -Uri $fbDownload -OutFile $fbDownloadName
echo "Extracting $fbDownloadName"
7z x -bsp0 -bso0 $fbDownloadName
rm $fbDownloadName
cp -Recurse -Force .\* $testsProviderDir
ni firebird.log -ItemType File | Out-Null
echo "Starting Firebird"
$process = Start-Process -FilePath $selectedConfiguration.Executable -ArgumentList $selectedConfiguration.Args -PassThru
echo "Version: $($process.MainModule.FileVersionInfo.FileVersion)"
$script:firebirdProcess = $process
echo "=== END ==="
}
function Cleanup() {
echo "=== $($MyInvocation.MyCommand.Name) ==="
cd $script:startDir
$process = $script:firebirdProcess
$process.Kill()
$process.WaitForExit()
# give OS time to release all files
sleep -Milliseconds 100
rm -Force -Recurse $firebirdDir
echo "=== END ==="
}
function Tests-All() {
Tests-FirebirdClient-Default-Compression-CryptRequired
Tests-FirebirdClient-Default-NoCompression-CryptRequired
Tests-FirebirdClient-Default-Compression-CryptDisabled
Tests-FirebirdClient-Default-NoCompression-CryptDisabled
Tests-FirebirdClient-Embedded
Tests-EFCore
Tests-EFCore-Functional
Tests-EF6
}
function Tests-FirebirdClient-Default-Compression-CryptRequired() {
Tests-FirebirdClient 'Default' $True 'Required'
}
function Tests-FirebirdClient-Default-NoCompression-CryptRequired() {
Tests-FirebirdClient 'Default' $False 'Required'
}
function Tests-FirebirdClient-Default-Compression-CryptDisabled() {
Tests-FirebirdClient 'Default' $True 'Disabled'
}
function Tests-FirebirdClient-Default-NoCompression-CryptDisabled() {
Tests-FirebirdClient 'Default' $False 'Disabled'
}
function Tests-FirebirdClient-Embedded() {
Tests-FirebirdClient 'Embedded' $False 'Disabled'
}
function Tests-FirebirdClient($serverType, $compression, $wireCrypt) {
cd $testsProviderDir
.\FirebirdSql.Data.FirebirdClient.Tests.exe --labels=All "--where=(ServerType==$serverType && Compression==$compression && WireCrypt==$wireCrypt) || Category==NoServer"
Check-ExitCode
}
function Tests-EF6() {
cd "$baseDir\src\EntityFramework.Firebird.Tests\bin\$Configuration\$(Get-UsedTargetFramework)"
.\EntityFramework.Firebird.Tests.exe --labels=All
Check-ExitCode
}
function Tests-EFCore() {
cd "$baseDir\src\FirebirdSql.EntityFrameworkCore.Firebird.Tests\bin\$Configuration\$(Get-UsedTargetFramework)"
.\FirebirdSql.EntityFrameworkCore.Firebird.Tests.exe --labels=All
Check-ExitCode
}
function Tests-EFCore-Functional() {
cd "$baseDir\src\FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests"
dotnet test --no-build -c $Configuration
Check-ExitCode
}
try {
Prepare
& $TestSuite
}
finally {
Cleanup
}