summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2013-11-07 15:32:06 +0000
committerAndrew Stitcher <astitcher@apache.org>2013-11-07 15:32:06 +0000
commit3ce9c41bf2d6e8c7547db1de68c007592d831f2b (patch)
treece504571e4d51e7cf10886a55a6818a930bfc6e5 /qpid/cpp/src
parent90d2ae88a9a79cf223cd5ca3b6fa9bb23c768794 (diff)
downloadqpid-python-3ce9c41bf2d6e8c7547db1de68c007592d831f2b.tar.gz
QPID-5308: Allow various bits of the test outputs to be XML
- This meshes nicely with the Jenkins CI system which can better display tests results generated in XML. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1539686 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/tests/CMakeLists.txt2
-rw-r--r--qpid/cpp/src/tests/legacystore/CMakeLists.txt6
-rwxr-xr-xqpid/cpp/src/tests/run_test63
3 files changed, 51 insertions, 20 deletions
diff --git a/qpid/cpp/src/tests/CMakeLists.txt b/qpid/cpp/src/tests/CMakeLists.txt
index c73d712e36..4a735c00f2 100644
--- a/qpid/cpp/src/tests/CMakeLists.txt
+++ b/qpid/cpp/src/tests/CMakeLists.txt
@@ -226,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} --boost-test -- ${unit_test_LOCATION})
endif (BUILD_TESTING_UNITTESTS)
diff --git a/qpid/cpp/src/tests/legacystore/CMakeLists.txt b/qpid/cpp/src/tests/legacystore/CMakeLists.txt
index 7df50d1398..3ad02ac548 100644
--- a/qpid/cpp/src/tests/legacystore/CMakeLists.txt
+++ b/qpid/cpp/src/tests/legacystore/CMakeLists.txt
@@ -52,7 +52,7 @@ target_link_libraries (legacystore_${theSourceFile}
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} --boost-test -- ${legacystore_${theSourceFile}_LOCATION})
ENDMACRO (define_legacystore_test)
define_legacystore_test (SimpleTest)
@@ -78,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} --boost-test -- ${${testname}_LOCATION})
unset (testname)
ENDMACRO (define_journal_test)
@@ -125,7 +125,7 @@ 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)
+add_test(journal_jtt_ut ${test_wrap} --boost-test --working-dir=${CMAKE_CURRENT_SOURCE_DIR}/jrnl/jtt -- ${CMAKE_CURRENT_BINARY_DIR}/jtt__ut)
endif (BUILD_TESTING_UNITTESTS)
diff --git a/qpid/cpp/src/tests/run_test b/qpid/cpp/src/tests/run_test
index 12458e343f..32dba4b031 100755
--- a/qpid/cpp/src/tests/run_test
+++ b/qpid/cpp/src/tests/run_test
@@ -33,15 +33,17 @@
working_dir='.'
-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
+OPTS=$(getopt -n "Qpid Test Wrapper" -o '' -l working-dir:,build-dir:,source-dir:,python,boost-test,xml,start-broker,broker-options: -- "$@") || exit 1
eval set -- $OPTS
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 ;;
+ --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 ;;
--) shift; break ;;
@@ -55,6 +57,10 @@ 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
+# Allow environment to dictate if we output xml test results
+if [ -n "$QPID_XML_TEST_OUTPUT" ] ; then
+ xml_output=yes
+fi
# Use VALGRIND_OPTS="--gen-suppressions=all" to generated suppressions
VALGRIND_OPTS="$VALGRIND_OPTS
@@ -66,11 +72,15 @@ VALGRIND_OPTS="$VALGRIND_OPTS
# 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"
+ qpidd_command="$QPIDD_EXEC --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)
+ if [ -n "$xml_output" ] ; then
+ QPID_PORT=$($VALGRIND $VALGRIND_OPTS --xml=yes --xml-file=$logfilebase-qpidd-vg.xml -- $qpidd_command)
+ else
+ QPID_PORT=$($VALGRIND $VALGRIND_OPTS --log-file=$logfilebase-qpidd.vglog -- $qpidd_command)
+ fi
else
- QPID_PORT=$($QPID_EXEC $qpidd_options)
+ QPID_PORT=$($qpidd_command)
fi
elif [ -r qpidd.port ]; then
QPID_PORT=$(cat qpidd.port)
@@ -82,8 +92,15 @@ export QPID_LOG_TO_FILE
# Export variables from makefile.
export srcdir
-VG_LOG="$logfilebase.vglog"
-rm -f $VG_LOG*
+if [ -n "$VALGRIND" ] ; then
+ if [ -n "$xml_output" ] ; then
+ valgrind_command="$VALGRIND $VALGRIND_OPTS --xml=yes --xml-file=$logfilebase-vg.xml --"
+ else
+ VG_LOG="$logfilebase.vglog"
+ rm -f $VG_LOG*
+ valgrind_command="$VALGRIND $VALGRIND_OPTS --log-file=$VG_LOG --"
+ fi
+fi
ERROR=0
if [ -n "$run_python" -a -n "$PYTHON" ] ; then
@@ -91,11 +108,26 @@ if [ -n "$run_python" -a -n "$PYTHON" ] ; then
elif [ ! -x $program ] ; then
echo "Cannot execute $program"
ERROR=1
-elif (file $program | grep -q ELF) && [ -n "$VALGRIND" ] ; then
- # This is a real executable, valgrind it.
+elif file $program | grep -q ELF; then
+ if [ -n "$boost_test" ] ; then
+ # Set boost unit test environment
+ if [ -n "$xml_output" ] ; then
+ export BOOST_TEST_SHOW_PROGRESS=no
+ export BOOST_TEST_OUTPUT_FORMAT=XML
+ export BOOST_TEST_LOG_LEVEL=test_suite
+ export BOOST_TEST_REPORT_LEVEL=no
+ (cd $working_dir; $valgrind_command $program "$@") > $logfilebase-unittest.xml || ERROR=1
+ else
+ (cd $working_dir; $valgrind_command $program "$@") || ERROR=1
+ fi
+ else
+ # This is a real executable, valgrind it if required
# Hide output unless there's an error.
- (cd $working_dir; $VALGRIND $VALGRIND_OPTS --log-file=$VG_LOG -- $program "$@" 2>&1) || ERROR=1
+ (cd $working_dir; $valgrind_command $program "$@" 2>&1) || ERROR=1
+ fi
+ if [ -n "$VG_LOG" ] ; then
vg_check $VG_LOG* || ERROR=1
+ fi
else
(cd $working_dir; $program "$@") || ERROR=1
fi
@@ -103,7 +135,7 @@ 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."
+ echo "WARNING: Suspicious log entries in $QPID_LOG_TO_FILE, above."
}
fi
@@ -116,9 +148,8 @@ if [ -n "$start_broker" ] ; then
}
# Check valgrind log.
- if test -n "$VALGRIND"; then
+ if [ -n "$VALGRIND" -a -z "$xml_output" ] ; then
vg_check $logfilebase-qpidd.vglog || ERROR=1
fi
fi
exit $ERROR
-