diff --git a/BUILD/compile-solaris-sparc-purify b/BUILD/compile-solaris-sparc-purify index c895d99c2cf..dd9ed2f7292 100755 --- a/BUILD/compile-solaris-sparc-purify +++ b/BUILD/compile-solaris-sparc-purify @@ -1,29 +1,110 @@ #! /bin/sh +mode="" +cxxfilt="" + +# For g++ 3.X, the PurifyPlus tools needs a program named "cxxfilt", +# "c++file" or similar. It is part of libtool. If not found, you can +# specify the path to it. + while test $# -gt 0 do case "$1" in - --debug) EXTRA_CONFIG_FLAGS=--with-debug; shift ;; + --debug) EXTRA_CONFIG_FLAGS=--with-debug ;; + --purify) mode=purify ;; + --purecov*) mode=purecov ;; + --quantify) mode=quantify ;; + --cxxfilt) shift ; cxxfilt=$1 ;; -h | --help ) - echo "Usage: $0 [-h|-n] [configure-options]" - echo " --debug Compile with DBUG enabled" + echo "Usage: $0 [ options ]" + echo "Where the 'options' are" + echo " --help | -h Display this help" + echo " --debug Compile with DBUG enabled" + echo " --purify Only prepare for Purify" + echo " --purecov Only prepare for PureCover" + echo " --quantify Only prepare for Quantify" + echo " --cxxfilt Path to cxxfilt/c++filt program" + echo " This program is needed for gcc 3.X" exit 0 ;; - *) echo "No such option '$1'" ; exit ;; + *) echo "No such option '$1'" ; exit 1 ;; esac + shift done gmake -k clean || true /bin/rm -f */.deps/*.P config.cache aclocal && autoheader && aclocal && automake && autoconf -# (cd bdb/dist && sh s_all) +(cd bdb/dist && sh s_all) (cd innobase && aclocal && autoheader && aclocal && automake && autoconf) -CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -DHAVE_purify -DEXTRA_DEBUG -O2" CXX=gcc CXXLD=g++ CXXFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -DHAVE_purify -DEXTRA_DEBUG -O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --without-berkeley-db --with-embedded-server --with-innodb $EXTRA_CONFIG_FLAGS +CFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -DHAVE_purify -DEXTRA_DEBUG -O2" CXX=gcc CXXLD=g++ CXXFLAGS="-g -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Woverloaded-virtual -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor -felide-constructors -fno-exceptions -fno-rtti -DHAVE_purify -DEXTRA_DEBUG -O2" ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-berkeley-db --with-embedded-server --with-innodb $EXTRA_CONFIG_FLAGS gmake -j 4 -cd sql ; mv mysqld mysqld-org ; -gmake CXXLD="purify -best-effort g++" mysqld ; mv mysqld mysqld-purify -gmake CXXLD="quantify -best-effort g++" mysqld ; mv mysqld mysqld-quantify -gmake CXXLD="purecov -best-effort g++" mysqld ; mv mysqld mysqld-purecov -mv mysqld-org mysqld +# ---------------------------------------------------------------------- + +#set -x + +purifying_binaries () +{ + while test $1 + do + dir=$1 + shift + target=$1 + shift + binary=$1 + shift + + opts="" + if [ -n "$cxxfilt" ] ; then + opts="$opts -demangle-program=$cxxfilt" + fi + opts="$opts -best-effort g++" + + back=`pwd` + cd $dir + + # Because of libtool magic, the target and binary + # created might not be the same. To trigger rebuild, + # we need to move them both. + + mv $binary $binary-old + if [ -f $target ] ; then + mv $target $target-old + fi + + if [ -n "$mode" -a $mode = purify ] ; then + gmake CXXLD="purify $opts" $target + mv $binary $binary-purify + fi + + if [ -n "$mode" -a $mode = quantify ] ; then + gmake CXXLD="quantify $opts" $target + mv $binary $binary-quantify + fi + + if [ -n "$mode" -a $mode = purecov ] ; then + gmake CXXLD="purecov $opts" $target + mv $binary $binary-purecov + fi + + mv $binary-old $binary + if [ -f $target-old ] ; then + mv $target-old $target + fi + + cd $back + done +} + + +purifying_binaries \ + sql mysqld mysqld \ + client mysqltest .libs/mysqltest \ + tests mysql_client_test mysql_client_test \ + libmysqld/examples mysqltest_embedded mysqltest_embedded \ + libmysqld/examples mysql_client_test_embedded mysql_client_test_embedded + +# ---------------------------------------------------------------------- + diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 24ea7a53046..5b925555095 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -227,6 +227,8 @@ EXTRA_MYSQLBINLOG_OPT="" USE_RUNNING_SERVER=0 USE_NDBCLUSTER="" USE_RUNNING_NDBCLUSTER="" +USE_PURIFY="" +PURIFY_LOGS="" DO_GCOV="" DO_GDB="" MANUAL_GDB="" @@ -246,7 +248,7 @@ MYSQL_TEST_SSL_OPTS="" USE_TIMER="" USE_EMBEDDED_SERVER="" RESULT_EXT="" -TEST_MODE="default" +TEST_MODE="" NDB_MGM_EXTRA_OPTS= NDB_MGMD_EXTRA_OPTS= @@ -254,8 +256,17 @@ NDBD_EXTRA_OPTS= while test $# -gt 0; do case "$1" in - --embedded-server) USE_EMBEDDED_SERVER=1 USE_MANAGER=0 NO_SLAVE=1 ; \ - USE_RUNNING_SERVER=0 RESULT_EXT=".es" TEST_MODE="embedded" ;; + --embedded-server) + USE_EMBEDDED_SERVER=1 + USE_MANAGER=0 NO_SLAVE=1 + USE_RUNNING_SERVER="" + RESULT_EXT=".es" + TEST_MODE="$TEST_MODE embedded" ;; + --purify) + USE_PURIFY=1 + USE_MANAGER=0 + USE_RUNNING_SERVER="" + TEST_MODE="$TEST_MODE purify" ;; --user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;; --force) FORCE=1 ;; --timer) USE_TIMER=1 ;; @@ -341,7 +352,7 @@ while test $# -gt 0; do SLEEP_TIME_AFTER_RESTART=`$ECHO "$1" | $SED -e "s;--sleep=;;"` ;; --ps-protocol) - TEST_MODE="ps-protocol" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; + TEST_MODE="$TEST_MODE ps-protocol" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;; --user-test=*) USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"` ;; @@ -454,6 +465,13 @@ while test $# -gt 0; do shift done +if [ -z "$TEST_MODE" ] ; then + TEST_MODE="default" +else + # Remove the leading space if any + TEST_MODE=`echo $TEST_MODE | sed 's/^ *//'` +fi + #++ # mysqld Environment Parameters #-- @@ -515,7 +533,10 @@ if [ x$SOURCE_DIST = x1 ] ; then fi MYSQL_CLIENT_TEST="$BASEDIR/libmysqld/examples/mysql_client_test_embedded" else - MYSQLD="$VALGRIND $BASEDIR/sql/mysqld" + MYSQLD="$BASEDIR/sql/mysqld" + if [ -n "$VALGRIND" ] ; then + MYSQLD="$VALGRIND $MYSQLD" + fi if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest" elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then @@ -552,6 +573,31 @@ if [ x$SOURCE_DIST = x1 ] ; then MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/scripts/mysql_fix_privilege_tables" NDB_TOOLS_DIR="$BASEDIR/ndb/tools" NDB_MGM="$BASEDIR/ndb/src/mgmclient/ndb_mgm" + + if [ -n "$USE_PURIFY" ] ; then + PSUP="$MYSQL_TEST_DIR/purify.suppress" + echo "suppress UMR rw_read_held; mi_open; ha_myisam::open64; handler::ha_open; openfrm" > $PSUP + echo "suppress UMR my_end; main" >> $PSUP + echo "suppress UMR _doprnt; fprintf; my_end; main" >> $PSUP + PURIFYOPTIONS="-windows=no -log-file=%v.purifylog -append-logfile -add-suppression-files=$PSUP" + if [ -f "${MYSQL_TEST}-purify" ] ; then + MYSQL_TEST="${MYSQL_TEST}-purify" + PLOG="$MYSQL_TEST.purifylog" + if [ -f $PLOG ]; then + mv $PLOG $PLOG.$$ + fi + PURIFY_LOGS="$PLOG" + fi + if [ -f "${MYSQLD}-purify" ] ; then + MYSQLD="${MYSQLD}-purify" + PLOG="$MYSQLD.purifylog" + if [ -f $PLOG ]; then + mv $PLOG $PLOG.$$ + fi + PURIFY_LOGS="$PURIFY_LOGS $PLOG" + fi + fi + else # We have a binary installation. Note that this can be both from @@ -654,6 +700,7 @@ export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR export NDB_TOOLS_DIR export NDB_MGM export NDB_BACKUP_DIR +export PURIFYOPTIONS MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \ --user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \ @@ -783,6 +830,19 @@ disable_test() { $ECHO "$RES$RES_SPACE [ disabled ] $2" } + +report_current_test () { + tname=$1 + echo "CURRENT_TEST: $tname" >> $MASTER_MYERR + if [ -n "$PURIFY_LOGS" ] ; then + for log in $PURIFY_LOGS + do + echo "CURRENT_TEST: $tname" >> $log + done + fi +} + + report_stats () { if [ $TOT_FAIL = 0 ]; then $ECHO "All $TOT_TEST tests were successful." @@ -1535,7 +1595,7 @@ run_testcase () esac stop_master stop_master 1 - echo "CURRENT_TEST: $tname" >> $MASTER_MYERR + report_current_test $tname start_master if [ -n "$USE_NDBCLUSTER" -a -z "$DO_BENCH" ] ; then start_master 1 @@ -1551,13 +1611,13 @@ run_testcase () EXTRA_MASTER_OPT="" stop_master stop_master 1 - echo "CURRENT_TEST: $tname" >> $MASTER_MYERR + report_current_test $tname start_master if [ -n "$USE_NDBCLUSTER" -a -z "$DO_BENCH" ] ; then start_master 1 fi else - echo "CURRENT_TEST: $tname" >> $MASTER_MYERR + report_current_test $tname fi fi