qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r1539510 - in /qpid/trunk/qpid/cpp/src/tests: ./ legacystore/
Date Thu, 07 Nov 2013 00:42:43 GMT
Author: astitcher
Date: Thu Nov  7 00:42:42 2013
New Revision: 1539510

URL: http://svn.apache.org/r1539510
Log:
QPID-5306: Improve c++ tests some more:
Add options to run_test script:
 --working-dir  - run the test in this directory
 --build-dir    - set the top of the build tree
 --source-dir   - set the top of the source tree
 --python       - run a python test
 --start-broker - start/stop broker before and after test
 --broker-options - allow non default broker options

Remove a bunch of now obsolete testing related scripts

Removed:
    qpid/trunk/qpid/cpp/src/tests/legacystore/tests_env.sh
    qpid/trunk/qpid/cpp/src/tests/start_broker
    qpid/trunk/qpid/cpp/src/tests/start_broker.ps1
    qpid/trunk/qpid/cpp/src/tests/stop_broker
    qpid/trunk/qpid/cpp/src/tests/stop_broker.ps1
    qpid/trunk/qpid/cpp/src/tests/test_wrap
Modified:
    qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt
    qpid/trunk/qpid/cpp/src/tests/legacystore/CMakeLists.txt
    qpid/trunk/qpid/cpp/src/tests/run_header_test
    qpid/trunk/qpid/cpp/src/tests/run_msg_group_tests
    qpid/trunk/qpid/cpp/src/tests/run_queue_flow_limit_tests
    qpid/trunk/qpid/cpp/src/tests/run_test
    qpid/trunk/qpid/cpp/src/tests/test_env.sh.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=1539510&r1=1539509&r2=1539510&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt (original)
+++ qpid/trunk/qpid/cpp/src/tests/CMakeLists.txt Thu Nov  7 00:42:42 2013
@@ -135,7 +135,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})
+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)
 
 if (BUILD_TESTING_UNITTESTS)
 
@@ -225,7 +226,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} ${unit_test_LOCATION})
+add_test (unit_test ${test_wrap} -- ${unit_test_LOCATION})
 
 endif (BUILD_TESTING_UNITTESTS)
 
@@ -319,33 +320,34 @@ if (BUILD_SASL)
         add_test(ssl_test ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/ssl_test${test_script_suffix})
     endif (BUILD_SSL)
 endif (BUILD_SASL)
-add_test (start_broker ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/start_broker${test_script_suffix})
-add_test (qpid-client-test ${test_wrap} ${qpid-client-test_LOCATION})
-add_test (quick_perftest ${test_wrap} ${qpid-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} ${qpid-txtest_LOCATION} --queues 4 --tx-count 10 --quiet)
-add_test (msg_group_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_msg_group_tests${test_script_suffix})
+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 (msg_group_tests ${test_wrap} --start-broker -- ${CMAKE_CURRENT_SOURCE_DIR}/run_msg_group_tests${test_script_suffix})
 if (PYTHON_EXECUTABLE)
-  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})
+  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})
 endif (PYTHON_EXECUTABLE)
