summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2009-10-05 23:35:23 +0000
committerStephen D. Huston <shuston@apache.org>2009-10-05 23:35:23 +0000
commit9c5296bbd4adde01e85b97c43de23149779ae3ad (patch)
tree1a52912058683bf352b611affd6413487f8a69e0 /cpp
parent87258f571db29fa78f257281d3cfa1d1bd62a01a (diff)
downloadqpid-python-9c5296bbd4adde01e85b97c43de23149779ae3ad.tar.gz
Get remaining tests running on Windows
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@822091 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/tests/python_tests.ps142
-rw-r--r--cpp/src/tests/run_federation_tests.ps165
-rw-r--r--cpp/src/tests/run_header_test.ps137
3 files changed, 119 insertions, 25 deletions
diff --git a/cpp/src/tests/python_tests.ps1 b/cpp/src/tests/python_tests.ps1
new file mode 100644
index 0000000000..a7f6920783
--- /dev/null
+++ b/cpp/src/tests/python_tests.ps1
@@ -0,0 +1,42 @@
+#
+# 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 python tests; intended to be run by run_test.ps1 which sets up
+# QPID_PORT
+$srcdir = Split-Path $myInvocation.InvocationName
+$PYTHON_DIR = "$srcdir\..\..\..\python"
+if (!(Test-Path $PYTHON_DIR -pathType Container)) {
+ "Skipping header test as python libs not found"
+ exit 1
+}
+
+if (Test-Path env:FAILING) {
+ $fails = "-I $env:FAILING"
+}
+if (Test-Path env:PYTHON_TESTS) {
+ $tests = "$env:PYTHON_TESTS"
+}
+else {
+ $tests = "*"
+}
+
+#cd $PYTHON_DIR
+$env:PYTHONPATH="$PYTHON_DIR;$env:PYTHONPATH"
+python $PYTHON_DIR/qpid-python-test -b localhost:$env:QPID_PORT $fails $tests
+exit $LASTEXITCODE
diff --git a/cpp/src/tests/run_federation_tests.ps1 b/cpp/src/tests/run_federation_tests.ps1
index db3dbf5a11..dd0ea2fe5b 100644
--- a/cpp/src/tests/run_federation_tests.ps1
+++ b/cpp/src/tests/run_federation_tests.ps1
@@ -18,42 +18,63 @@
#
# Run the federation tests.
-$srcdir = Split-Path $myInvocation.ScriptName
-$PYTHON_DIR = $srcdir\..\..\..\python
-trap stop_brokers INT TERM QUIT
+$srcdir = Split-Path $myInvocation.InvocationName
+$PYTHON_DIR = "$srcdir\..\..\..\python"
+if (!(Test-Path $PYTHON_DIR -pathType Container)) {
+ "Skipping federation tests as python libs not found"
+ exit 1
+}
-start_brokers() {
+# Test runs from the tests directory but the broker executable is one level
+# up, and most likely in a subdirectory from there based on what build type.
+# Look around for it before trying to start it.
+$subs = "Debug","Release","MinSizeRel","RelWithDebInfo"
+foreach ($sub in $subs) {
+ $prog = "..\$sub\qpidd.exe"
+ if (Test-Path $prog) {
+ break
+ }
+}
+if (!(Test-Path $prog)) {
+ "Cannot locate qpidd.exe"
+ exit 1
+}
+$cmdline = "$prog --auth=no --no-module-dir --port=0 --log-to-file qpidd.log $args | foreach { set-content qpidd.port `$_ }"
+$cmdblock = $executioncontext.invokecommand.NewScriptBlock($cmdline)
+
+function 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 $_ } }
+ . $srcdir\background.ps1 $cmdblock
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 $_ } }
+ . $srcdir\background.ps1 $cmdblock
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
+function stop_brokers {
+ Invoke-Expression "$prog -q --port $env:LOCAL_PORT" | Out-Default
+ Invoke-Expression "$prog -q --port $env:REMOTE_PORT" | Out-Default
+}
+
+trap {
+ &stop_brokers
+ break
}
-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
- }
+&start_brokers
+"Running federation tests using brokers on ports $env:LOCAL_PORT $env:REMOTE_PORT"
+$env:PYTHONPATH=$PYTHON_DIR
+python $srcdir/federation.py -v -s $srcdir\..\..\..\specs\amqp.0-10-qpid-errata.xml -b localhost:$env:LOCAL_PORT --remote-port $env:REMOTE_PORT $args
+$RETCODE=$LASTEXITCODE
+&stop_brokers
+if ($RETCODE -ne 0) {
+ "FAIL federation tests"
+ exit 1
}
diff --git a/cpp/src/tests/run_header_test.ps1 b/cpp/src/tests/run_header_test.ps1
index eedac3eaae..df778a05a1 100644
--- a/cpp/src/tests/run_header_test.ps1
+++ b/cpp/src/tests/run_header_test.ps1
@@ -21,19 +21,50 @@
# TODO: this should be expanded to cover a wider set of types and go
# in both directions
+<<<<<<< .mine
$srcdir = Split-Path $myInvocation.InvocationName
$PYTHON_DIR = "$srcdir\..\..\..\python"
+if (!(Test-Path $PYTHON_DIR -pathType Container)) {
+ "Skipping header test as python libs not found"
+ exit 0
+}
+
+=======
+$srcdir = Split-Path $myInvocation.InvocationName
+$PYTHON_DIR = "$srcdir\..\..\..\python"
+>>>>>>> .r822090
if (Test-Path qpidd.port) {
set-item -path env:QPID_PORT -value (get-content -path qpidd.port -totalcount 1)
}
+<<<<<<< .mine
+# Test runs from the tests directory but the test executables are in a
+# subdirectory based on the build type. Look around for it before trying
+# to start it.
+$subs = "Debug","Release","MinSizeRel","RelWithDebInfo"
+foreach ($sub in $subs) {
+ $prog = ".\$sub\header_test.exe"
+ if (Test-Path $prog) {
+ break
+ }
+=======
if (Test-Path $PYTHON_DIR -pathType Container) {
Invoke-Expression "$env:OUTDIR\header_test -p $env:QPID_PORT"
$env:PYTHONPATH="$PYTHON_DIR;$env:PYTHONPATH"
python "$srcdir/header_test.py" "localhost" "$env:QPID_PORT"
exit $LASTEXITCODE
+>>>>>>> .r822090
}
-else {
- "Skipping header test as python libs not found"
- exit 0
+if (!(Test-Path $prog)) {
+ "Cannot locate header_test.exe"
+ exit 1
}
+<<<<<<< .mine
+
+Invoke-Expression "$prog -p $env:QPID_PORT" | Write-Output
+$env:PYTHONPATH="$PYTHON_DIR;$env:PYTHONPATH"
+Invoke-Expression "python $srcdir/header_test.py localhost $env:QPID_PORT" | Write-Output
+exit $LASTEXITCODE
+
+=======
+>>>>>>> .r822090