summaryrefslogtreecommitdiff
path: root/cpp/src/tests
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2009-06-22 22:51:32 +0000
committerStephen D. Huston <shuston@apache.org>2009-06-22 22:51:32 +0000
commite885a92dccf2b18744af1210138c12ca7bc7ff97 (patch)
tree091ecb8419c0384083055ec734defc695a4dcc1d /cpp/src/tests
parent9941a77af5691503d289d2b7c82b222735b74f17 (diff)
downloadqpid-python-e885a92dccf2b18744af1210138c12ca7bc7ff97.tar.gz
Script fixes to get tests going on Windows; includes properly licensed background.ps1
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@787431 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
-rw-r--r--cpp/src/tests/CMakeLists.txt9
-rw-r--r--cpp/src/tests/background.ps148
-rw-r--r--cpp/src/tests/run_test.ps120
3 files changed, 51 insertions, 26 deletions
diff --git a/cpp/src/tests/CMakeLists.txt b/cpp/src/tests/CMakeLists.txt
index 528d1e4aa4..06f22fc487 100644
--- a/cpp/src/tests/CMakeLists.txt
+++ b/cpp/src/tests/CMakeLists.txt
@@ -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_perftest ${test_wrap} ${perftest_LOCATION} --summary --count 100
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)
diff --git a/cpp/src/tests/background.ps1 b/cpp/src/tests/background.ps1
index 096379860a..934078602b 100644
--- a/cpp/src/tests/background.ps1
+++ b/cpp/src/tests/background.ps1
@@ -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)
diff --git a/cpp/src/tests/run_test.ps1 b/cpp/src/tests/run_test.ps1
index fccf205b9d..ebbef07f1d 100644
--- a/cpp/src/tests/run_test.ps1
+++ b/cpp/src/tests/run_test.ps1
@@ -27,6 +27,7 @@ $env:BOOST_TEST_SHOW_PROGRESS = "yes"
# 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 @@ if (Test-Path qpidd.port) {
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 $?