-add_test (stop_broker ${test_wrap} ${CMAKE_CURRENT_SOURCE_DIR}/stop_broker${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})
 endif (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
 if (PYTHON_EXECUTABLE)
-  add_test (ha_tests ${test_wrap} ${CMAKE_CURRENT_SOURCE_DIR}/ha_tests.py)
-  add_test (qpidd_qmfv2_tests ${test_wrap} ${CMAKE_CURRENT_SOURCE_DIR}/qpidd_qmfv2_tests.py)
+  add_test (ha_tests ${python_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/ha_tests.py)
+  add_test (qpidd_qmfv2_tests ${python_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/qpidd_qmfv2_tests.py)
   if (BUILD_AMQP)
-    add_test (interlink_tests ${test_wrap} ${CMAKE_CURRENT_SOURCE_DIR}/interlink_tests.py)
+    add_test (interlink_tests ${python_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/interlink_tests.py)
   endif (BUILD_AMQP)
-  add_test (swig_python_tests ${test_wrap} ${CMAKE_CURRENT_SOURCE_DIR}/swig_python_tests${test_script_suffix})
+  add_test (swig_python_tests ${test_wrap} -- ${CMAKE_CURRENT_SOURCE_DIR}/swig_python_tests${test_script_suffix})
 endif (PYTHON_EXECUTABLE)
 add_test (ipv6_test ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/ipv6_test${test_script_suffix})
 add_test (federation_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_federation_tests${test_script_suffix})
 add_test (federation_sys_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_federation_sys_tests${test_script_suffix})
-add_test (queue_flow_limit_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_queue_flow_limit_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
-t --log-to-stderr=no --log-to-stdout=no"
+          ${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})
 endif (BUILD_ACL)

Modified: qpid/trunk/qpid/cpp/src/tests/legacystore/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/legacystore/CMakeLists.txt?rev=1539510&r1=1539509&r2=1539510&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/legacystore/CMakeLists.txt (original)
+++ qpid/trunk/qpid/cpp/src/tests/legacystore/CMakeLists.txt Thu Nov  7 00:42:42 2013
@@ -28,6 +28,8 @@ endif (QPID_LINK_BOOST_DYNAMIC)
 
 include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
 
+set(test_wrap ${shell} ${CMAKE_SOURCE_DIR}/src/tests/run_test${test_script_suffix} --build-dir=${CMAKE_BINARY_DIR})
+
 if (BUILD_TESTING_UNITTESTS)
 
 # Like this to work with cmake 2.4 on Unix
@@ -50,7 +52,7 @@ target_link_libraries (legacystore_${the
 set_target_properties (legacystore_${theSourceFile} PROPERTIES COMPILE_DEFINITIONS _IN_QPID_BROKER)
 remember_location(legacystore_${theSourceFile})
 
-add_test (legacystore_${theSourceFile} ${test_wrap} ${legacystore_${theSourceFile}_LOCATION})
+add_test (legacystore_${theSourceFile} ${test_wrap} -- ${legacystore_${theSourceFile}_LOCATION})
 ENDMACRO (define_legacystore_test)
 
 define_legacystore_test (SimpleTest)
@@ -76,7 +78,7 @@ if ("${ARGV1}" STREQUAL "LONG")
   set_target_properties(${testname} PROPERTIES COMPILE_DEFINITIONS LONG_TEST)
 endif ()
 remember_location(${testname})
-add_test (${testname} ${test_wrap} ${${testname}_LOCATION})
+add_test (${testname} ${test_wrap} -- ${${testname}_LOCATION})
 unset (testname)
 ENDMACRO (define_journal_test)
 
@@ -123,6 +125,8 @@ target_link_libraries (jtt__ut
                        ${Boost_PROGRAM_OPTIONS_LIBRARY}
                        ${clock_gettime_LIB} legacystore_shared)
 
+add_test(journal_jtt_ut ${test_wrap} --working-dir=${CMAKE_CURRENT_SOURCE_DIR}/jrnl/jtt --
${CMAKE_CURRENT_BINARY_DIR}/jtt__ut)
+
 endif (BUILD_TESTING_UNITTESTS)
 
 #

Modified: qpid/trunk/qpid/cpp/src/tests/run_header_test
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/run_header_test?rev=1539510&r1=1539509&r2=1539510&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/run_header_test (original)
+++ qpid/trunk/qpid/cpp/src/tests/run_header_test Thu Nov  7 00:42:42 2013
@@ -23,15 +23,9 @@
 # TODO: this should be expanded to cover a wider set of types and go
 # in both directions
 
-srcdir=`dirname $0`
-source ./test_env.sh
-
-test -f qpidd.port && QPID_PORT=`cat qpidd.port`
-
 if test -d ${PYTHON_DIR} ;  then
     ./header_test -p $QPID_PORT
     $srcdir/header_test.py "localhost" $QPID_PORT
 else 
     echo "Skipping header test as python libs not found"
 fi
-

Modified: qpid/trunk/qpid/cpp/src/tests/run_msg_group_tests
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/run_msg_group_tests?rev=1539510&r1=1539509&r2=1539510&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/run_msg_group_tests (original)
+++ qpid/trunk/qpid/cpp/src/tests/run_msg_group_tests Thu Nov  7 00:42:42 2013
@@ -20,17 +20,8 @@
 #
 #script to run a sequence of message group queue tests via make
 
-#setup path to find qpid-config and msg_group_test progs
-source ./test_env.sh
 test -d $PYTHON_DIR || { echo "Skipping message group tests, no python dir."; exit 0; }
 
-export PATH=$PWD:$srcdir:$PYTHON_COMMANDS:$PATH
-
-#set port to connect to via env var
-test -s qpidd.port && QPID_PORT=`cat qpidd.port`
-
-#trap cleanup INT TERM QUIT
-
 QUEUE_NAME="group-queue"
 GROUP_KEY="My-Group-Id"
 

Modified: qpid/trunk/qpid/cpp/src/tests/run_queue_flow_limit_tests
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/run_queue_flow_limit_tests?rev=1539510&r1=1539509&r2=1539510&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/run_queue_flow_limit_tests (original)
+++ qpid/trunk/qpid/cpp/src/tests/run_queue_flow_limit_tests Thu Nov  7 00:42:42 2013
@@ -21,31 +21,4 @@
 
 # Run tests against Queue producer flow control.
 
-source ./test_env.sh
-test -d $PYTHON_DIR || { echo "Skipping queue flow control tests, no python dir."; exit 0;
}
-
-LOG_FILE=qpidd.log
-
-trap stop_broker INT TERM QUIT
-
-error() {
-    echo $*
-    exit 1;
-}
-
-#set -x
-
-rm -rf $LOG_FILE
-# Note: if you change the DEFAULT_THRESHOLDS, you will need to update queue_flow_limit_tests.py
-DEFAULT_THRESHOLDS="--default-flow-stop-threshold=80 --default-flow-resume-threshold=70"
-start_broker $DEFAULT_THRESHOLDS -t --log-to-stderr=no --log-to-stdout=no || error "Could
not start broker"
-QPID_PORT=`cat qpidd.port`
-echo "Running Queue flow limit tests using broker on port $QPID_PORT"
-$QPID_PYTHON_TEST -m queue_flow_limit_tests $SKIPTESTS -b localhost:$QPID_PORT $@
-RETCODE=$?
-stop_broker || error "Could not stop broker"
-if test x$RETCODE != x0; then
-    echo "FAIL queue flow limit tests"; exit 1;
-fi
-rm -rf $LOG_FILE
-
+$QPID_PYTHON_TEST -m queue_flow_limit_tests $SKIPTESTS -b localhost:$QPID_PORT

Modified: qpid/trunk/qpid/cpp/src/tests/run_test
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/run_test?rev=1539510&r1=1539509&r2=1539510&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/run_test (original)
+++ qpid/trunk/qpid/cpp/src/tests/run_test Thu Nov  7 00:42:42 2013
@@ -31,19 +31,30 @@
 # examination.
 #
 
-srcdir=`dirname $0`
-source ./test_env.sh
-source $srcdir/vg_check
+working_dir='.'
 
-# Export variables from makefile.
-export srcdir
+OPTS=$(getopt -n "Qpid Test Wrapper" -o d:b:s:p -l working-dir:,build-dir:,source-dir:,python,start-broker,broker-options:
-- "$@") || exit 1
+eval set -- $OPTS
 
-# Set QPID_PORT if qpidd.port exists.
-test -s qpidd.port && QPID_PORT=`cat qpidd.port`
-export QPID_PORT
+while true; do
+case "$1" in
+    -d|--working-dir) working_dir=$2;    shift 2      ;;
+    -b|--build-dir)   build_dir=$2;      shift 2      ;;
+    -s|--source-dir)  source_dir=$2;     shift 2      ;;
+    -p|--python)      run_python=yes;    shift        ;;
+    --start-broker)   start_broker=yes;  shift        ;;
+    --broker-options) qpidd_extra_options=$2; shift 2 ;;
+    --)                                  shift; break ;;
+esac
+done
+
+program=$1
+shift
+
+logfilebase=$(pwd -P)/$(basename $program)
+source $build_dir/src/tests/test_env.sh || (echo "Error: Couldn't read test_env.sh (build
settings)" ; exit 1)
+source $srcdir/vg_check
 
