You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by sh...@apache.org on 2009/10/05 18:00:59 UTC

svn commit: r821887 - in /qpid/trunk/qpid/cpp/src/tests: quick_topictest.ps1 run_header_test.ps1 run_test.ps1 topictest.ps1

Author: shuston
Date: Mon Oct  5 16:00:59 2009
New Revision: 821887

URL: http://svn.apache.org/viewvc?rev=821887&view=rev
Log:
Correct some powershell problems for Windows

Modified:
    qpid/trunk/qpid/cpp/src/tests/quick_topictest.ps1
    qpid/trunk/qpid/cpp/src/tests/run_header_test.ps1
    qpid/trunk/qpid/cpp/src/tests/run_test.ps1
    qpid/trunk/qpid/cpp/src/tests/topictest.ps1

Modified: qpid/trunk/qpid/cpp/src/tests/quick_topictest.ps1
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/quick_topictest.ps1?rev=821887&r1=821886&r2=821887&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/quick_topictest.ps1 (original)
+++ qpid/trunk/qpid/cpp/src/tests/quick_topictest.ps1 Mon Oct  5 16:00:59 2009
@@ -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

Modified: qpid/trunk/qpid/cpp/src/tests/run_header_test.ps1
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/run_header_test.ps1?rev=821887&r1=821886&r2=821887&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/run_header_test.ps1 (original)
+++ qpid/trunk/qpid/cpp/src/tests/run_header_test.ps1 Mon Oct  5 16:00:59 2009
@@ -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
 }
-

Modified: qpid/trunk/qpid/cpp/src/tests/run_test.ps1
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/run_test.ps1?rev=821887&r1=821886&r2=821887&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/run_test.ps1 (original)
+++ qpid/trunk/qpid/cpp/src/tests/run_test.ps1 Mon Oct  5 16:00:59 2009
@@ -52,7 +52,6 @@
    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 @@
       $si.Arguments = $args[1..$args.length-1]
    }
 }
-$p = [diagnostics.process]::Start($si)
+$p = [System.Diagnostics.Process]::Start($si)
 $p.WaitForExit()
 exit $?

Modified: qpid/trunk/qpid/cpp/src/tests/topictest.ps1
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/topictest.ps1?rev=821887&r1=821886&r2=821887&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/topictest.ps1 (original)
+++ qpid/trunk/qpid/cpp/src/tests/topictest.ps1 Mon Oct  5 16:00:59 2009
@@ -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 @@
   [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"
 }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org