summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2013-10-28 12:39:56 +0000
committerAndrew Stitcher <astitcher@apache.org>2013-10-28 12:39:56 +0000
commit265821ba0b9ea2eb77ceb9158ceb83fffe12bc8f (patch)
tree24657249764e27d73ab4cad068dc7daee8820bfe /qpid/cpp/src/tests
parent45a6f4f415108dd26e00f8902db3f4d5d787b835 (diff)
downloadqpid-python-265821ba0b9ea2eb77ceb9158ceb83fffe12bc8f.tar.gz
QPID-5260: Significant tidy up of cmake build
* Move to cmake 2.6 as minimum required version (2.4 is extremely long in the tooth now) * Add control over building individual language bindings * Make settings you don't usually want to change advanced so they are hidden by default * Changed to a uniform naming scheme for options: ** Options controlling what to build are all BUILD_ ** Options controlling features of he build are ENABLE_ ** Options controlling internal aspects of the qpid runtime are QPID_ * Respect the BUILD_TESTING option so that we won't build the tests unless it is set (it is by default) * If we don't find the boost_unit_test_framework then don't fail, just don't build the unit tests (this is motivated by one of the Apache Jenkins ubuntu builders which has this set up) * Tidied up some of the detection of external dependencies to make it more idiomatic cmake (but there is more to do here) git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1536329 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests')
-rw-r--r--qpid/cpp/src/tests/CMakeLists.txt29
-rw-r--r--qpid/cpp/src/tests/legacystore/CMakeLists.txt47
-rwxr-xr-xqpid/cpp/src/tests/sasl_test_setup.sh2
-rw-r--r--qpid/cpp/src/tests/test_env.sh.in1
4 files changed, 43 insertions, 36 deletions
diff --git a/qpid/cpp/src/tests/CMakeLists.txt b/qpid/cpp/src/tests/CMakeLists.txt
index 72ab6ae0d6..c5ea0a89e5 100644
--- a/qpid/cpp/src/tests/CMakeLists.txt
+++ b/qpid/cpp/src/tests/CMakeLists.txt
@@ -131,9 +131,15 @@ endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
# Copy qpidd-p0 script to build directory so tests can find it.
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/qpidd-p0 ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
-# Like this to work with cmake 2.4 on Unix
-set (qpid_test_boost_libs
- ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY})
+if (CMAKE_SYSTEM_NAME STREQUAL Windows)
+ set (ENV{OUTDIR} ${EXECUTABLE_OUTPUT_PATH})
+ set (test_script_suffix ".ps1")
+ set (shell "powershell")
+endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
+
+set(test_wrap ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_test${test_script_suffix})
+
+if (BUILD_TESTING_UNITTESTS)
#
# Unit test program
@@ -142,6 +148,10 @@ set (qpid_test_boost_libs
# when running the tests. If you want to build a subset of the tests run
# ccmake and set unit_tests_to_build to the set you want to build.
+# Like this to work with cmake 2.4 on Unix
+set (qpid_test_boost_libs
+ ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY})
+
set(all_unit_tests
AccumulatedAckTest
Array
@@ -217,6 +227,10 @@ 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})
+
+endif (BUILD_TESTING_UNITTESTS)
+
add_library (shlibtest MODULE shlibtest.cpp)
if (BUILD_SASL)
@@ -296,15 +310,6 @@ if (PYTHON_EXECUTABLE)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/../python)
endif (PYTHON_EXECUTABLE)
-if (CMAKE_SYSTEM_NAME STREQUAL Windows)
- set (ENV{OUTDIR} ${EXECUTABLE_OUTPUT_PATH})
- set (test_script_suffix ".ps1")
- set (shell "powershell")
-endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
-
-set(test_wrap ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_test${test_script_suffix})
-
-add_test (unit_test ${test_wrap} ${unit_test_LOCATION})
if (BUILD_SASL)
add_test (sasl_fed ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed${test_script_suffix})
add_test (sasl_fed_ex_dynamic ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/sasl_fed_ex_dynamic${test_script_suffix})
diff --git a/qpid/cpp/src/tests/legacystore/CMakeLists.txt b/qpid/cpp/src/tests/legacystore/CMakeLists.txt
index ab0eb55922..3b4f50327d 100644
--- a/qpid/cpp/src/tests/legacystore/CMakeLists.txt
+++ b/qpid/cpp/src/tests/legacystore/CMakeLists.txt
@@ -21,16 +21,15 @@ if(BUILD_LEGACYSTORE AND BUILD_TESTING)
message(STATUS "Building legacystore tests")
-# Make sure that everything get built before the tests
-# Need to create a var with all the necessary top level targets
-
-# If we're linking Boost for DLLs, turn that on for the unit test too.
+# If we're linking Boost for DLLs, turn that on for the tests too.
if (QPID_LINK_BOOST_DYNAMIC)
add_definitions(-DBOOST_TEST_DYN_LINK)
endif (QPID_LINK_BOOST_DYNAMIC)
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
+if (BUILD_TESTING_UNITTESTS)
+
# Like this to work with cmake 2.4 on Unix
set (qpid_test_boost_libs
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY})
@@ -99,25 +98,6 @@ define_journal_test (_ut_lpmgr LONG)
define_journal_test (_st_basic LONG)
define_journal_test (_st_read LONG)
-add_executable(jtt
- jrnl/jtt/args.cpp
- jrnl/jtt/data_src.cpp
- jrnl/jtt/jrnl_init_params.cpp
- jrnl/jtt/jrnl_instance.cpp
- jrnl/jtt/main.cpp
- jrnl/jtt/read_arg.cpp
- jrnl/jtt/test_case.cpp
- jrnl/jtt/test_case_result.cpp
- jrnl/jtt/test_case_result_agregation.cpp
- jrnl/jtt/test_case_set.cpp
- jrnl/jtt/test_mgr.cpp)
-
-target_link_libraries (jtt
- ${Boost_PROGRAM_OPTIONS_LIBRARY}
- ${clock_gettime_LIB} legacystore_shared)
-
-add_test(journal_jtt ${CMAKE_CURRENT_BINARY_DIR}/jtt -c ${CMAKE_CURRENT_SOURCE_DIR}/jrnl/jtt/jtt.csv)
-
add_executable (jtt__ut
jrnl/jtt/_ut_data_src.cpp
jrnl/jtt/_ut_jrnl_init_params.cpp
@@ -145,10 +125,31 @@ target_link_libraries (jtt__ut
add_test(NAME journal_jtt_ut WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/jrnl/jtt COMMAND ${CMAKE_CURRENT_BINARY_DIR}/jtt__ut)
+endif (BUILD_TESTING_UNITTESTS)
+
#
# Other test programs
#
+add_executable(jtt
+ jrnl/jtt/args.cpp
+ jrnl/jtt/data_src.cpp
+ jrnl/jtt/jrnl_init_params.cpp
+ jrnl/jtt/jrnl_instance.cpp
+ jrnl/jtt/main.cpp
+ jrnl/jtt/read_arg.cpp
+ jrnl/jtt/test_case.cpp
+ jrnl/jtt/test_case_result.cpp
+ jrnl/jtt/test_case_result_agregation.cpp
+ jrnl/jtt/test_case_set.cpp
+ jrnl/jtt/test_mgr.cpp)
+
+target_link_libraries (jtt
+ ${Boost_PROGRAM_OPTIONS_LIBRARY}
+ ${clock_gettime_LIB} legacystore_shared)
+
+add_test(journal_jtt ${CMAKE_CURRENT_BINARY_DIR}/jtt -c ${CMAKE_CURRENT_SOURCE_DIR}/jrnl/jtt/jtt.csv)
+
add_test (legacystore_python_tests ${shell} ${CMAKE_CURRENT_SOURCE_DIR}/run_python_tests${test_script_suffix})
endif (BUILD_LEGACYSTORE AND BUILD_TESTING)
diff --git a/qpid/cpp/src/tests/sasl_test_setup.sh b/qpid/cpp/src/tests/sasl_test_setup.sh
index 3947986517..28ea97e117 100755
--- a/qpid/cpp/src/tests/sasl_test_setup.sh
+++ b/qpid/cpp/src/tests/sasl_test_setup.sh
@@ -18,8 +18,8 @@
# specific language governing permissions and limitations
# under the License.
#
+source ./test_env.sh
-SASL_PW=/usr/sbin/saslpasswd2
test -x $SASL_PW || { echo Skipping SASL test, saslpasswd2 not found; exit 0; }
mkdir -p sasl_config
diff --git a/qpid/cpp/src/tests/test_env.sh.in b/qpid/cpp/src/tests/test_env.sh.in
index c85e1d651a..2247469cc3 100644
--- a/qpid/cpp/src/tests/test_env.sh.in
+++ b/qpid/cpp/src/tests/test_env.sh.in
@@ -35,6 +35,7 @@ enable_valgrind=${enable_valgrind-@ENABLE_VALGRIND@}
if [ "$enable_valgrind" = "ON" ] ; then
export VALGRIND=@VALGRIND_EXECUTABLE@
fi
+export SASL_PW=@SASLPASSWD2_EXECUTABLE@
# Python paths and directories
export PYTHON_DIR=$builddir/python