diff options
author | Stephen D. Huston <shuston@apache.org> | 2009-10-05 16:00:59 +0000 |
---|---|---|
committer | Stephen D. Huston <shuston@apache.org> | 2009-10-05 16:00:59 +0000 |
commit | ae074a2954fe5bb98a3d029e82690fa569470414 (patch) | |
tree | 1ef15802a1860ae82fad73bbbd7762c6dc1f843e /cpp | |
parent | 4f80172fc8a66475045df2299b45c4eb6d46a1b2 (diff) | |
download | qpid-python-ae074a2954fe5bb98a3d029e82690fa569470414.tar.gz |
Correct some powershell problems for Windows
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@821887 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/tests/quick_topictest.ps1 | 11 | ||||
-rw-r--r-- | cpp/src/tests/run_header_test.ps1 | 9 | ||||
-rw-r--r-- | cpp/src/tests/run_test.ps1 | 3 | ||||
-rw-r--r-- | cpp/src/tests/topictest.ps1 | 32 |
4 files changed, 28 insertions, 27 deletions
diff --git a/cpp/src/tests/quick_topictest.ps1 b/cpp/src/tests/quick_topictest.ps1 index 2b857edfff..b1e0ed1f7d 100644 --- a/cpp/src/tests/quick_topictest.ps1 +++ b/cpp/src/tests/quick_topictest.ps1 @@ -18,12 +18,13 @@ # # Quick and quiet topic test for make check. -$srcdir = Split-Path $myInvocation.ScriptName -$PsHome\powershell $srcdir\topictest.ps1 -subscribers 2 -messages 2 -batches 1 > topictest.log 2>&1 -if ($LastExitCode != 0) { - echo $0 FAILED: +[string]$me = $myInvocation.InvocationName +$srcdir = Split-Path $me +powershell "$srcdir\topictest.ps1" -subscribers 2 -messages 2 -batches 1 > topictest.log 2>&1 +if (!$?) { + "$me FAILED:" cat topictest.log exit $LastExitCode } -rm topictest.log +Remove-Item topictest.log exit 0 diff --git a/cpp/src/tests/run_header_test.ps1 b/cpp/src/tests/run_header_test.ps1 index add680f569..eedac3eaae 100644 --- a/cpp/src/tests/run_header_test.ps1 +++ b/cpp/src/tests/run_header_test.ps1 @@ -21,20 +21,19 @@ # TODO: this should be expanded to cover a wider set of types and go # in both directions -$srcdir = Split-Path $myInvocation.ScriptName -$PYTHON_DIR = $srcdir\..\..\..\python +$srcdir = Split-Path $myInvocation.InvocationName +$PYTHON_DIR = "$srcdir\..\..\..\python" if (Test-Path qpidd.port) { set-item -path env:QPID_PORT -value (get-content -path qpidd.port -totalcount 1) } if (Test-Path $PYTHON_DIR -pathType Container) { - ./header_test -p $QPID_PORT + Invoke-Expression "$env:OUTDIR\header_test -p $env:QPID_PORT" $env:PYTHONPATH="$PYTHON_DIR;$env:PYTHONPATH" - $srcdir/header_test.py "localhost" $QPID_PORT + python "$srcdir/header_test.py" "localhost" "$env:QPID_PORT" exit $LASTEXITCODE } else { "Skipping header test as python libs not found" exit 0 } - diff --git a/cpp/src/tests/run_test.ps1 b/cpp/src/tests/run_test.ps1 index ebbef07f1d..551368bc9b 100644 --- a/cpp/src/tests/run_test.ps1 +++ b/cpp/src/tests/run_test.ps1 @@ -52,7 +52,6 @@ if (Test-Path qpidd.port) { set-item -path env:QPID_PORT -value (get-content -path qpidd.port -totalcount 1) } -#$p = new-object System.Diagnostics.Process $si = new-object System.Diagnostics.ProcessStartInfo $si.WorkingDirectory = $pwd $si.UseShellExecute = $true @@ -67,6 +66,6 @@ else { $si.Arguments = $args[1..$args.length-1] } } -$p = [diagnostics.process]::Start($si) +$p = [System.Diagnostics.Process]::Start($si) $p.WaitForExit() exit $? diff --git a/cpp/src/tests/topictest.ps1 b/cpp/src/tests/topictest.ps1 index 04dae23ad9..58ae50c67c 100644 --- a/cpp/src/tests/topictest.ps1 +++ b/cpp/src/tests/topictest.ps1 @@ -19,9 +19,6 @@ # Run the C++ topic test -# Clean up old log files -Get-Item subscriber_*.log | Remove-Item - # Parameters with default values: s (subscribers) m (messages) b (batches) # h (host) t (false; use transactions) param ( @@ -32,23 +29,28 @@ param ( [switch] $t # transactional ) +# Clean up old log files +Get-Item subscriber_*.log | Remove-Item + +if ($t) { + $transactional = "--transactional --durable" +} + function subscribe { - "Start subscriber $args[0]" - $LOG = "subscriber_$args[0].log" - . $srcdir\background.ps1 { - $env:OUTDIR\topic_listener $TRANSACTIONAL > $LOG 2>&1 - if ($LastExitCode -ne 0) { Remove-Item $LOG } - } -inconsole + param ([int]$num) + "Start subscriber $num" + $LOG = "subscriber_$num.log" + $cmdline = "$env:OUTDIR\topic_listener $transactional > $LOG 2>&1 + if (`$LastExitCode -ne 0) { Remove-Item $LOG }" + $cmdblock = $executioncontext.invokecommand.NewScriptBlock($cmdline) + . $srcdir\background.ps1 $cmdblock } -publish() { - if ($t) { - $transactional = "--transactional --durable" - } - $env:OUTDIR\topic_publisher --messages $messages --batches $batches --subscribers $subscribers $host $transactional 2>&1 +function publish { + Invoke-Expression "$env:OUTDIR\topic_publisher --messages $messages --batches $batches --subscribers $subscribers $host $transactional" 2>&1 } -$srcdir = Split-Path $myInvocation.ScriptName +$srcdir = Split-Path $MyInvocation.MyCommand.Path if ($broker.length) { $broker = "-h$broker" } |