From: <svn...@op...> - 2010-01-25 20:01:21
|
Author: scriptor Date: Mon Jan 25 21:01:11 2010 New Revision: 6026 URL: http://www.opensync.org/changeset/6026 Log: I have cleaned up my test suite. Regular runs and runs under valgrind are now more strictly separated. All tests that have anything to do with libopensync - be it via osynplugin, osynctool, check_detector1 or check_do_convert_from_to - can now be run under valgrind. For runs under valgrind no separate check-scripts are necessary any more. Modified: plugins/ldap-sync/CMakeLists.txt plugins/ldap-sync/tests/check_fastsync plugins/ldap-sync/tests/check_init Modified: plugins/ldap-sync/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/CMakeLists.txt Mon Jan 25 20:59:09 2010 (r6025) +++ plugins/ldap-sync/CMakeLists.txt Mon Jan 25 21:01:11 2010 (r6026) @@ -322,6 +322,21 @@ ENDIF ( CHECK_FOUND ) +# Setting a custom timeout for ctest is a hassle. +# The only variable that seems to be considered by cmake/ctest is +# DART_TESTING_TIMEOUT. And this works ONLY, if one adds "FORCE". +# +# DART_TESTING_TIMEOUT must be set in CTestConfig.cmake rather than here. +# At least, it seems so... +OPTION ( RUN_LONG_TESTS "Should the tests be run under valgrind?" OFF ) +OPTION ( WITH_VALGRIND "Should the tests be run under valgrind? " OFF ) + +IF (RUN_LONG_TESTS OR WITH_VALGRIND) + SET ( ENV{WITH_VALGRIND} ON ) + SET ( ENV{WITH_VALGRIND} ON PARENT_SCOPE ) +ENDIF(RUN_LONG_TESTS OR WITH_VALGRIND) + + # Workaround for wrong setting of CMAKE_BUILD_TYPE: First of two steps: IF (CMAKE_BUILD_TYPE) SET(CORRECT_CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "The CMAKE_BUILD_TYPE definition in /usr/local/share/libopensync1/cmake/modules/OpenSyncInternal.cmake overrides even the command line settings here. This variable aims to fix this." FORCE ) @@ -426,7 +441,6 @@ IF (SHOWSTATUS_MODULE) SHOW_STATUS( ENABLE_UNITTESTS "Build the test suite:\t\t" ) - SHOW_STATUS( RUN_LONG_TESTS "Run rather time consuming tests, as well:" ) SHOW_STATUS( RUN_AUTH_TESTS "Run the authentication specific tests, too:" ) ENDIF (SHOWSTATUS_MODULE) Modified: plugins/ldap-sync/tests/check_fastsync ============================================================================== --- plugins/ldap-sync/tests/check_fastsync Mon Jan 25 20:59:09 2010 (r6025) +++ plugins/ldap-sync/tests/check_fastsync Mon Jan 25 21:01:11 2010 (r6026) @@ -1,11 +1,13 @@ #!/bin/bash -# Call as check_fastsync /path/to/ldap-sync/build/dir /path/to/ldap-sync/src/dir +# Usage: ./check_fastsync /path/to/ldap-sync/build/dir /path/to/ldap-sync/src/dir # # E.g.: +# # ./check_fastsync testname /home/user1/dev/plugins/ldap-sync/build_debug /home/user1/dev/plugins/ldap-sync +# -set -x +# set -x FILE=$0 test_name="$1" @@ -15,19 +17,6 @@ rv=0 -OSYNCPLUGIN=$(which osyncplugin 2>/dev/null) -if test ! -f "$OSYNCPLUGIN"; then - echo "$FILE:$LINENO: ERROR: osyncplugin could not be found. Exiting." - exit 1 -fi - -if test ! -x "$OSYNCPLUGIN"; then - echo "$FILE:$LINENO: ERROR: osyncplugin could be found, but it is not executable. Exiting." - exit 1 -fi - - - SOURCE_DIR=`dirname $FILE` if test ! -d "$SOURCE_DIR"; then echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR\" is not a directory. Exiting." @@ -39,9 +28,18 @@ exit 1 fi +if test ! -r "$SOURCE_DIR/check_common.inc"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/check_common.inc\" could not be read. Exiting." + exit 1 +fi + + source "$SOURCE_DIR/test.conf" source "$SOURCE_DIR/check_common.inc" +setup_osyncplugin +setup_valgrind + enable_tracing "$test_name" eval generate_conf $SOURCE_DIR $BUILD_DIR $PLUGINNAME @@ -59,15 +57,15 @@ exit 1 fi - - - - -echo "${PLUGINPATH} ${CFG}" - TMPDIR=`mktemp -d /tmp/ldap_sync_test.XXXXXX` || exit 1 -$OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --connect --fastsync --syncdone --disconnect --finalize +if test "$WITH_VALGRIND" = "yes" -o "$WITH_VALGRIND" = "YES" -o "$WITH_VALGRIND" = "on" -o "$WITH_VALGRIND" = "ON"; then + cmd="$VALGRIND $OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --connect --fastsync --syncdone --disconnect --finalize" +else + cmd="$OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --connect --fastsync --syncdone --disconnect --finalize" +fi + +eval $cmd rv=$? if test -d "$TMPDIR"; then @@ -76,6 +74,7 @@ if test $rv -ne 0; then echo "$FILE:$LINENO: ERROR: osyncplugin has failed. Exiting." + echo -e "Command was:\n$cmd\n" exit 1 fi Modified: plugins/ldap-sync/tests/check_init ============================================================================== --- plugins/ldap-sync/tests/check_init Mon Jan 25 20:59:09 2010 (r6025) +++ plugins/ldap-sync/tests/check_init Mon Jan 25 21:01:11 2010 (r6026) @@ -1,11 +1,13 @@ #!/bin/bash -# Call as check_init /path/to/ldap-sync/build/dir /path/to/ldap-sync/src/dir +# Usage: ./check_init /path/to/ldap-sync/build/dir /path/to/ldap-sync/src/dir # # E.g.: +# # ./check_init testname /home/user1/dev/plugins/ldap-sync/build_debug /home/user1/dev/plugins/ldap-sync +# -set -x +# set -x FILE=$0 test_name="$1" @@ -15,18 +17,6 @@ rv=0 -OSYNCPLUGIN=$(which osyncplugin 2>/dev/null) -if test ! -f "$OSYNCPLUGIN"; then - echo "$FILE:$LINENO: ERROR: osyncplugin could not be found. Exiting." - exit 1 -fi - -if test ! -x "$OSYNCPLUGIN"; then - echo "$FILE:$LINENO: ERROR: osyncplugin could be found, but it is not executable. Exiting." - exit 1 -fi - - SOURCE_DIR=`dirname $FILE` if test ! -d "$SOURCE_DIR"; then echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR\" is not a directory. Exiting." @@ -38,17 +28,24 @@ exit 1 fi +if test ! -r "$SOURCE_DIR/check_common.inc"; then + echo "$FILE:$LINENO: ERROR: \"$SOURCE_DIR/check_common.inc\" could not be read. Exiting." + exit 1 +fi + + source "$SOURCE_DIR/test.conf" source "$SOURCE_DIR/check_common.inc" -eval generate_conf $SOURCE_DIR $BUILD_DIR $PLUGINNAME - +setup_osyncplugin +setup_valgrind -enable_tracing "$test_name" +eval generate_conf $SOURCE_DIR $BUILD_DIR $PLUGINNAME +enable_tracing "$test_name" echo "PLUGINPATH = \"$PLUGINPATH\"" @@ -66,11 +63,16 @@ fi -echo "${PLUGINPATH} ${CFG}" - TMPDIR=`mktemp -d /tmp/ldap_sync_test.XXXXXX` || exit 1 -$OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --finalize + +if test "$WITH_VALGRIND" = "yes" -o "$WITH_VALGRIND" = "YES" -o "$WITH_VALGRIND" = "on" -o "$WITH_VALGRIND" = "ON"; then + cmd="$VALGRIND $OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --finalize" +else + cmd="$OSYNCPLUGIN --plugin $PLUGINNAME --pluginpath $PLUGINPATH --config $CFG --configdir $TMPDIR --initialize --finalize" +fi + +eval $cmd rv=$? @@ -81,6 +83,7 @@ if test $rv -ne 0; then echo "$FILE:$LINENO: ERROR: osyncplugin has failed. Exiting." + echo -e "Command was:\n${cmd}\n" exit 1 fi |