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/15 02:38:19 UTC
svn commit: r825358 - in /qpid/trunk/qpid/cpp/src/tests: find_prog.ps1
quick_topictest.ps1 run_header_test.ps1 run_test.ps1 topictest.ps1
Author: shuston
Date: Thu Oct 15 00:38:18 2009
New Revision: 825358
URL: http://svn.apache.org/viewvc?rev=825358&view=rev
Log:
Improved test output capturing in automated tests; correctly get exe process exit codes
Added:
qpid/trunk/qpid/cpp/src/tests/find_prog.ps1
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
Added: qpid/trunk/qpid/cpp/src/tests/find_prog.ps1
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/find_prog.ps1?rev=825358&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/find_prog.ps1 (added)
+++ qpid/trunk/qpid/cpp/src/tests/find_prog.ps1 Thu Oct 15 00:38:18 2009
@@ -0,0 +1,36 @@
+#
+# 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.
+#
+
+# Locate the subdirectory where the specified program resides; the program
+# must have a directory and a file name, even if the directory is .
+param(
+ [string] $prog # program to look for somewhere below cwd
+)
+
+$dir = Split-Path $prog
+$exe = Split-Path $prog -leaf
+$sub = ""
+$subs = "Debug","Release","MinSizeRel","RelWithDebInfo"
+foreach ($try in $subs) {
+ $prog = "$dir\$try\$exe"
+ if (Test-Path $prog) {
+ $sub = $try
+ break
+ }
+}
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=825358&r1=825357&r2=825358&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/quick_topictest.ps1 (original)
+++ qpid/trunk/qpid/cpp/src/tests/quick_topictest.ps1 Thu Oct 15 00:38:18 2009
@@ -20,7 +20,7 @@
# Quick and quiet topic test for make check.
[string]$me = $myInvocation.InvocationName
$srcdir = Split-Path $me
-powershell "$srcdir\topictest.ps1" -subscribers 2 -messages 2 -batches 1 > topictest.log 2>&1
+& "$srcdir\topictest.ps1" -subscribers 2 -messages 2 -batches 1 > topictest.log 2>&1
if (!$?) {
"$me FAILED:"
cat topictest.log
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=825358&r1=825357&r2=825358&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/run_header_test.ps1 (original)
+++ qpid/trunk/qpid/cpp/src/tests/run_header_test.ps1 Thu Oct 15 00:38:18 2009
@@ -35,13 +35,7 @@
# 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
- }
-}
+. $srcdir\find_prog.ps1 .\header_test.exe
if (!(Test-Path $prog)) {
"Cannot locate header_test.exe"
exit 1
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=825358&r1=825357&r2=825358&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/run_test.ps1 (original)
+++ qpid/trunk/qpid/cpp/src/tests/run_test.ps1 Thu Oct 15 00:38:18 2009
@@ -17,6 +17,8 @@
# under the License.
#
+$srcdir = Split-Path $myInvocation.InvocationName
+
# Set up environment and run a test executable or script.
$env:QPID_DATA_DIR = ""
$env:BOOST_TEST_SHOW_PROGRESS = "yes"
@@ -33,18 +35,10 @@
$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
- }
- }
+ . $srcdir\find_prog.ps1 $prog
+ $args[0] = $prog
+ $env:QPID_LIB_DIR = "..\$sub"
+ $env:PATH += "$dir\$sub;..\$sub"
}
# If qpidd.port exists and is not empty run test with QPID_PORT set.
@@ -54,18 +48,25 @@
$si = new-object System.Diagnostics.ProcessStartInfo
$si.WorkingDirectory = $pwd
-$si.UseShellExecute = $true
-
+$si.UseShellExecute = $false
+$si.CreateNoWindow = $true
+$si.RedirectStandardOutput = $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]
+ if ($args.length -gt 1) {
+ $si.Arguments = $args[1..($args.length-1)]
}
}
$p = [System.Diagnostics.Process]::Start($si)
+$line = ""
+while (($line = $p.StandardOutput.ReadLine()) -ne $null) {
+ $line
+}
+# ReadToEnd() works, but doesn't show any output until the program exits.
+#$p.StandardOutput.ReadToEnd()
$p.WaitForExit()
-exit $?
+exit $p.ExitCode
Modified: qpid/trunk/qpid/cpp/src/tests/topictest.ps1
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/topictest.ps1?rev=825358&r1=825357&r2=825358&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/topictest.ps1 (original)
+++ qpid/trunk/qpid/cpp/src/tests/topictest.ps1 Thu Oct 15 00:38:18 2009
@@ -18,6 +18,7 @@
#
# Run the C++ topic test
+$srcdir = Split-Path $myInvocation.InvocationName
# Parameters with default values: s (subscribers) m (messages) b (batches)
# h (host) t (false; use transactions)
@@ -36,21 +37,23 @@
$transactional = "--transactional --durable"
}
+# Find which subdir the exes are in
+. $srcdir\find_prog.ps1 .\topic_listener.exe
+
function subscribe {
param ([int]$num)
"Start subscriber $num"
$LOG = "subscriber_$num.log"
- $cmdline = "$env:OUTDIR\topic_listener $transactional > $LOG 2>&1
+ $cmdline = ".\$sub\topic_listener $transactional > $LOG 2>&1
if (`$LastExitCode -ne 0) { Remove-Item $LOG }"
$cmdblock = $executioncontext.invokecommand.NewScriptBlock($cmdline)
. $srcdir\background.ps1 $cmdblock
}
function publish {
- Invoke-Expression "$env:OUTDIR\topic_publisher --messages $messages --batches $batches --subscribers $subscribers $host $transactional" 2>&1
+ Invoke-Expression ".\$sub\topic_publisher --messages $messages --batches $batches --subscribers $subscribers $host $transactional" 2>&1
}
-$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