@@ -7,11 +7,13 @@ $ErrorActionPreference = 'Stop'
77$FirebirdConfiguration = @ {
88 FB30_Default = @ {
99 Download = ' https://www.dropbox.com/s/x46uy7e5zrtsnux/fb30.7z?dl=1' ;
10- Start = ' .\firebird.exe -a' ;
10+ Executable = ' .\firebird.exe' ;
11+ Args = @ (' -a' );
1112 };
1213 FB25_SC = @ {
1314 Download = ' https://www.dropbox.com/s/ayzjnxjx20vb7s5/fb25.7z?dl=1' ;
14- Start = ' .\bin\fb_inet_server.exe -a -m' ;
15+ Executable = ' .\bin\fb_inet_server.exe' ;
16+ Args = @ (' -a' , ' -m' );
1517 };
1618}
1719
@@ -20,6 +22,9 @@ $testsBaseDir = "$baseDir\src\FirebirdSql.Data.FirebirdClient.Tests"
2022$testsNETDir = " $testsBaseDir \bin\$Configuration \net452"
2123$testsCOREDir = " $testsBaseDir \bin\$Configuration \netcoreapp2.0"
2224
25+ $startDir = $null
26+ $firebirdProcess = $null
27+
2328if ($env: tests_firebird_dir ) {
2429 $firebirdDir = $env: tests_firebird_dir
2530}
@@ -37,18 +42,18 @@ function Check-ExitCode($command) {
3742}
3843
3944function Prepare () {
45+ $script :startDir = $pwd
4046 $selectedConfiguration = $FirebirdConfiguration [$FirebirdSelection ]
4147 $fbDownload = $selectedConfiguration.Download
42- $fbStart = $selectedConfiguration.Start
4348 $fbDownloadName = $fbDownload -Replace ' .+/([^/]+)\?dl=1' , ' $1'
4449 if (Test-Path $firebirdDir ) {
4550 rm - Force - Recurse $firebirdDir
4651 }
4752 mkdir $firebirdDir | Out-Null
4853 cd $firebirdDir
49- echo " Downloading: $fbDownload "
54+ echo " Downloading $fbDownload "
5055 (New-Object System.Net.WebClient).DownloadFile($fbDownload , (Join-Path (pwd) $fbDownloadName ))
51- echo " Extracting: $fbDownloadName "
56+ echo " Extracting $fbDownloadName "
5257 7z x $fbDownloadName | Out-Null
5358 cp - Recurse - Force .\embedded\* $testsNETDir
5459 cp - Recurse - Force .\embedded\* $testsCOREDir
@@ -59,8 +64,16 @@ function Prepare() {
5964
6065 ni firebird.log - ItemType File | Out-Null
6166
62- echo " Starting: $fbStart "
63- iex $fbStart
67+ echo " Starting Firebird"
68+ $script :firebirdProcess = Start-Process - FilePath $selectedConfiguration.Executable - ArgumentList $selectedConfiguration.Args - PassThru
69+ }
70+
71+ function Cleanup () {
72+ cd $script :startDir
73+ $process = $script :firebirdProcess
74+ $process.Kill ()
75+ $process.WaitForExit ()
76+ rm - Force - Recurse $firebirdDir
6477}
6578
6679function Tests-FirebirdClient () {
@@ -93,6 +106,11 @@ function Tests-EFCore() {
93106}
94107
95108Prepare
96- Tests- FirebirdClient
97- Tests- EF
98- Tests- EFCore
109+ try {
110+ Tests- FirebirdClient
111+ Tests- EF
112+ Tests- EFCore
113+ }
114+ finally {
115+ Cleanup
116+ }
0 commit comments