summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2009-06-03 20:00:35 +0000
committerStephen D. Huston <shuston@apache.org>2009-06-03 20:00:35 +0000
commitd7e2d5b8a2ebaa2188a294dd999bff8e27df15b6 (patch)
treedee1f1fe000c39cc72756ed81fc545cbca555976
parentcbd48a6a977974bc9a29b77f4fc4323b3558c6e1 (diff)
downloadqpid-python-d7e2d5b8a2ebaa2188a294dd999bff8e27df15b6.tar.gz
Initial capabilities to run test suite on Windows
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@781525 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/tests/CMakeLists.txt101
-rw-r--r--qpid/cpp/src/tests/background.ps136
-rw-r--r--qpid/cpp/src/tests/quick_topictest.ps129
-rw-r--r--qpid/cpp/src/tests/run_federation_tests.ps159
-rw-r--r--qpid/cpp/src/tests/run_header_test.ps140
-rw-r--r--qpid/cpp/src/tests/run_test.ps154
-rw-r--r--qpid/cpp/src/tests/start_broker.ps143
-rw-r--r--qpid/cpp/src/tests/stop_broker.ps139
-rw-r--r--qpid/cpp/src/tests/topictest.ps165
-rw-r--r--qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp55
10 files changed, 491 insertions, 30 deletions
diff --git a/qpid/cpp/src/tests/CMakeLists.txt b/qpid/cpp/src/tests/CMakeLists.txt
index a02ecad9cb..528d1e4aa4 100644
--- a/qpid/cpp/src/tests/CMakeLists.txt
+++ b/qpid/cpp/src/tests/CMakeLists.txt
@@ -35,8 +35,25 @@ endif (MSVC)
# Like this to work with cmake 2.4 on Unix
set (qpid_test_boost_libs
- boost_regex
- boost_unit_test_framework)
+ ${Boost_regex_LIBRARY}
+ ${Boost_unit_test_framework_LIBRARY})
+
+# Macro to make it easier to remember where the tests are built
+macro(remember_location testname)
+ set (${testname}_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${testname}${CMAKE_EXECUTABLE_SUFFIX})
+endmacro(remember_location)
+
+# Windows uses some process-startup calls to ensure that errors, etc. don't
+# result in error boxes being thrown up. Since it's expected that most test
+# runs will be in scripts, the default is to force these outputs to stderr
+# instead of windows. If you want to remove this code, build without the
+# QPID_WINDOWS_DEFAULT_TEST_OUTPUTS ON.
+if (CMAKE_SYSTEM_NAME STREQUAL Windows)
+ option(QPID_WINDOWS_DEFAULT_TEST_OUTPUTS "Use default error-handling on Windows tests" OFF)
+ if (NOT QPID_WINDOWS_DEFAULT_TEST_OUTPUTS)
+ set(platform_test_additions windows/DisableWin32ErrorWindows.cpp)
+ endif (NOT QPID_WINDOWS_DEFAULT_TEST_OUTPUTS)
+endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
#
# Unit test program
@@ -107,7 +124,8 @@ mark_as_advanced(unit_tests_to_build)
# amqp_0_10/Map.cpp \
# amqp_0_10/handlers.cpp
-add_executable (unit_test unit_test ${unit_tests_to_build})
+add_executable (unit_test unit_test
+ ${unit_tests_to_build} ${platform_test_additions})
# The generally recommended way to add macro settings is to use
# COMPILE_DEFINITIONS, but it's a rough go to add more than one definition
# with a value; in this case, assuming that -D works everywhere is easier.
@@ -118,6 +136,7 @@ set_source_files_properties (ReplicationTest.cpp Shlib.cpp ${xml_tests}
target_link_libraries (unit_test
${qpid_test_boost_libs}
qpidclient qpidbroker qmfconsole)
+remember_location(unit_test)
add_dependencies (check unit_test)
add_library (shlibtest MODULE shlibtest.cpp)
@@ -132,115 +151,137 @@ add_dependencies (check shlibtest)
#
# Other test programs
#
-add_executable (perftest perftest.cpp)
+add_executable (perftest perftest.cpp ${platform_test_additions})
target_link_libraries (perftest qpidclient)
#perftest_SOURCES=perftest.cpp test_tools.h TestOptions.h ConnectionOptions.h
+remember_location(perftest)
add_dependencies (check perftest)
-add_executable (txtest txtest.cpp)
+add_executable (txtest txtest.cpp ${platform_test_additions})
target_link_libraries (txtest qpidclient)
#txtest_SOURCES=txtest.cpp TestOptions.h ConnectionOptions.h
+remember_location(txtest)
add_dependencies (check txtest)
-add_executable (latencytest latencytest.cpp)
+add_executable (latencytest latencytest.cpp ${platform_test_additions})
target_link_libraries (latencytest qpidclient)
#latencytest_SOURCES=latencytest.cpp TestOptions.h ConnectionOptions.h
+remember_location(latencytest)
add_dependencies (check latencytest)
-add_executable (echotest echotest.cpp)
+add_executable (echotest echotest.cpp ${platform_test_additions})
target_link_libraries (echotest qpidclient)
#echotest_SOURCES=echotest.cpp TestOptions.h ConnectionOptions.h
+remember_location(echotest)
add_dependencies (check echotest)
-add_executable (client_test client_test.cpp)
+add_executable (client_test client_test.cpp ${platform_test_additions})
target_link_libraries (client_test qpidclient)
#client_test_SOURCES=client_test.cpp TestOptions.h ConnectionOptions.h
+remember_location(client_test)
add_dependencies (check client_test)
-add_executable (topic_listener topic_listener.cpp)
+add_executable (topic_listener topic_listener.cpp ${platform_test_additions})
target_link_libraries (topic_listener qpidclient)
#topic_listener_SOURCES=topic_listener.cpp TestOptions.h ConnectionOptions.h
+remember_location(topic_listener)
add_dependencies (check topic_listener)
-add_executable (topic_publisher topic_publisher.cpp)
+add_executable (topic_publisher topic_publisher.cpp ${platform_test_additions})
target_link_libraries (topic_publisher qpidclient)
#topic_publisher_SOURCES=topic_publisher.cpp TestOptions.h ConnectionOptions.h
+remember_location(topic_publisher)
add_dependencies (check topic_publisher)
-add_executable (publish publish.cpp)
+add_executable (publish publish.cpp ${platform_test_additions})
target_link_libraries (publish qpidclient)
#publish_SOURCES=publish.cpp TestOptions.h ConnectionOptions.h
+remember_location(publish)
add_dependencies (check publish)
-add_executable (consume consume.cpp)
+add_executable (consume consume.cpp ${platform_test_additions})
target_link_libraries (consume qpidclient)
#consume_SOURCES=consume.cpp TestOptions.h ConnectionOptions.h
+remember_location(consume)
add_dependencies (check consume)
-add_executable (header_test header_test.cpp)
+add_executable (header_test header_test.cpp ${platform_test_additions})
target_link_libraries (header_test qpidclient)
#header_test_SOURCES=header_test.cpp TestOptions.h ConnectionOptions.h
+remember_location(header_test)
add_dependencies (check header_test)
if (BUILD_CLUSTER)
- add_executable (failover_soak failover_soak.cpp ForkedBroker.cpp)
+ add_executable (failover_soak failover_soak.cpp ForkedBroker.cpp ${platform_test_additions})
target_link_libraries (failover_soak qpidclient)
#failover_soak_SOURCES=failover_soak.cpp ForkedBroker.h
+ remember_location(failover_soak)
add_dependencies (check failover_soak)
endif (BUILD_CLUSTER)
-add_executable (declare_queues declare_queues.cpp)
+add_executable (declare_queues declare_queues.cpp ${platform_test_additions})
target_link_libraries (declare_queues qpidclient)
+remember_location(declare_queues)
add_dependencies (check declare_queues)
-add_executable (replaying_sender replaying_sender.cpp)
+add_executable (replaying_sender replaying_sender.cpp ${platform_test_additions})
target_link_libraries (replaying_sender qpidclient)
+remember_location(replaying_sender)
add_dependencies (check replaying_sender)
-add_executable (resuming_receiver resuming_receiver.cpp)
+add_executable (resuming_receiver resuming_receiver.cpp ${platform_test_additions})
target_link_libraries (resuming_receiver qpidclient)
+remember_location(resuming_receiver)
add_dependencies (check resuming_receiver)
-add_executable (txshift txshift.cpp)
+add_executable (txshift txshift.cpp ${platform_test_additions})
target_link_libraries (txshift qpidclient)
#txshift_SOURCES=txshift.cpp TestOptions.h ConnectionOptions.h
+remember_location(txshift)
add_dependencies (check txshift)
-add_executable (txjob txjob.cpp)
+add_executable (txjob txjob.cpp ${platform_test_additions})
target_link_libraries (txjob qpidclient)
#txjob_SOURCES=txjob.cpp TestOptions.h ConnectionOptions.h
+remember_location(txjob)
add_dependencies (check txjob)
-add_executable (receiver receiver.cpp)
+add_executable (receiver receiver.cpp ${platform_test_additions})
target_link_libraries (receiver qpidclient)
#receiver_SOURCES=receiver.cpp TestOptions.h ConnectionOptions.h
+remember_location(receiver)
add_dependencies (check receiver)
-add_executable (sender sender.cpp)
+add_executable (sender sender.cpp ${platform_test_additions})
target_link_libraries (sender qpidclient)
#sender_SOURCES=sender.cpp TestOptions.h ConnectionOptions.h
+remember_location(sender)
add_dependencies (check sender)
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
- set (test_script_suffix ".bat")
+ set (ENV{OUTDIR} ${EXECUTABLE_OUTPUT_PATH})
+ set (test_script_suffix ".ps1")
+ set (shell "powershell")
endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
-set(test_wrap ${CMAKE_CURRENT_SOURCE_DIR}/test_wrap${test_script_suffix})
+set(test_wrap ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_test${test_script_suffix})
-add_test (unit_test unit_test)
-add_test (start_broker ${CMAKE_CURRENT_SOURCE_DIR}/start_broker${test_script_suffix})
-add_test (client_test ${test_wrap} ./client_test)
-add_test (quick_perftest ${test_wrap} ./perftest --summary --count 100)
+add_test (unit_test ${test_wrap} ${unit_test_LOCATION})
+add_test (start_broker ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/start_broker${test_script_suffix})
+add_test (client_test ${test_wrap} ${client_test_LOCATION})
+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 --queues 4 --tx-count 10 --quiet)
+add_test (quick_txtest ${test_wrap} ${txtest_LOCATION} --queues 4 --tx-count 10 --quiet)
if (PYTHON_EXECUTABLE)
- add_test (run_header_test ${test_wrap} ${CMAKE_CURRENT_SOURCE_DIR}/run_header_test${test_script_suffix})
+ add_test (run_header_test ${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 ${CMAKE_CURRENT_SOURCE_DIR}/stop_broker${test_script_suffix})
+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})
+if (BUILD_ACL)
add_test (acl_tests ${CMAKE_CURRENT_SOURCE_DIR}/run_acl_tests${test_script_suffix})
+endif (BUILD_ACL)
endif (PYTHON_EXECUTABLE)
#EXTRA_DIST += \
diff --git a/qpid/cpp/src/tests/background.ps1 b/qpid/cpp/src/tests/background.ps1
new file mode 100644
index 0000000000..096379860a
--- /dev/null
+++ b/qpid/cpp/src/tests/background.ps1
@@ -0,0 +1,36 @@
+# From http://ps1.soapyfrog.com/2007/01/22/running-pipelines-in-the-background/
+# Copyright © 2006-2009 Adrian Milliner
+param(
+ [scriptblock] $script, # scriptblock to run
+ [switch] $inconsole # don't create a new window
+)
+
+# break out of the script on any errors
+trap { break }
+
+# encode the script to pass to the child process...
+$encodedString = [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.FileName = (get-command powershell.exe).Definition
+$si.Arguments = "-encodedCommand $encodedString"
+
+# and start the powershell process
+[diagnostics.process]::Start($si)
diff --git a/qpid/cpp/src/tests/quick_topictest.ps1 b/qpid/cpp/src/tests/quick_topictest.ps1
new file mode 100644
index 0000000000..2b857edfff
--- /dev/null
+++ b/qpid/cpp/src/tests/quick_topictest.ps1
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+
+# 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:
+ cat topictest.log
+ exit $LastExitCode
+}
+rm topictest.log
+exit 0
diff --git a/qpid/cpp/src/tests/run_federation_tests.ps1 b/qpid/cpp/src/tests/run_federation_tests.ps1
new file mode 100644
index 0000000000..db3dbf5a11
--- /dev/null
+++ b/qpid/cpp/src/tests/run_federation_tests.ps1
@@ -0,0 +1,59 @@
+#
+# 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 the federation tests.
+$srcdir = Split-Path $myInvocation.ScriptName
+$PYTHON_DIR = $srcdir\..\..\..\python
+
+trap stop_brokers INT TERM QUIT
+
+start_brokers() {
+ # Start 2 brokers, saving the port numbers in LOCAL_PORT, REMOTE_PORT.
+ . $srcdir\background.ps1 {
+ ..\Debug\qpidd --auth=no --no-module-dir --port=0 --log-to-file qpidd.log $args | foreach { set-content qpidd.port $_ } }
+ while (!(Test-Path qpidd.port)) {
+ Start-Sleep 2
+ }
+ set-item -path env:LOCAL_PORT -value (get-content -path qpidd.port -totalcount 1)
+ Remove-Item qpidd.port
+ . $srcdir\background.ps1 {
+ ..\Debug\qpidd --auth=no --no-module-dir --port=0 --log-to-file qpidd.log $args | foreach { set-content qpidd.port $_ } }
+ while (!(Test-Path qpidd.port)) {
+ Start-Sleep 2
+ }
+ set-item -path env:REMOTE_PORT -value (get-content -path qpidd.port -totalcount 1)
+}
+
+stop_brokers() {
+ ..\Debug\qpidd -q --port $LOCAL_PORT | Out-Default
+ ..\Debug\qpidd -q --port $REMOTE_PORT | Out-Default
+}
+
+if (Test-Path $PYTHON_DIR -pathType Container) {
+ start_brokers
+ "Running federation tests using brokers on ports $LOCAL_PORT $REMOTE_PORT"
+ $env:PYTHONPATH=$PYTHON_DIR
+ $srcdir/federation.py -v -s $srcdir\..\..\..\specs\amqp.0-10-qpid-errata.xml -b localhost:$LOCAL_PORT --remote-port $REMOTE_PORT $args
+ $RETCODE=$LASTEXITCODE
+ stop_brokers
+ if ($RETCODE != 0) {
+ "FAIL federation tests"
+ exit 1
+ }
+}
diff --git a/qpid/cpp/src/tests/run_header_test.ps1 b/qpid/cpp/src/tests/run_header_test.ps1
new file mode 100644
index 0000000000..add680f569
--- /dev/null
+++ b/qpid/cpp/src/tests/run_header_test.ps1
@@ -0,0 +1,40 @@
+#
+# 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.
+#
+
+# Simple test of encode/decode of a double in application headers
+# 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
+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
+ $env:PYTHONPATH="$PYTHON_DIR;$env:PYTHONPATH"
+ $srcdir/header_test.py "localhost" $QPID_PORT
+ exit $LASTEXITCODE
+}
+else {
+ "Skipping header test as python libs not found"
+ exit 0
+}
+
diff --git a/qpid/cpp/src/tests/run_test.ps1 b/qpid/cpp/src/tests/run_test.ps1
new file mode 100644
index 0000000000..fccf205b9d
--- /dev/null
+++ b/qpid/cpp/src/tests/run_test.ps1
@@ -0,0 +1,54 @@
+#
+# 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.
+#
+
+# Set up environment and run a test executable or script.
+$env:QPID_DATA_DIR = ""
+$env:BOOST_TEST_SHOW_PROGRESS = "yes"
+
+# The test exe is probably not in the current binary dir - it's usually
+# placed in a subdirectory based on the configuration built in Visual Studio.
+# So check around to see where it is - when located, set the QPID_LIB_DIR
+# and PATH to look in the corresponding configuration off the src directory,
+# one level up.
+$prog = $args[0]
+if (Test-Path $prog) {
+ $env:QPID_LIB_DIR = ".."
+ $env:PATH += ";.."
+}
+else {
+ $dir = Split-Path $prog
+ $exe = Split-Path $prog -leaf
+ $subs = "Debug","Release","MinSizeRel","RelWithDebInfo"
+ foreach ($sub in $subs) {
+ $prog = "$dir\$sub\$exe"
+ if (Test-Path $prog) {
+ $args[0] = $prog
+ $env:QPID_LIB_DIR = "..\$sub"
+ $env:PATH += ";..\$sub"
+ break
+ }
+ }
+}
+
+# If qpidd.port exists and is not empty run test with QPID_PORT set.
+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
diff --git a/qpid/cpp/src/tests/start_broker.ps1 b/qpid/cpp/src/tests/start_broker.ps1
new file mode 100644
index 0000000000..f2aa20439a
--- /dev/null
+++ b/qpid/cpp/src/tests/start_broker.ps1
@@ -0,0 +1,43 @@
+#
+# 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.
+#
+
+# Get the directory where this script resides.
+function Get-ScriptPath
+ { Split-Path $myInvocation.ScriptName }
+
+# Start a test broker and capture it's port (from stdout) to qpidd.port
+# This script will exit immediately after spawning the broker process. To avoid
+# running more tests before the broker is initialized, wait for the qpidd.port
+# file to appear before exiting.
+if (Test-Path qpidd.port) {
+ Remove-Item qpidd.port
+}
+$srcdir = Get-ScriptPath
+. $srcdir\background.ps1 {
+ ..\Debug\qpidd --auth=no --no-module-dir --port=0 --log-to-file qpidd.log $args | foreach { set-content qpidd.port $_ } }
+$wait_time = 0
+while (!(Test-Path qpidd.port) -and ($wait_time -lt 10)) {
+ Start-Sleep 2
+ $wait_time += 2
+}
+if (Test-Path qpidd.port) {
+ exit 0
+}
+"Time out waiting for broker to start"
+exit 1
diff --git a/qpid/cpp/src/tests/stop_broker.ps1 b/qpid/cpp/src/tests/stop_broker.ps1
new file mode 100644
index 0000000000..2329fdcf28
--- /dev/null
+++ b/qpid/cpp/src/tests/stop_broker.ps1
@@ -0,0 +1,39 @@
+#
+# 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.
+#
+
+# Stop the broker, check for errors.
+Get-Content -path qpidd.port -totalCount 1 | Set-Variable -name qpid_port
+Remove-Item qpidd.port
+
+# Piping the output makes the script wait for qpidd to finish.
+..\Debug\qpidd --quit --port $qpid_port | Write-Output
+
+# Check qpidd.log.
+filter bad_stuff {
+ $_ -match "( warning | error | critical )"
+}
+
+$qpidd_errors = $false
+Get-Content -path qpidd.log | where { bad_stuff } | Out-Default | Set-Variable -name qpidd_errors -value $true
+if ($qpidd_errors -eq $true) {
+ "WARNING: Suspicious broker log entries in qpidd.log, above."
+ exit 1
+}
+
+exit 0
diff --git a/qpid/cpp/src/tests/topictest.ps1 b/qpid/cpp/src/tests/topictest.ps1
new file mode 100644
index 0000000000..04dae23ad9
--- /dev/null
+++ b/qpid/cpp/src/tests/topictest.ps1
@@ -0,0 +1,65 @@
+#
+# 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 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 (
+ [int]$subscribers = 10,
+ [int]$messages = 2000,
+ [int]$batches = 10,
+ [string]$broker,
+ [switch] $t # transactional
+)
+
+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
+}
+
+publish() {
+ if ($t) {
+ $transactional = "--transactional --durable"
+ }
+ $env:OUTDIR\topic_publisher --messages $messages --batches $batches --subscribers $subscribers $host $transactional 2>&1
+}
+
+$srcdir = Split-Path $myInvocation.ScriptName
+if ($broker.length) {
+ $broker = "-h$broker"
+}
+
+$i = $subscribers
+while ($i -gt 0) {
+ subscribe $i
+ $i--
+}
+
+# FIXME aconway 2007-03-27: Hack around startup race. Fix topic test.
+Start-Sleep 2
+publish
+exit $LastExitCode
diff --git a/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp b/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp
new file mode 100644
index 0000000000..d51ed90758
--- /dev/null
+++ b/qpid/cpp/src/tests/windows/DisableWin32ErrorWindows.cpp
@@ -0,0 +1,55 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+// This file intends to prevent Windows from throwing up error boxes and
+// offering to debug when serious errors happen. The errors are displayed
+// on stderr instead. The purpose of this is to allow the tests to proceed
+// scripted and catch the text for logging. If this behavior is desired,
+// include this file with the executable being built. If the default
+// behaviors are desired, don't include this file in the build.
+
+#include <crtdbg.h>
+#include <windows.h>
+
+namespace {
+
+struct redirect_errors_to_stderr {
+ redirect_errors_to_stderr ();
+};
+
+static redirect_errors_to_stderr block;
+
+redirect_errors_to_stderr::redirect_errors_to_stderr()
+{
+ _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile (_CRT_WARN, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile (_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile (_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+
+ // Prevent the system from displaying the critical-error-handler
+ // and can't-open-file message boxes.
+ SetErrorMode(SEM_FAILCRITICALERRORS);
+ SetErrorMode(SEM_NOOPENFILEERRORBOX);
+}
+
+} // namespace