diff --git a/Makefile.am b/Makefile.am index 4f742e4208..8cd934258f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,85 +1,86 @@ # # Pacemaker code # # Copyright (C) 2004 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # EXTRA_DIST = autogen.sh ConfigureMe README.in libltdl.tar m4/gnulib-cache.m4 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure DRF/config-h.in \ DRF/stamp-h.in libtool.m4 ltdl.m4 libltdl.tar CORE = $(LIBLTDL_DIR) replace include lib mcp pengine cib crmd fencing lrmd tools xml SUBDIRS = $(CORE) cts extra doc doc_DATA = AUTHORS COPYING COPYING.LIB noinst_PROGRAMS = scratch AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 testdir = $(datadir)/$(PACKAGE)/tests/ test_SCRIPTS = coverage.sh BasicSanity.sh +test_DATA = valgrind-pcmk.suppressions # Scratch file for ad-hoc testing scratch_SOURCES = scratch.c scratch_LDADD = $(top_builddir)/lib/common/libcrmcommon.la core: @echo "Building only core components: $(CORE)" list='$(CORE)'; for subdir in $$list; do echo "Building $$subdir"; make -C $$subdir all || exit 1; done core-install: @echo "Installing only core components: $(CORE)" list='$(CORE)'; for subdir in $$list; do echo "Installing $$subdir"; make -C $$subdir install || exit 1; done core-clean: @echo "Cleaning only core components: $(CORE)" list='$(CORE)'; for subdir in $$list; do echo "Cleaning $$subdir"; make -C $$subdir clean || exit 1; done install-exec-local: $(INSTALL) -d $(DESTDIR)/$(LCRSODIR) $(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_CONFIG_DIR) $(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_STATE_DIR) $(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_BLACKBOX_DIR) -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_CONFIG_DIR) -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_STATE_DIR) -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_BLACKBOX_DIR) if BUILD_CS_PLUGIN rm -f $(DESTDIR)$(LCRSODIR)/pacemaker.lcrso $(DESTDIR)$(LCRSODIR)/service_crm.so cp $(DESTDIR)$(libdir)/service_crm.so $(DESTDIR)$(LCRSODIR)/pacemaker.lcrso endif if BUILD_HEARTBEAT_SUPPORT $(INSTALL) -d $(DESTDIR)/$(HB_DAEMON_DIR) ln -sf $(CRM_DAEMON_DIR)/attrd $(DESTDIR)$(HB_DAEMON_DIR)/ ln -sf $(CRM_DAEMON_DIR)/cib $(DESTDIR)$(HB_DAEMON_DIR)/ ln -sf $(CRM_DAEMON_DIR)/crmd $(DESTDIR)$(HB_DAEMON_DIR)/ ln -sf $(CRM_DAEMON_DIR)/pengine $(DESTDIR)$(HB_DAEMON_DIR)/ ln -sf $(CRM_DAEMON_DIR)/stonithd $(DESTDIR)$(HB_DAEMON_DIR)/ endif # Use chown because the user/group may not exist clean-generic: rm -f $(TARFILE) *.tar.bz2 *.sed dist-clean-local: rm -f autoconf automake autoheader maintainer-clean-local: rm -f libltdl.tar .PHONY: rpm pkg handy handy-copy diff --git a/pengine/Makefile.am b/pengine/Makefile.am index 30ff509642..c612f2a781 100644 --- a/pengine/Makefile.am +++ b/pengine/Makefile.am @@ -1,84 +1,84 @@ # # Copyright (C) 2004 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MAINTAINERCLEANFILES = Makefile.in INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir) -I$(top_srcdir) \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl halibdir = $(CRM_DAEMON_DIR) PE_TESTS = $(wildcard test10/*.scores) testdir = $(datadir)/$(PACKAGE)/tests/pengine test_SCRIPTS = regression.sh -test_DATA = regression.core.sh ptest.supp +test_DATA = regression.core.sh test10dir = $(datadir)/$(PACKAGE)/tests/pengine/test10 test10_DATA = $(PE_TESTS) $(PE_TESTS:%.scores=%.xml) $(PE_TESTS:%.scores=%.exp) $(PE_TESTS:%.scores=%.dot) $(PE_TESTS:%.scores=%.summary) $(wildcard test10/*.stderr) COMMONLIBS = \ $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/pengine/libpe_status.la \ - libpengine.la $(CURSESLIBS) $(CLUSTERLIBS) + libpengine.la $(CURSESLIBS) $(CLUSTERLIBS) ## libraries lib_LTLIBRARIES = libpengine.la ## binary progs halib_PROGRAMS = pengine man7_MANS = if BUILD_XML_HELP man7_MANS += pengine.7 pengine.xml: pengine $(top_builddir)/pengine/$< metadata | $(XSLTPROC) --nonet --novalid --stringparam man.name $< $(top_srcdir)/xml/ocf-meta2man.xsl - > $(top_builddir)/pengine/$@ pengine.7: pengine.xml $(XSLTPROC) $(MANPAGE_XSLT) $(top_builddir)/pengine/$< endif ## SOURCES noinst_HEADERS = allocate.h utils.h pengine.h #utils.h pengine.h libpengine_la_LDFLAGS = -version-info 5:1:1 -# -L$(top_builddir)/lib/pils -lpils -export-dynamic -module -avoid-version +# -L$(top_builddir)/lib/pils -lpils -export-dynamic -module -avoid-version libpengine_la_SOURCES = pengine.c allocate.c utils.c constraints.c libpengine_la_SOURCES += native.c group.c clone.c master.c graph.c libpengine_la_LIBADD = $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/cib/libcib.la pengine_SOURCES = main.c pengine_LDADD = $(top_builddir)/lib/cib/libcib.la $(COMMONLIBS) # libcib for get_object_root() # $(top_builddir)/lib/hbclient/libhbclient.la install-exec-local: $(mkinstalldirs) $(DESTDIR)/$(PE_STATE_DIR) -chown $(CRM_DAEMON_USER) $(DESTDIR)/$(PE_STATE_DIR) -chgrp $(CRM_DAEMON_GROUP) $(DESTDIR)/$(PE_STATE_DIR) -chmod 750 $(DESTDIR)/$(PE_STATE_DIR) uninstall-local: clean-generic: rm -f test10/*.pe.* diff --git a/pengine/regression.core.sh.in b/pengine/regression.core.sh.in index 59f454bd63..59afe99ca2 100644 --- a/pengine/regression.core.sh.in +++ b/pengine/regression.core.sh.in @@ -1,317 +1,318 @@ # Copyright (C) 2004 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # verbose=0 num_failed=0 num_tests=0 force_local=0 VALGRIND_CMD="" diff_opts="--ignore-all-space -u -N" test_home=`dirname $0` test_name=`basename $0` function info() { printf "$*\n" } function error() { printf " * ERROR: $*\n" } function failed() { printf " * FAILED: $*\n" } function show_test() { name=$1; shift printf " Test %-25s $*\n" "$name:" } info "Test home is:\t$test_home" io_dir=$test_home/test10 test_binary=@abs_top_builddir@/tools/crm_simulate PCMK_schema_directory=@abs_top_builddir@/xml + failed=$test_home/.regression.failed.diff single_test= while true ; do case "$1" in -V|--verbose) verbose=1; shift;; -v|--valgrind) export G_SLICE=always-malloc - VALGRIND_CMD="valgrind -q --gen-suppressions=all --log-file=%q{valgrind_output} --show-reachable=no --leak-check=full --trace-children=no --time-stamp=yes --num-callers=20 --suppressions=$test_home/ptest.supp" + VALGRIND_CMD="valgrind -q --gen-suppressions=all --log-file=%q{valgrind_output} --show-reachable=no --leak-check=full --trace-children=no --time-stamp=yes --num-callers=20 --suppressions=@datadir@/@PACKAGE@/tests/valgrind-pcmk.suppressions" test_binary= shift;; --valgrind-dhat) - VALGRIND_CMD="valgrind --log-file=%q{valgrind_output} --show-top-n=100 --num-callers=4 --time-stamp=yes --trace-children=no --tool=exp-dhat --suppressions=$test_home/ptest.supp" + VALGRIND_CMD="valgrind --log-file=%q{valgrind_output} --show-top-n=100 --num-callers=4 --time-stamp=yes --trace-children=no --tool=exp-dhat" test_binary= shift;; --valgrind-skip-output) VALGRIND_SKIP_OUTPUT=1 shift;; --run) single_test="$2"; shift; shift; break;; -b|--binary) test_binary=$2; PCMK_schema_directory=""; shift; shift;; -?|--help) echo "$0 [--binary name] [--force-local]"; shift; exit 0;; --) shift ; break ;; "") break;; *) echo "unknown option: $1"; exit 1;; esac done if [ "x$test_binary" = "x" ]; then test_binary=@sbindir@/crm_simulate PCMK_schema_directory=@CRM_DTD_DIRECTORY@ elif [ ! -x $test_binary ]; then test_binary=@sbindir@/crm_simulate PCMK_schema_directory=@CRM_DTD_DIRECTORY@ fi export PCMK_schema_directory if [ "x$test_binary" = "x" ]; then info "crm_simulate not installed. Aborting." exit 1 fi info "Test binary is:\t$test_binary" info "Schema home is:\t$PCMK_schema_directory" if [ "x$VALGRIND_CMD" != "x" ]; then info "Activating memory testing with valgrind"; fi info " " test_cmd="$VALGRIND_CMD $test_binary" #echo $test_cmd if [ `whoami` != root ]; then declare -x CIB_shadow_dir=/tmp fi function do_test { did_fail=0 expected_rc=0 num_tests=`expr $num_tests + 1` base=$1; shift name=$1; shift input=$io_dir/${base}.xml output=$io_dir/${base}.out expected=$io_dir/${base}.exp dot_png=$io_dir/${base}.png dot_expected=$io_dir/${base}.dot dot_output=$io_dir/${base}.pe.dot scores=$io_dir/${base}.scores score_output=$io_dir/${base}.scores.pe stderr_expected=$io_dir/${base}.stderr stderr_output=$io_dir/${base}.stderr.pe summary=$io_dir/${base}.summary summary_output=$io_dir/${base}.summary.pe valgrind_output=$io_dir/${base}.valgrind export valgrind_output if [ "x$1" = "x--rc" ]; then expected_rc=$2 shift; shift; fi show_test "$base" "$name" if [ ! -f $input ]; then error "No input"; did_fail=1 num_failed=`expr $num_failed + $did_fail` return; fi if [ "$create_mode" != "true" -a ! -f $expected ]; then error "no stored output"; # return; fi # ../admin/crm_verify -X $input if [ ! -z $single_test ]; then echo CIB_shadow_dir=$io_dir $test_cmd -x $input -D $dot_output -G $output -S $* CIB_shadow_dir=$io_dir $test_cmd -x $input -D $dot_output -G $output -S $* else CIB_shadow_dir=$io_dir $test_cmd -x $input -S &> $summary_output fi CIB_shadow_dir=$io_dir $test_cmd -x $input -D $dot_output -G $output -SQ -s $* 2> $stderr_output > $score_output rc=$? if [ $rc != $expected_rc ]; then failed "Test returned: $rc"; did_fail=1 echo "CIB_shadow_dir=$io_dir $test_cmd -x $input -D $dot_output -G $output -SQ -s $*" fi if [ -z "$VALGRIND_SKIP_OUTPUT" ]; then if [ -s ${valgrind_output} ]; then error "Valgrind reported errors"; did_fail=1 cat ${valgrind_output} fi rm -f ${valgrind_output} fi if [ -s core ]; then error "Core-file detected: core.${base}"; did_fail=1 rm -f $test_home/core.$base mv core $test_home/core.$base fi if [ -e $stderr_expected ]; then diff $diff_opts $stderr_expected $stderr_output >/dev/null rc2=$? if [ $rc2 != 0 ]; then failed "stderr changed"; diff $diff_opts $stderr_expected $stderr_output 2>/dev/null >> $failed echo "" >> $failed did_fail=1 fi elif [ -s $stderr_output ]; then error "Output was written to stderr" did_fail=1 cat $stderr_output fi rm -f $stderr_output if [ ! -s $output ]; then error "No graph produced"; did_fail=1 num_failed=`expr $num_failed + $did_fail` rm -f $output return; # else # mv $output $output.sed # cat $output.sed | sed 's/id=.[0-9]*.\ //g' >> $output fi if [ ! -s $dot_output ]; then error "No dot-file summary produced"; did_fail=1 num_failed=`expr $num_failed + $did_fail` rm -f $output return; else echo "digraph \"g\" {" > $dot_output.sort LC_ALL=POSIX sort -u $dot_output | grep -v -e ^}$ -e digraph >> $dot_output.sort echo "}" >> $dot_output.sort mv -f $dot_output.sort $dot_output fi if [ ! -s $score_output ]; then error "No allocation scores produced"; did_fail=1 num_failed=`expr $num_failed + $did_fail` rm $output return; else LC_ALL=POSIX sort $score_output > $score_output.sorted mv -f $score_output.sorted $score_output fi if [ "$create_mode" = "true" ]; then cp "$output" "$expected" cp "$dot_output" "$dot_expected" cp "$score_output" "$scores" cp "$summary_output" "$summary" info " Created expected outputs" fi diff $diff_opts $summary $summary_output >/dev/null rc2=$? if [ $rc2 != 0 ]; then failed "summary changed"; diff $diff_opts $summary $summary_output 2>/dev/null >> $failed echo "" >> $failed did_fail=1 fi diff $diff_opts $dot_expected $dot_output >/dev/null rc=$? if [ $rc != 0 ]; then failed "dot-file summary changed"; diff $diff_opts $dot_expected $dot_output 2>/dev/null >> $failed echo "" >> $failed did_fail=1 else rm -f $dot_output fi diff $diff_opts $expected $output >/dev/null rc2=$? if [ $rc2 != 0 ]; then failed "xml-file changed"; diff $diff_opts $expected $output 2>/dev/null >> $failed echo "" >> $failed did_fail=1 fi diff $diff_opts $scores $score_output >/dev/null rc=$? if [ $rc != 0 ]; then failed "scores-file changed"; diff $diff_opts $scores $score_output 2>/dev/null >> $failed echo "" >> $failed did_fail=1 fi rm -f $output $score_output $summary_output num_failed=`expr $num_failed + $did_fail` } function test_results { if [ $num_failed != 0 ]; then if [ -s $failed ]; then if [ "$verbose" = "1" ]; then error "Results of $num_failed failed tests (out of $num_tests)...." cat $failed else error "Results of $num_failed failed tests (out of $num_tests) are in $failed...." error "Use $0 -V to display them automatically." fi else error "$num_failed (of $num_tests) tests failed (no diff results)" rm $failed fi fi exit $num_failed } if [ -z $single_test ]; then # zero out the error log > $failed else failed=.single > $failed do_test $single_test "Single shot" $* cat $failed exit $? fi diff --git a/tools/Makefile.am b/tools/Makefile.am index ccd1e7ae64..ad469d2373 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,167 +1,167 @@ # # Copyright (C) 2004-2009 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MAINTAINERCLEANFILES = Makefile.in INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl COMMONLIBS = \ $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/cib/libcib.la \ $(CURSESLIBS) $(CLUSTERLIBS) headerdir = $(pkgincludedir)/crm header_HEADERS = pcmkdir = $(datadir)/$(PACKAGE) pcmk_DATA = report.common report.collector sbin_SCRIPTS = crm_report crm_standby crm_master crm_failcount if BUILD_CIBSECRETS sbin_SCRIPTS += cibsecret endif EXTRA_DIST = $(sbin_SCRIPTS) halibdir = $(CRM_DAEMON_DIR) halib_PROGRAMS = attrd sbin_PROGRAMS = crm_simulate crmadmin cibadmin crm_node crm_attribute crm_resource crm_verify \ crm_shadow attrd_updater crm_diff crm_mon iso8601 crm_ticket crm_error -clidir = $(datadir)/$(PACKAGE)/tests/cli -cli_SCRIPTS = regression.sh -cli_DATA = regression.exp cli.supp +testdir = $(datadir)/$(PACKAGE)/tests/cli +test_SCRIPTS = regression.sh +test_DATA = regression.exp if BUILD_HEARTBEAT_SUPPORT sbin_PROGRAMS += crm_uuid endif if BUILD_SERVICELOG sbin_PROGRAMS += notifyServicelogEvent endif if BUILD_OPENIPMI_SERVICELOG sbin_PROGRAMS += ipmiservicelogd endif if BUILD_HELP man8_MANS = $(sbin_PROGRAMS:%=%.8) $(sbin_SCRIPTS:%=%.8) endif ## SOURCES noinst_HEADERS = crmadmin_SOURCES = crmadmin.c crmadmin_LDADD = $(top_builddir)/lib/pengine/libpe_status.la \ $(COMMONLIBS) $(CLUSTERLIBS) crm_error_SOURCES = crm_error.c crm_error_LDADD = $(COMMONLIBS) crm_uuid_SOURCES = crm_uuid.c crm_uuid_LDADD = $(COMMONLIBS) $(top_builddir)/lib/cluster/libcrmcluster.la cibadmin_SOURCES = cibadmin.c cibadmin_LDADD = $(COMMONLIBS) crm_shadow_SOURCES = cib_shadow.c crm_shadow_LDADD = $(COMMONLIBS) crm_node_SOURCES = crm_node.c crm_node_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la \ $(COMMONLIBS) $(CLUSTERLIBS) crm_simulate_SOURCES = crm_simulate.c crm_simulate_CFLAGS = -I$(top_srcdir)/pengine crm_simulate_LDADD = $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/lrmd/liblrmd.la \ $(top_builddir)/lib/transition/libtransitioner.la \ $(COMMONLIBS) crm_diff_SOURCES = xml_diff.c crm_diff_LDADD = $(COMMONLIBS) crm_mon_SOURCES = crm_mon.c crm_mon_LDADD = $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/fencing/libstonithd.la \ $(top_builddir)/pengine/libpengine.la \ $(COMMONLIBS) $(SNMPLIBS) $(ESMTPLIBS) # Arguments could be made that this should live in crm/pengine crm_verify_SOURCES = crm_verify.c crm_verify_LDADD = $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la \ $(COMMONLIBS) crm_attribute_SOURCES = crm_attribute.c crm_attribute_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la $(COMMONLIBS) crm_resource_SOURCES = crm_resource.c crm_resource_LDADD = $(top_builddir)/lib/pengine/libpe_rules.la \ $(top_builddir)/lib/lrmd/liblrmd.la \ $(top_builddir)/lib/services/libcrmservice.la \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la \ $(COMMONLIBS) iso8601_SOURCES = test.iso8601.c iso8601_LDADD = $(COMMONLIBS) attrd_SOURCES = attrd.c attrd_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la $(COMMONLIBS) #pingd_SOURCES = pingd.c #pingd_LDADD = $(COMMONLIBS) attrd_updater_SOURCES = attrd_updater.c attrd_updater_LDADD = $(COMMONLIBS) crm_ticket_SOURCES = crm_ticket.c crm_ticket_LDADD = $(top_builddir)/lib/pengine/libpe_rules.la \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la \ $(COMMONLIBS) if BUILD_SERVICELOG notifyServicelogEvent_SOURCES = notifyServicelogEvent.c notifyServicelogEvent_CFLAGS = $(SERVICELOG_CFLAGS) notifyServicelogEvent_LDADD = $(top_builddir)/lib/common/libcrmcommon.la $(SERVICELOG_LIBS) endif if BUILD_OPENIPMI_SERVICELOG ipmiservicelogd_SOURCES = ipmiservicelogd.c ipmiservicelogd_CFLAGS = $(OPENIPMI_SERVICELOG_CFLAGS) $(SERVICELOG_CFLAGS) ipmiservicelogd_LDFLAGS = $(top_builddir)/lib/common/libcrmcommon.la $(OPENIPMI_SERVICELOG_LIBS) $(SERVICELOG_LIBS) endif %.8: % crm_attribute echo Creating $@ chmod a+x $(top_builddir)/tools/$< $(top_builddir)/tools/$< --help PATH=$(top_builddir)/tools:$$PATH $(HELP2MAN) --output $@ --no-info --section 8 --name "Part of the Pacemaker cluster resource manager" $(top_builddir)/tools/$< clean-generic: rm -f *.log *.debug *.xml *~ install-exec-local: uninstall-local: .PHONY: install-exec-hook diff --git a/tools/cli.supp b/tools/cli.supp deleted file mode 100644 index 19470e61e4..0000000000 --- a/tools/cli.supp +++ /dev/null @@ -1,7 +0,0 @@ -# Valgrind suppressions file for CLI tools -{ - Valgrind bug - Memcheck:Addr8 - fun:__strspn_sse42 - fun:crm_get_msec -} diff --git a/tools/regression.sh b/tools/regression.sh index f8559e70e6..b35cc4bdce 100755 --- a/tools/regression.sh +++ b/tools/regression.sh @@ -1,255 +1,255 @@ #!/bin/bash : ${shadow=tools-regression} test_home=`dirname $0` num_errors=0 num_passed=0 GREP_OPTIONS= function assert() { rc=$1; shift target=$1; shift app=$1; shift msg=$1; shift cib=$1; shift if [ x$cib = x0 ]; then : nothing else cibadmin -Q fi if [ $rc -ne $target ]; then num_errors=`expr $num_errors + 1` printf "* Failed (rc=%.3d): %-14s - %s\n" $rc $app "$msg" printf "* Failed (rc=%.3d): %-14s - %s\n" $rc $app "$msg" 1>&2 return exit 1 else printf "* Passed: %-14s - %s\n" $app "$msg" printf "* Passed: %-14s - %s\n" $app "$msg" 1>&2 num_passed=`expr $num_passed + 1` fi } function usage() { echo "Usage: ./regression.sh [-s(ave)] [-x] [-v(erbose)]" exit $1 } done=0 do_save=0 VALGRIND_CMD= while test "$done" = "0"; do case "$1" in -V|--verbose) verbose=1; shift;; -v|--valgrind) export G_SLICE=always-malloc - VALGRIND_CMD="valgrind -q --show-reachable=no --leak-check=full --trace-children=no --time-stamp=yes --num-callers=20 --suppressions=$test_home/cli.supp" + VALGRIND_CMD="valgrind -q --show-reachable=no --leak-check=full --trace-children=no --time-stamp=yes --num-callers=20 --suppressions=/usr/share/pacemaker/tests/valgrind-pcmk.suppressions" shift;; -x) set -x; shift;; -s) do_save=1; shift;; -p) PATH="$2:$PATH"; export PATH; shift 1;; -?) usage 0;; -*) echo "unknown option: $1"; usage 1;; *) done=1;; esac done if [ "x$VALGRIND_CMD" = "x" -a -x $test_home/crm_simulate ]; then echo "Using local binaries from: $test_home" PATH="$test_home:$PATH" fi function test_tools() { export CIB_shadow_dir=$test_home $VALGRIND_CMD crm_shadow --batch --force --create-empty $shadow 2>&1 export CIB_shadow=$shadow $VALGRIND_CMD cibadmin -Q 2>&1 $VALGRIND_CMD cibadmin -E 2>&1 assert $? 22 cibadmin "Require --force for CIB erasure" $VALGRIND_CMD cibadmin -E --force assert $? 0 cibadmin "Allow CIB erasure with --force" $VALGRIND_CMD cibadmin -Q > /tmp/$$.existing.xml assert $? 0 cibadmin "Query CIB" $VALGRIND_CMD crm_attribute -n cluster-delay -v 60s assert $? 0 crm_attribute "Set cluster option" $VALGRIND_CMD cibadmin -Q -o crm_config | grep cib-bootstrap-options-cluster-delay assert $? 0 cibadmin "Query new cluster option" $VALGRIND_CMD cibadmin -Q -o crm_config > /tmp/$$.opt.xml assert $? 0 cibadmin "Query cluster options" $VALGRIND_CMD cibadmin -D -o crm_config --xml-text '' assert $? 0 cibadmin "Delete nvpair" $VALGRIND_CMD cibadmin -C -o crm_config --xml-file /tmp/$$.opt.xml 2>&1 assert $? 76 cibadmin "Create operaton should fail with: -76, The object already exists" $VALGRIND_CMD cibadmin -M -o crm_config --xml-file /tmp/$$.opt.xml assert $? 0 cibadmin "Modify cluster options section" $VALGRIND_CMD cibadmin -Q -o crm_config | grep cib-bootstrap-options-cluster-delay assert $? 0 cibadmin "Query updated cluster option" $VALGRIND_CMD crm_attribute -n cluster-delay -v 40s -s duplicate assert $? 0 crm_attribute "Set duplicate cluster option" $VALGRIND_CMD crm_attribute -n cluster-delay -v 30s assert $? 234 crm_attribute "Setting multiply defined cluster option should fail with -216, Could not set cluster option" $VALGRIND_CMD crm_attribute -n cluster-delay -v 30s -s duplicate assert $? 0 crm_attribute "Set cluster option with -s" $VALGRIND_CMD crm_attribute -n cluster-delay -D -i cib-bootstrap-options-cluster-delay assert $? 0 crm_attribute "Delete cluster option with -i" $VALGRIND_CMD cibadmin -C -o nodes --xml-text '' assert $? 0 cibadmin "Create node entry" $VALGRIND_CMD cibadmin -C -o status --xml-text '' assert $? 0 cibadmin "Create node status entry" $VALGRIND_CMD crm_attribute -n ram -v 1024M -U clusterNode-UNAME -t nodes assert $? 0 crm_attribute "Create node attribute" $VALGRIND_CMD cibadmin -Q -o nodes | grep clusterNode-UUID-ram assert $? 0 cibadmin "Query new node attribute" $VALGRIND_CMD cibadmin -Q | cibadmin -5 -p 2>&1 > /dev/null assert $? 0 cibadmin "Digest calculation" # This update will fail because it has version numbers $VALGRIND_CMD cibadmin -R --xml-file /tmp/$$.existing.xml 2>&1 assert $? 205 cibadmin "Replace operation should fail with: 205, Update was older than existing configuration" crm_standby -N clusterNode-UNAME -G assert $? 0 crm_standby "Default standby value" crm_standby -N clusterNode-UNAME -v true assert $? 0 crm_standby "Set standby status" crm_standby -N clusterNode-UNAME -G assert $? 0 crm_standby "Query standby value" crm_standby -N clusterNode-UNAME -D 2>&1 assert $? 0 crm_standby "Delete standby value" $VALGRIND_CMD cibadmin -C -o resources --xml-text '' assert $? 0 cibadmin "Create a resource" $VALGRIND_CMD crm_resource -r dummy --meta -p is-managed -v false assert $? 0 crm_resource "Create a resource meta attribute" $VALGRIND_CMD crm_resource -r dummy --meta -g is-managed assert $? 0 crm_resource "Query a resource meta attribute" $VALGRIND_CMD crm_resource -r dummy --meta -d is-managed assert $? 0 crm_resource "Remove a resource meta attribute" $VALGRIND_CMD crm_resource -r dummy -p delay -v 10s assert $? 0 crm_resource "Create a resource attribute" $VALGRIND_CMD crm_resource -L assert $? 0 crm_resource "List the configured resources" crm_failcount -r dummy -v 10 -N clusterNode-UNAME 2>&1 assert $? 0 crm_resource "Set a resource's fail-count" $VALGRIND_CMD crm_resource -r dummy -M 2>&1 assert $? 234 crm_resource "Require a destination when migrating a resource that is stopped" $VALGRIND_CMD crm_resource -r dummy -M -N i.dont.exist 2>&1 assert $? 250 crm_resource "Don't support migration to non-existant locations" $VALGRIND_CMD crm_resource -r dummy -M -N clusterNode-UNAME assert $? 0 crm_resource "Migrate a resource" $VALGRIND_CMD crm_resource -r dummy -U assert $? 0 crm_resource "Un-migrate a resource" $VALGRIND_CMD crm_ticket -t ticketA -G granted -d false assert $? 0 crm_ticket "Default ticket granted state" $VALGRIND_CMD crm_ticket -t ticketA -r --force assert $? 0 crm_ticket "Set ticket granted state" $VALGRIND_CMD crm_ticket -t ticketA -G granted assert $? 0 crm_ticket "Query ticket granted state" $VALGRIND_CMD crm_ticket -t ticketA -D granted --force assert $? 0 crm_ticket "Delete ticket granted state" $VALGRIND_CMD crm_ticket -t ticketA -s assert $? 0 crm_ticket "Make a ticket standby" $VALGRIND_CMD crm_ticket -t ticketA -G standby assert $? 0 crm_ticket "Query ticket standby state" $VALGRIND_CMD crm_ticket -t ticketA -a assert $? 0 crm_ticket "Activate a ticket" $VALGRIND_CMD crm_ticket -t ticketA -D standby assert $? 0 crm_ticket "Delete ticket standby state" } function test_date() { # $VALGRIND_CMD cibadmin -Q for y in 06 07 08 09 10 11 12 13 14 15 16 17 18; do $VALGRIND_CMD iso8601 -d "20$y-W01-7 00Z" $VALGRIND_CMD iso8601 -d "20$y-W01-7 00Z" -W -E "20$y-W01-7 00:00:00Z" assert $? 0 iso8601 "20$y-W01-7" 0 $VALGRIND_CMD iso8601 -d "20$y-W01-1 00Z" $VALGRIND_CMD iso8601 -d "20$y-W01-1 00Z" -W -E "20$y-W01-1 00:00:00Z" assert $? 0 iso8601 "20$y-W01-1" 0 done $VALGRIND_CMD iso8601 -d "2009-W53-7 00:00:00Z" -W -E "2009-W53-7 00:00:00Z" assert $? 0 iso8601 "2009-W53-07" 0 $VALGRIND_CMD iso8601 -d "2009-01-31 00:00:00Z" -D "P1M" -E "2009-02-28 00:00:00Z" assert $? 0 iso8601 "2009-01-31 + 1 Month" 0 $VALGRIND_CMD iso8601 -d "2009-01-31 00:00:00Z" -D "P2M" -E "2009-03-31 00:00:00Z" assert $? 0 iso8601 "2009-01-31 + 2 Months" 0 $VALGRIND_CMD iso8601 -d "2009-01-31 00:00:00Z" -D "P3M" -E "2009-04-30 00:00:00Z" assert $? 0 iso8601 "2009-01-31 + 3 Months" 0 $VALGRIND_CMD iso8601 -d "2009-03-31 00:00:00Z" -D "P-1M" -E "2009-02-28 00:00:00Z" assert $? 0 iso8601 "2009-03-31 - 1 Month" 0 } echo "Testing dates" test_date > $test_home/regression.out echo "Testing tools" test_tools >> $test_home/regression.out sed -i.sed 's/cib-last-written.*>/>/' $test_home/regression.out if [ $do_save = 1 ]; then cp $test_home/regression.out $test_home/regression.exp fi grep -e "^*" $test_home/regression.out if [ $num_errors != 0 ]; then echo $num_errors tests failed diff -wu $test_home/regression.exp $test_home/regression.out exit 1 fi diff -wu $test_home/regression.exp $test_home/regression.out if [ $? != 0 ]; then echo $num_passed tests passed but diff failed exit 2 else echo $num_passed tests passed exit 0 fi diff --git a/pengine/ptest.supp b/valgrind-pcmk.suppressions similarity index 100% rename from pengine/ptest.supp rename to valgrind-pcmk.suppressions