Skip to content

Commit

Permalink
rewrite runat.bat into powershell for process management
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Herr committed Oct 5, 2016
1 parent 6b878be commit d9a1c5b
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 62 deletions.
51 changes: 0 additions & 51 deletions AcceptanceTest/runat.bat

This file was deleted.

61 changes: 61 additions & 0 deletions AcceptanceTest/runat.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

Param(
[Parameter(Mandatory=$True,Position=1)]
[string]$release,

[Parameter(Mandatory=$True,Position=2)]
[string]$port,

[Parameter(Position=3)]
[string]$tests=$null,

[Parameter(Position=4)]
[string] $conf= "cfg\at.cfg"
)

$result = 0


if([string]::IsNullOrEmpty($tests)) {
$tests = "definitions/server/fix42/*.def"
}


if($release -eq "release") {
$dir = "bin\Release"
}
elseif($release -eq "debug") {
$dir = "bin\Debug"
}
else { Usage }


function StartTests
{
Start-Process -FilePath setup.bat -ArgumentList $port

Start-Process -FilePath $dir\AcceptanceTest.exe -ArgumentList $conf -NoNewWindow

Invoke-Expression -Command "ruby Runner.rb 127.0.0.1 $port $tests > TestResult.xml"

Stop-Process -Name AcceptanceTest

if($LASTEXITCODE -eq 1){ $script:result = 1 }

type TestResult.xml
Quit
}

function Usage
{
echo "Usage: runat [release | debug] [port] [TESTFILE...]"
$script:result = 1
Quit
}

function Quit
{
Exit $result
}

StartTests
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ An HTML report of the test results will then be available here:
To run one particular acceptance test, e.g. fix42\14e_IncorrectEnumValue.def:

cd AcceptanceTest
runat.bat release 5003 definitions\server\fix42\14e_IncorrectEnumValue.def cfg\at_42.cfg
runat.ps1 release 5003 definitions\server\fix42\14e_IncorrectEnumValue.def cfg\at_42.cfg

(See acceptance_test.bat for the proper port numbers and config files to use in the above command.)

Expand Down
20 changes: 10 additions & 10 deletions acceptance_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,70 +17,70 @@ pushd AcceptanceTest

call pause
del TestResult.xml
call runat release 5001 definitions/server/fix40/*.def cfg/at_40.cfg
PowerShell .\runat.ps1 release 5001 definitions/server/fix40/*.def cfg/at_40.cfg
if ERRORLEVEL 1 set RESULT40=1
echo "40 tests result: %RESULT40%"
copy TestResult.xml AcceptanceTests_40.xml

call pause
del TestResult.xml
call runat release 5002 definitions/server/fix41/*.def cfg/at_41.cfg
PowerShell .\runat.ps1 release 5002 definitions/server/fix41/*.def cfg/at_41.cfg
if ERRORLEVEL 1 set RESULT41=1
echo "41 tests result: %RESULT41%"
copy TestResult.xml AcceptanceTests_41.xml

call pause
del TestResult.xml
call runat release 5003 definitions/server/fix42/*.def cfg/at_42.cfg
PowerShell .\runat.ps1 release 5003 definitions/server/fix42/*.def cfg/at_42.cfg
if ERRORLEVEL 1 set RESULT42=1
echo "42 tests result: %RESULT42%"
copy TestResult.xml AcceptanceTests_42.xml

call pause
del TestResult.xml
call runat release 5004 definitions/server/fix43/*.def cfg/at_43.cfg
PowerShell .\runat.ps1 release 5004 definitions/server/fix43/*.def cfg/at_43.cfg
if ERRORLEVEL 1 set RESULT43=1
echo "43 tests result: %RESULT43%"
copy TestResult.xml AcceptanceTests_43.xml

call pause
del TestResult.xml
call runat release 5005 definitions/server/fix44/*.def cfg/at_44.cfg
PowerShell .\runat.ps1 release 5005 definitions/server/fix44/*.def cfg/at_44.cfg
if ERRORLEVEL 1 set RESULT44=1
echo "44 tests result: %RESULT44%"
copy TestResult.xml AcceptanceTests_44.xml

call pause
del TestResult.xml
call runat release 5005 definitions/server/fix44noreset/*.def cfg/at_44_noreset.cfg
PowerShell .\runat.ps1 release 5005 definitions/server/fix44noreset/*.def cfg/at_44_noreset.cfg
if ERRORLEVEL 1 set RESULT44_NORESET=1
echo "44 tests result: %RESULT44_NORESET%"
copy TestResult.xml AcceptanceTests_44_noreset.xml

call pause
del TestResult.xml
call runat release 5006 definitions/server/fix50/*.def cfg/at_50.cfg
PowerShell .\runat.ps1 release 5006 definitions/server/fix50/*.def cfg/at_50.cfg
if ERRORLEVEL 1 set RESULT50=1
echo "50 tests result: %RESULT50%"
copy TestResult.xml AcceptanceTests_50.xml

call pause
del TestResult.xml
call runat release 5007 definitions/server/fix50sp1/*.def cfg/at_50_sp1.cfg
PowerShell .\runat.ps1 release 5007 definitions/server/fix50sp1/*.def cfg/at_50_sp1.cfg
if ERRORLEVEL 1 set RESULT50SP1=1
echo "50 SP1 tests result: %RESULT50SP1%"
copy TestResult.xml AcceptanceTests_50_SP1.xml

call pause
del TestResult.xml
call runat release 5008 definitions/server/fix50sp2/*.def cfg/at_50_sp2.cfg
PowerShell .\runat.ps1 release 5008 definitions/server/fix50sp2/*.def cfg/at_50_sp2.cfg
if ERRORLEVEL 1 set RESULT50SP2=1
echo "50 SP2 tests result: %RESULT50SP2%"
copy TestResult.xml AcceptanceTests_50_SP2.xml

call pause
del TestResult.xml
call runat release 5003 definitions/server/misc/*.def cfg/at_42.misc.cfg
PowerShell .\runat.ps1 release 5003 definitions/server/misc/*.def cfg/at_42.misc.cfg
if ERRORLEVEL 1 set RESULTMISC=1
echo "Misc tests result: %RESULTMISC%"
copy TestResult.xml AcceptanceTests_Misc.xml
Expand Down

0 comments on commit d9a1c5b

Please sign in to comment.