Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 028BA17E9B for ; Tue, 17 Mar 2015 16:15:39 +0000 (UTC) Received: (qmail 20419 invoked by uid 500); 17 Mar 2015 16:15:38 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 20386 invoked by uid 500); 17 Mar 2015 16:15:38 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 20377 invoked by uid 99); 17 Mar 2015 16:15:38 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Mar 2015 16:15:38 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 92800AC0163 for ; Tue, 17 Mar 2015 16:15:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1667349 - in /qpid/trunk/qpid/cpp/src/tests: CMakeLists.txt run_test run_test.ps1 test_env.ps1.in Date: Tue, 17 Mar 2015 16:15:38 -0000 To: commits@qpid.apache.org From: shuston@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150317161538.92800AC0163@hades.apache.org> Author: shuston Date: Tue Mar 17 16:15:37 2015 New Revision: 1667349 URL: http://svn.apache.org/r1667349 Log: Align run_test shell and Powershell versions. Changes the option syntax from two-hyphen to one. Fixes QPID-6399. Modified: qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt qpid/trunk/qpid/cpp/src/tests/run_test qpid/trunk/qpid/cpp/src/tests/run_test.ps1 qpid/trunk/qpid/cpp/src/tests/test_env.ps1.in Modified: qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt?rev=1667349&r1=1667348&r2=1667349&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt (original) +++ qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt Tue Mar 17 16:15:37 2015 @@ -148,8 +148,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL Windows) set (shell "powershell") endif (CMAKE_SYSTEM_NAME STREQUAL Windows) -set(test_wrap ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_test${test_script_suffix} --build-dir=${CMAKE_BINARY_DIR}) -set(python_wrap ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_test${test_script_suffix} --build-dir=${CMAKE_BINARY_DIR} --python) +set(test_wrap ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_test${test_script_suffix} -buildDir ${CMAKE_BINARY_DIR}) +set(python_wrap ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_test${test_script_suffix} -buildDir ${CMAKE_BINARY_DIR} -python) if (BUILD_TESTING_UNITTESTS) @@ -242,7 +242,7 @@ target_link_libraries (unit_test set_target_properties (unit_test PROPERTIES COMPILE_DEFINITIONS _IN_QPID_BROKER) remember_location(unit_test) -add_test (unit_test ${test_wrap} --boost-test -- ${unit_test_LOCATION}) +add_test (unit_test ${test_wrap} -boostTest -- ${unit_test_LOCATION}) endif (BUILD_TESTING_UNITTESTS) @@ -348,14 +348,14 @@ if (BUILD_SASL) add_test(ssl_test ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/ssl_test${test_script_suffix}) endif (BUILD_SSL) endif (BUILD_SASL) -add_test (qpid-client-test ${test_wrap} --start-broker -- ${qpid-client-test_LOCATION}) -add_test (quick_perftest ${test_wrap} --start-broker -- ${qpid-perftest_LOCATION} --summary --count 100) -add_test (quick_topictest ${test_wrap} --start-broker -- ${CMAKE_CURRENT_SOURCE_DIR}/quick_topictest${test_script_suffix}) -add_test (quick_txtest ${test_wrap} --start-broker -- ${qpid-txtest_LOCATION} --queues 4 --tx-count 10 --quiet) -add_test (quick_txtest2 ${test_wrap} --start-broker -- ${qpid-txtest2_LOCATION} --queues 4 --tx-count 10 --quiet) -add_test (msg_group_tests ${test_wrap} --start-broker -- ${CMAKE_CURRENT_SOURCE_DIR}/run_msg_group_tests${test_script_suffix}) -add_test (run_header_test ${test_wrap} --start-broker -- ${CMAKE_CURRENT_SOURCE_DIR}/run_header_test${test_script_suffix}) -add_test (python_tests ${test_wrap} --start-broker -- ${CMAKE_CURRENT_SOURCE_DIR}/python_tests${test_script_suffix}) +add_test (qpid-client-test ${test_wrap} -startBroker -- ${qpid-client-test_LOCATION}) +add_test (quick_perftest ${test_wrap} -startBroker -- ${qpid-perftest_LOCATION} --summary --count 100) +add_test (quick_topictest ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/quick_topictest${test_script_suffix}) +add_test (quick_txtest ${test_wrap} -startBroker -- ${qpid-txtest_LOCATION} --queues 4 --tx-count 10 --quiet) +add_test (quick_txtest2 ${test_wrap} -startBroker -- ${qpid-txtest2_LOCATION} --queues 4 --tx-count 10 --quiet) +add_test (msg_group_tests ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/run_msg_group_tests${test_script_suffix}) +add_test (run_header_test ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/run_header_test${test_script_suffix}) +add_test (python_tests ${test_wrap} -startBroker -- ${CMAKE_CURRENT_SOURCE_DIR}/python_tests${test_script_suffix}) if (NOT CMAKE_SYSTEM_NAME STREQUAL Windows) # paged queue not yet implemented for windows add_test (paged_queue_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_paged_queue_tests${test_script_suffix}) @@ -377,7 +377,7 @@ add_test (federation_tests ${shell} ${CM add_test (federation_sys_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_federation_sys_tests${test_script_suffix}) add_test (queue_flow_limit_tests ${test_wrap} - --start-broker "--broker-options=--default-flow-stop-threshold=80 --default-flow-resume-threshold=70" + -startBroker -brokerOptions "--default-flow-stop-threshold=80 --default-flow-resume-threshold=70" -- ${CMAKE_CURRENT_SOURCE_DIR}/run_queue_flow_limit_tests${test_script_suffix}) if (BUILD_ACL) add_test (acl_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_acl_tests${test_script_suffix}) Modified: qpid/trunk/qpid/cpp/src/tests/run_test URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/run_test?rev=1667349&r1=1667348&r2=1667349&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/tests/run_test (original) +++ qpid/trunk/qpid/cpp/src/tests/run_test Tue Mar 17 16:15:37 2015 @@ -34,17 +34,17 @@ wrapper="Qpid Test Wrapper" function usage { echo "Usage:" - echo " --working-dir DIR" - echo " --build-dir DIR" - echo " --source-dir DIR" - echo " --python - run python script" - echo " --boost-test - run boost unit test" - echo " --xml - XML output from tests" - echo " --start-broker - start/stop broker before/after test" - echo " --broker-options - use these extra options when starting broker" - echo " --help - print this message" - echo " -- - This is required to separate the wrapped command" - echo " from the test parameters" + echo " -workingDir DIR" + echo " -buildDir DIR" + echo " -sourceDir DIR" + echo " -python - run python script" + echo " -boostTest - run boost unit test" + echo " -xml - XML output from tests" + echo " -startBroker - start/stop broker before/after test" + echo " -brokerOptions - use these extra options when starting broker" + echo " -help - print this message" + echo " -- - This is required to separate the wrapped command" + echo " from the test parameters" } function illegal_option { @@ -66,21 +66,21 @@ working_dir='.' while true; do case "$1" in --) shift; break ;; - # Split up any parameters expressed as --blah=foo + # Split up any parameters expressed as -blah=foo # and process them next time round the loop - --*=*) option=${1%%=*}; param=${1#*=} + -*=*) option=${1%%=*}; param=${1#*=} shift; set -- "$option" "$param" "$@" ;; - --working-dir) working_dir=$2; shift 2 ;; - --build-dir) build_dir=$2; shift 2 ;; - --source-dir) source_dir=$2; shift 2 ;; - --python) run_python=yes; shift ;; - --boost-test) boost_test=yes; shift ;; - --xml) xml_output=yes; shift ;; - --start-broker) start_broker=yes; shift ;; - --broker-options) qpidd_extra_options=$2; shift 2 ;; - --help) usage; exit 0; ;; - --*) illegal_option "$1"; exit 1; ;; + -workingDir) working_dir=$2; shift 2 ;; + -buildDir) build_dir=$2; shift 2 ;; + -sourceDir) source_dir=$2; shift 2 ;; + -python) run_python=yes; shift ;; + -boostTest) boost_test=yes; shift ;; + -xml) xml_output=yes; shift ;; + -startBroker) start_broker=yes; shift ;; + -brokerOptions) qpidd_extra_options=$2; shift 2 ;; + -help) usage; exit 0; ;; + -*) illegal_option "$1"; exit 1; ;; '') no_command; exit 1; ;; *) ignored_argument "$1"; shift; ;; esac 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=1667349&r1=1667348&r2=1667349&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/tests/run_test.ps1 (original) +++ qpid/trunk/qpid/cpp/src/tests/run_test.ps1 Tue Mar 17 16:15:37 2015 @@ -17,52 +17,146 @@ # under the License. # -$srcdir = Split-Path $myInvocation.InvocationName +param( + [string]$workingDir = $pwd, + [string]$buildDir = $(throw "-buildDir is required"), + [string]$sourceDir, + [switch]$python = $false, + [switch]$boostTest = $false, + [switch]$xml, + [switch]$startBroker = $false, + [string]$brokerOptions, + [switch]$help, + [Parameter(Mandatory=$true, ValueFromRemainingArguments=$true, Position=0)] + [String[]]$rest + ) +if ([string]::IsNullOrEmpty($sourceDir)) { + $sourceDir = Split-Path $myInvocation.InvocationName +} + +if ([string]::IsNullOrEmpty($xml)) { + $xml = Test-Path variable:global:QPID_XML_TEST_OUTPUT +} + # Set up environment and run a test executable or script. . .\test_env.ps1 +if ($rest[0] -eq $null) { + "No wrapped command specified" + exit 1 +} # 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] +$prog = $rest[0] +$logfilebase = [System.IO.Path]::GetFileNameWithoutExtension($prog) +$logfilebase = "$pwd\\$logfilebase" +# Qpid client lib sees QPID_LOG_TO_FILE; acts like using --log-to-file on +# command line. +$env:QPID_LOG_TO_FILE = "$logfilebase.log" $is_script = $prog -match ".ps1$" +if (($is_script -or $python) -and !(Test-Path "$prog")) { + "$prog does not exist" + exit 1 +} if (!$is_script -and !(Test-Path "$prog")) { - . $srcdir\find_prog.ps1 $prog - $args[0] = $prog + . $sourceDir\find_prog.ps1 $prog + $rest[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. -if (Test-Path qpidd.port) { - set-item -path env:QPID_PORT -value (get-content -path qpidd.port -totalcount 1) -} - -$si = new-object System.Diagnostics.ProcessStartInfo -$si.WorkingDirectory = $pwd -$si.UseShellExecute = $false -$si.CreateNoWindow = $true -$si.RedirectStandardOutput = $true -if ($is_script) { - $si.FileName = (get-command powershell.exe).Definition - $si.Arguments = $args +# Set up environment for running a Qpid test. If a broker should be started, +# do that, else check for a saved port number to use. +if ($startBroker) { + $broker = new-object System.Diagnostics.ProcessStartInfo + $broker.WorkingDirectory = $pwd + $broker.UseShellExecute = $false + $broker.CreateNoWindow = $true + $broker.RedirectStandardOutput = $true + $broker.FileName = $env:QPIDD_EXEC + $broker.Arguments = "--auth=no --no-module-dir --port=0 --interface 127.0.0.1 --log-to-file $logfilebase-qpidd.log $brokerOptions" + $broker_process = [System.Diagnostics.Process]::Start($broker) + $env:QPID_PORT = $broker_process.StandardOutput.ReadLine() +} +else { + # 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) + } +} + +# Now start the real test. +if ($python) { + $to_run = $PYTHON_EXE + $skip_args0 = $false + $outputfile = "" +} +elseif ($boostTest) { + if ($xml) { + $env:BOOST_TEST_SHOW_PROGRESS=no + $env:BOOST_TEST_OUTPUT_FORMAT=XML + $env:BOOST_TEST_LOG_LEVEL=test_suite + $env:BOOST_TEST_REPORT_LEVEL=no + $to_run = $rest[0] + $skip_args0 = $true + $outputfile = "$logfilebase-unittest.xml" + } + else { + $to_run = $rest[0] + $skip_args0 = $true + $outputfile = "" + } +} +else { + # Non-boost executable or powershell script + $outputfile = "" + if ($is_script) { + $to_run = (get-command powershell.exe).Definition + $skip_args0 = $false + } + else { + $to_run = $rest[0] + $skip_args0 = $true + } +} + +if ($skip_args0) { + $arglist = $rest[1..($rest.length-1)] +} +else { + $arglist = $rest +} + +if ($outputfile -eq "") { + $p = Start-Process -FilePath $to_run -ArgumentList $arglist -NoNewWindow -PassThru + $line = "" } else { - $si.FileName = $args[0] - 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() + $p = Start-Process -FilePath $to_run -ArgumentList $arglist -NoNewWindow -RedirectStandardOutput $outputfile -PassThru +} +Wait-Process -InputObject $p $status = $p.ExitCode + +if (Test-Path $env:QPID_LOG_TO_FILE) { + $problems = Select-String -Path $env:QPID_LOG_TO_FILE -pattern " error ", " warning ", " critical " + if ($problems -ne $null) { + "WARNING: suspicious log entries in $env:QPID_LOG_TO_FILE:\n$problems" + $status = 1 + } +} + +# If a broker was started, stop it. +if ($startBroker) { + & $env:QPIDD_EXEC --no-module-dir --quit + # Check qpid log for problems + $problems = Select-String -Path $logfilebase-qpidd.log -pattern " error ", " warning ", " critical " + if ($problems -ne $null) { + "WARNING: suspicious log entries in $logfilebase-qpidd.log:\n$problems" + $status = 1 + } +} + exit $status Modified: qpid/trunk/qpid/cpp/src/tests/test_env.ps1.in URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/test_env.ps1.in?rev=1667349&r1=1667348&r2=1667349&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/tests/test_env.ps1.in (original) +++ qpid/trunk/qpid/cpp/src/tests/test_env.ps1.in Tue Mar 17 16:15:37 2015 @@ -18,14 +18,16 @@ # # Environment variables substituted by configure/cmake. -$srcdir="@abs_srcdir@" -$builddir="@abs_builddir@" +$abs_srcdir="@abs_srcdir@" +$abs_builddir="@abs_builddir@" $top_srcdir="@abs_top_srcdir@" $top_builddir="@abs_top_builddir@" $moduledir="$top_builddir\src@builddir_lib_suffix@" $testmoduledir="$builddir@builddir_lib_suffix@" +$BOOST_LIBRARYDIR="@BOOST_LIBRARYDIR@" # Python paths and directories +$PYTHON_EXE="@PYTHON_EXECUTABLE@" $PYTHON_DIR="$builddir\python" $QPID_PYTHON_TEST="$PYTHON_DIR\commands\qpid-python-test" if ( !(Test-Path "$PYTHON_DIR") -and (Test-Path "$top_srcdir\..\python")) { @@ -44,16 +46,16 @@ $QPID_ROUTE_EXEC="$PYTHON_COMMANDS\qpid- $QPID_HA_TOOL_EXEC="$PYTHON_COMMANDS\qpid-ha-tool" # Executables -$env:QPIDD_EXEC="$top_builddir\src\qpidd" +$env:QPIDD_EXEC="$top_builddir\src\@CMAKE_BUILD_TYPE@\qpidd.exe" $env:QPID_WATCHDOG_EXEC="$top_builddir\src\qpidd_watchdog" # Test executables -$QPID_TEST_EXEC_DIR="$builddir" +$QPID_TEST_EXEC_DIR="$builddir\@CMAKE_BUILD_TYPE@" $RECEIVER_EXEC="$QPID_TEST_EXEC_DIR\receiver" $SENDER_EXEC="$QPID_TEST_EXEC_DIR\sender" # Path -$env:PATH="$top_builddir\src;$builddir;$srcdir;$PYTHON_COMMANDS;$QPID_TEST_EXEC_DIR;$env:PATH" +$env:PATH="$top_builddir\src\@CMAKE_BUILD_TYPE@;$builddir\@CMAKE_BUILD_TYPE@;$srcdir;$PYTHON_COMMANDS;$QPID_TEST_EXEC_DIR;@BOOST_LIBRARYDIR@;$env:PATH" # Modules $env:TEST_STORE_LIB="$testmoduledir\test_store.so" --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org