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/06/23 00:51:33 UTC

svn commit: r787431 - in /qpid/trunk/qpid/cpp/src/tests: CMakeLists.txt background.ps1 run_test.ps1

Author: shuston
Date: Mon Jun 22 22:51:32 2009
New Revision: 787431

URL: http://svn.apache.org/viewvc?rev=787431&view=rev
Log:
Script fixes to get tests going on Windows; includes properly licensed background.ps1

Modified:
    qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt
    qpid/trunk/qpid/cpp/src/tests/background.ps1
    qpid/trunk/qpid/cpp/src/tests/run_test.ps1

Modified: qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt?rev=787431&r1=787430&r2=787431&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt (original)
+++ qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt Mon Jun 22 22:51:32 2009
@@ -17,6 +17,9 @@
 # under the License.
 #
 
+# Enable dashboard reporting.
+include (CTest)
+
 # Make sure that everything get built before the tests
 # Need to create a var with all the necessary top level targets
 
@@ -273,14 +276,14 @@
 add_test (quick_topictest ${test_wrap} ${CMAKE_CURRENT_SOURCE_DIR}/quick_topictest${test_script_suffix})
 add_test (quick_txtest ${test_wrap} ${txtest_LOCATION} --queues 4 --tx-count 10 --quiet)
 if (PYTHON_EXECUTABLE)
-  add_test (run_header_test ${CMAKE_CURRENT_SOURCE_DIR}/run_header_test${test_script_suffix})
+  add_test (run_header_test ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_header_test${test_script_suffix})
   add_test (python_tests ${test_wrap} ${CMAKE_CURRENT_SOURCE_DIR}/python_tests${test_script_suffix})
 endif (PYTHON_EXECUTABLE)
 add_test (stop_broker ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/stop_broker${test_script_suffix})
 if (PYTHON_EXECUTABLE)
-  add_test (federation_tests ${CMAKE_CURRENT_SOURCE_DIR}/run_federation_tests${test_script_suffix})
+  add_test (federation_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_federation_tests${test_script_suffix})
 if (BUILD_ACL)
-  add_test (acl_tests ${CMAKE_CURRENT_SOURCE_DIR}/run_acl_tests${test_script_suffix})
+  add_test (acl_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_acl_tests${test_script_suffix})
 endif (BUILD_ACL)
 endif (PYTHON_EXECUTABLE)
 

Modified: qpid/trunk/qpid/cpp/src/tests/background.ps1
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/background.ps1?rev=787431&r1=787430&r2=787431&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/background.ps1 (original)
+++ qpid/trunk/qpid/cpp/src/tests/background.ps1 Mon Jun 22 22:51:32 2009
@@ -1,36 +1,40 @@
-# From http://ps1.soapyfrog.com/2007/01/22/running-pipelines-in-the-background/
-# Copyright © 2006-2009 Adrian Milliner
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Run a PowerShell scriptblock in a background process.
 param(
-    [scriptblock] $script,  # scriptblock to run
-    [switch] $inconsole      # don't create a new window
+    [scriptblock] $script  # scriptblock to run
 )
 
 # break out of the script on any errors
 trap { break }
 
-# encode the script to pass to the child process...
-$encodedString = [convert]::ToBase64String(
+# In order to pass a scriptblock to another powershell instance, it must
+# be encoded to pass through the command line.
+$encodedScript = [convert]::ToBase64String(
     [Text.Encoding]::Unicode.GetBytes([string] $script))
 
-# create a new process
 $p = new-object System.Diagnostics.Process
-
-# create a startinfo object for the process
 $si = new-object System.Diagnostics.ProcessStartInfo
 $si.WorkingDirectory = $pwd
-
-if ($inconsole)
-{ 
-    $si.UseShellExecute = $false
-}
-Else
-{
-    $si.UseShellExecute = $true
-}
-
-# set up the command and arguments to run
+$si.UseShellExecute = $true
 $si.FileName = (get-command powershell.exe).Definition
-$si.Arguments = "-encodedCommand $encodedString"
+$si.Arguments = "-encodedCommand $encodedScript"
 
-# and start the powershell process
 [diagnostics.process]::Start($si)

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=787431&r1=787430&r2=787431&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/run_test.ps1 (original)
+++ qpid/trunk/qpid/cpp/src/tests/run_test.ps1 Mon Jun 22 22:51:32 2009
@@ -27,6 +27,7 @@
 # and PATH to look in the corresponding configuration off the src directory,
 # one level up.
 $prog = $args[0]
+$is_script = $prog -match ".ps1$"
 if (Test-Path $prog) {
    $env:QPID_LIB_DIR = ".."
    $env:PATH += ";.."
@@ -51,4 +52,21 @@
    set-item -path env:QPID_PORT -value (get-content -path qpidd.port -totalcount 1)
 }
 
-exit Invoke-Item "$args" | Out-Default
+#$p = new-object System.Diagnostics.Process
+$si = new-object System.Diagnostics.ProcessStartInfo
+$si.WorkingDirectory = $pwd
+$si.UseShellExecute = $true
+
+if ($is_script) {
+   $si.FileName = (get-command powershell.exe).Definition
+   $si.Arguments = $args
+}
+else {
+   $si.FileName = $args[0]
+   if ($args.length > 1) {
+      $si.Arguments = $args[1..$args.length-1]
+   }
+}
+$p = [diagnostics.process]::Start($si)
+$p.WaitForExit()
+exit $?



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