-VG_LOG="`basename $1`.vglog"
-rm -f $VG_LOG*
 
 # Use VALGRIND_OPTS="--gen-suppressions=all" to generated suppressions
 VALGRIND_OPTS="$VALGRIND_OPTS
@@ -51,23 +62,63 @@ VALGRIND_OPTS="$VALGRIND_OPTS
 --demangle=yes
 --suppressions=$srcdir/.valgrind.supp
 --num-callers=25
---log-file=$VG_LOG --
 "
+
+# Set up environment for running a Qpid test
+if [ -n "$start_broker" ] ; then
+  qpidd_options="--auth=no --no-module-dir --daemon --port=0 --interface 127.0.0.1 --log-to-file
$logfilebase-qpidd.log $qpidd_extra_options"
+  if [ -n "$VALGRIND" ] ; then
+    QPID_PORT=$($VALGRIND $VALGRIND_OPTS --log-file=$logfilebase-qpidd.vglog -- $QPIDD_EXEC
$qpidd_options)
+  else
+    QPID_PORT=$($QPID_EXEC $qpidd_options)
+  fi
+elif [ -r qpidd.port ]; then
+  QPID_PORT=$(cat qpidd.port)
+fi
+export QPID_PORT
+QPID_LOG_TO_FILE="$logfilebase.log"
+export QPID_LOG_TO_FILE
+
+# Export variables from makefile.
+export srcdir
+
+VG_LOG="$logfilebase.vglog"
+rm -f $VG_LOG*
+
 ERROR=0
-if [ ! -x $1 ] ; then
-    echo "Cannot execute $1"
+if [ -n "$run_python" -a -n "$PYTHON" ] ; then
+    (cd $working_dir; $PYTHON $program "$@") || ERROR=1
+elif [ ! -x $program ] ; then
+    echo "Cannot execute $program"
     ERROR=1
-elif file $1 | grep -q text; then
-    # This is a shell script, just execute it.
-    exec "$@"
-elif [ -n "$VALGRIND" ] ; then
+elif (file $program | grep -q ELF) && [ -n "$VALGRIND" ] ; then
     # This is a real executable, valgrind it.
     # Hide output unless there's an error.
-    $VALGRIND $VALGRIND_OPTS "$@" 2>&1 || ERROR=1
+    (cd $working_dir; $VALGRIND $VALGRIND_OPTS --log-file=$VG_LOG -- $program "$@" 2>&1)
|| ERROR=1
     vg_check $VG_LOG* || ERROR=1
 else
-    "$@" 2>&1 || ERROR=1
+    (cd $working_dir; $program "$@") || ERROR=1
+fi
+
+# Check log
+if [ -r $QPID_LOG_TO_FILE ]; then
+egrep 'warning\|error\|critical' $QPID_LOG_TO_FILE && {
+    echo "WARNING: Suspicious broker log entries in $QPID_LOG_TO_FILE, above."
+}
 fi
 
+if [ -n "$start_broker" ] ; then
+  $QPIDD_EXEC --no-module-dir --quit || ERROR=1
+
+  # Check qpidd.log.
+  egrep 'warning\|error\|critical' $logfilebase-qpidd.log && {
+    echo "WARNING: Suspicious broker log entries in qpidd.log, above."
+  }
+
+  # Check valgrind log.
+  if test -n "$VALGRIND"; then
+    vg_check $logfilebase-qpidd.vglog || ERROR=1
+  fi
+fi
 exit $ERROR
 

Modified: qpid/trunk/qpid/cpp/src/tests/test_env.sh.in
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/test_env.sh.in?rev=1539510&r1=1539509&r2=1539510&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/test_env.sh.in (original)
+++ qpid/trunk/qpid/cpp/src/tests/test_env.sh.in Thu Nov  7 00:42:42 2013
@@ -36,6 +36,7 @@ if [ "$enable_valgrind" = "ON" ] ; then
     export VALGRIND=@VALGRIND_EXECUTABLE@
 fi
 export SASL_PW=@SASLPASSWD2_EXECUTABLE@
+export PYTHON=@PYTHON_EXECUTABLE@
 
 # Python paths and directories
 export PYTHON_DIR=$builddir/python



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message