diff --git a/tools/Makefile.am b/tools/Makefile.am
index bfdfa577e8..869c2f02ae 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,148 +1,148 @@
#
# 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 = attrd.h
pcmkdir = $(datadir)/$(PACKAGE)
pcmk_DATA = report.common report.collector
sbin_SCRIPTS = crm_report crm_standby crm_master crm_failcount
EXTRA_DIST = $(sbin_SCRIPTS)
halibdir = $(CRM_DAEMON_DIR)
halib_SCRIPTS = hb2openais.sh
halib_PROGRAMS = attrd pingd
halib_PYTHON = crm_primitive.py hb2openais-helper.py
sbin_PROGRAMS = crm_simulate crmadmin cibadmin crm_node crm_attribute crm_resource crm_verify \
crm_uuid crm_shadow attrd_updater crm_diff crm_mon iso8601
testdir = $(datadir)/$(PACKAGE)/tests/cli
test_SCRIPTS = regression.sh
-test_DATA = regression.exp
+test_DATA = regression.exp cli.supp
if BUILD_SERVICELOG
sbin_PROGRAMS += notifyServicelogEvent
endif
if BUILD_OPENIPMI_SERVICELOG
sbin_PROGRAMS += ipmiservicelogd
endif
if BUILD_HELP
man8_MANS = $(sbin_PROGRAMS:%=%.8) crm_report.8
endif
## SOURCES
noinst_HEADERS =
crmadmin_SOURCES = crmadmin.c
crmadmin_LDADD = $(COMMONLIBS) $(CLUSTERLIBS) \
$(top_builddir)/lib/pengine/libpe_status.la
crm_uuid_SOURCES = crm_uuid.c
crm_uuid_LDADD = $(top_builddir)/lib/common/libcrmcluster.la
cibadmin_SOURCES = cibadmin.c
cibadmin_LDADD = $(COMMONLIBS)
crm_shadow_SOURCES = cib_shadow.c
crm_shadow_LDADD = $(COMMONLIBS)
crm_node_SOURCES = ccm_epoche.c
crm_node_LDADD = $(COMMONLIBS) $(CLUSTERLIBS) \
$(top_builddir)/lib/common/libcrmcluster.la
crm_simulate_SOURCES = crm_inject.c
crm_simulate_CFLAGS = -I$(top_srcdir)/pengine
crm_simulate_LDADD = $(COMMONLIBS) \
$(top_builddir)/lib/pengine/libpe_status.la \
$(top_builddir)/pengine/libpengine.la \
$(top_builddir)/lib/cib/libcib.la \
$(top_builddir)/lib/transition/libtransitioner.la
crm_diff_SOURCES = xml_diff.c
crm_diff_LDADD = $(COMMONLIBS)
crm_mon_SOURCES = crm_mon.c
crm_mon_LDADD = $(COMMONLIBS) $(SNMPLIBS) $(ESMTPLIBS) -llrm \
$(top_builddir)/lib/pengine/libpe_status.la
# Arguments could be made that this should live in crm/pengine
crm_verify_SOURCES = crm_verify.c
crm_verify_LDADD = $(COMMONLIBS) \
$(top_builddir)/lib/pengine/libpe_status.la \
$(top_builddir)/pengine/libpengine.la
crm_attribute_SOURCES = crm_attribute.c
crm_attribute_LDADD = $(COMMONLIBS)
crm_resource_SOURCES = crm_resource.c
crm_resource_LDADD = $(COMMONLIBS) \
$(top_builddir)/lib/pengine/libpe_rules.la \
$(top_builddir)/lib/pengine/libpe_status.la \
$(top_builddir)/pengine/libpengine.la
iso8601_SOURCES = test.iso8601.c
iso8601_LDADD = $(COMMONLIBS)
attrd_SOURCES = attrd.c
attrd_LDADD = $(COMMONLIBS) $(top_builddir)/lib/common/libcrmcluster.la
pingd_SOURCES = pingd.c
pingd_LDADD = $(COMMONLIBS)
attrd_updater_SOURCES = attrd_updater.c
attrd_updater_LDADD = $(COMMONLIBS)
if BUILD_SERVICELOG
notifyServicelogEvent_SOURCES = notifyServicelogEvent.c
notifyServicelogEvent_CFLAGS = `pkg-config --cflags servicelog-1`
notifyServicelogEvent_LDFLAGS = `pkg-config --libs servicelog-1` $(top_builddir)/lib/common/libcrmcommon.la
endif
if BUILD_OPENIPMI_SERVICELOG
ipmiservicelogd_SOURCES = ipmiservicelogd.c
ipmiservicelogd_CFLAGS = `pkg-config --cflags OpenIPMI OpenIPMIposix servicelog-1`
ipmiservicelogd_LDFLAGS = `pkg-config --libs OpenIPMI OpenIPMIposix servicelog-1` $(top_builddir)/lib/common/libcrmcommon.la
endif
%.8: %
echo Creating $@
chmod a+x $<
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/regression.sh b/tools/regression.sh
index a0ecb66cb0..edeeb41936 100755
--- a/tools/regression.sh
+++ b/tools/regression.sh
@@ -1,186 +1,191 @@
#!/bin/bash
: ${shadow=tools-regression}
-base=`dirname $0`
+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
exit_code=$1; shift
cibadmin -Q
if [ $rc -ne $target ]; then
num_errors=`expr $num_errors + 1`
printf "* Failed (rc=%.3d): %-14s - %s\n" $rc $app "$msg"
if [ ! -z $exit_code ]; then
echo "Aborting tests"
exit $exit_code
fi
exit 1
else
printf "* Passed: %-14s - %s\n" $app "$msg"
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=1; shift;;
+ -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"
+ 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
function test_tools() {
- export CIB_shadow_dir=$base
- crm_shadow --batch --force --create-empty $shadow
+ export CIB_shadow_dir=$test_home
+ $VALGRIND_CMD crm_shadow --batch --force --create-empty $shadow
export CIB_shadow=$shadow
- cibadmin -Q
+ $VALGRIND_CMD cibadmin -Q
- cibadmin -E
+ $VALGRIND_CMD cibadmin -E
assert $? 1 cibadmin "Require --force for CIB erasure"
- cibadmin -E --force
+ $VALGRIND_CMD cibadmin -E --force
assert $? 0 cibadmin "Allow CIB erasure with --force"
- cibadmin -Q > /tmp/$$.existing.xml
+ $VALGRIND_CMD cibadmin -Q > /tmp/$$.existing.xml
assert $? 0 cibadmin "Query CIB"
- crm_attribute -n cluster-delay -v 60s
+ $VALGRIND_CMD crm_attribute -n cluster-delay -v 60s
assert $? 0 crm_attribute "Set cluster option"
- cibadmin -Q -o crm_config | grep cib-bootstrap-options-cluster-delay
+ $VALGRIND_CMD cibadmin -Q -o crm_config | grep cib-bootstrap-options-cluster-delay
assert $? 0 cibadmin "Query new cluster option"
- cibadmin -Q -o crm_config > /tmp/$$.opt.xml
+ $VALGRIND_CMD cibadmin -Q -o crm_config > /tmp/$$.opt.xml
assert $? 0 cibadmin "Query cluster options"
- cibadmin -D -o crm_config --xml-text ''
+ $VALGRIND_CMD cibadmin -D -o crm_config --xml-text ''
assert $? 0 cibadmin "Delete nvpair"
- cibadmin -C -o crm_config --xml-file /tmp/$$.opt.xml
+ $VALGRIND_CMD cibadmin -C -o crm_config --xml-file /tmp/$$.opt.xml
assert $? 21 cibadmin "Create operaton should fail with: -21, The object already exists"
- cibadmin -M -o crm_config --xml-file /tmp/$$.opt.xml
+ $VALGRIND_CMD cibadmin -M -o crm_config --xml-file /tmp/$$.opt.xml
assert $? 0 cibadmin "Modify cluster options section"
- cibadmin -Q -o crm_config | grep cib-bootstrap-options-cluster-delay
+ $VALGRIND_CMD cibadmin -Q -o crm_config | grep cib-bootstrap-options-cluster-delay
assert $? 0 cibadmin "Query updated cluster option"
- crm_attribute -n cluster-delay -v 40s -s duplicate
+ $VALGRIND_CMD crm_attribute -n cluster-delay -v 40s -s duplicate
assert $? 0 crm_attribute "Set duplicate cluster option"
- crm_attribute -n cluster-delay -v 30s
+ $VALGRIND_CMD crm_attribute -n cluster-delay -v 30s
assert $? 216 crm_attribute "Setting multiply defined cluster option should fail with -216, Could not set cluster option"
- crm_attribute -n cluster-delay -v 30s -s duplicate
+ $VALGRIND_CMD crm_attribute -n cluster-delay -v 30s -s duplicate
assert $? 0 crm_attribute "Set cluster option with -s"
- crm_attribute -n cluster-delay -D -i cib-bootstrap-options-cluster-delay
+ $VALGRIND_CMD crm_attribute -n cluster-delay -D -i cib-bootstrap-options-cluster-delay
assert $? 0 crm_attribute "Delete cluster option with -i"
- cibadmin -C -o nodes --xml-text ''
+ $VALGRIND_CMD cibadmin -C -o nodes --xml-text ''
assert $? 0 cibadmin "Create node entry"
- cibadmin -C -o status --xml-text ''
+ $VALGRIND_CMD cibadmin -C -o status --xml-text ''
assert $? 0 cibadmin "Create node status entry"
- crm_attribute -n ram -v 1024M -U clusterNode-UNAME -t nodes
+ $VALGRIND_CMD crm_attribute -n ram -v 1024M -U clusterNode-UNAME -t nodes
assert $? 0 crm_attribute "Create node attribute"
- cibadmin -Q -o nodes | grep clusterNode-UUID-ram
+ $VALGRIND_CMD cibadmin -Q -o nodes | grep clusterNode-UUID-ram
assert $? 0 cibadmin "Query new node attribute"
- cibadmin -Q | cibadmin -5 -p 2>&1 > /dev/null
+ $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
- cibadmin -R --xml-file /tmp/$$.existing.xml
+ $VALGRIND_CMD cibadmin -R --xml-file /tmp/$$.existing.xml
assert $? 45 cibadmin "Replace operation should fail with: -45, 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
assert $? 0 crm_standby "Delete standby value"
- cibadmin -C -o resources --xml-text ''
+ $VALGRIND_CMD cibadmin -C -o resources --xml-text ''
assert $? 0 cibadmin "Create a resource"
- crm_resource -r dummy --meta -p is-managed -v false
+ $VALGRIND_CMD crm_resource -r dummy --meta -p is-managed -v false
assert $? 0 crm_resource "Create a resource meta attribute"
- crm_resource -r dummy --meta -g is-managed
+ $VALGRIND_CMD crm_resource -r dummy --meta -g is-managed
assert $? 0 crm_resource "Query a resource meta attribute"
- crm_resource -r dummy --meta -d is-managed
+ $VALGRIND_CMD crm_resource -r dummy --meta -d is-managed
assert $? 0 crm_resource "Remove a resource meta attribute"
- crm_resource -r dummy -p delay -v 10s
+ $VALGRIND_CMD crm_resource -r dummy -p delay -v 10s
assert $? 0 crm_resource "Create a resource attribute"
- crm_resource -L
+ $VALGRIND_CMD crm_resource -L
assert $? 0 crm_resource "List the configured resources"
crm_failcount -r dummy -v 10 -N clusterNode-UNAME
assert $? 0 crm_resource "Set a resource's fail-count"
- crm_resource -r dummy -M
+ $VALGRIND_CMD crm_resource -r dummy -M
assert $? 244 crm_resource "Require a destination when migrating a resource that is stopped"
- crm_resource -r dummy -M -N i.dont.exist
+ $VALGRIND_CMD crm_resource -r dummy -M -N i.dont.exist
assert $? 234 crm_resource "Don't support migration to non-existant locations"
- crm_resource -r dummy -M -N clusterNode-UNAME
+ $VALGRIND_CMD crm_resource -r dummy -M -N clusterNode-UNAME
assert $? 0 crm_resource "Migrate a resource"
- crm_resource -r dummy -U
+ $VALGRIND_CMD crm_resource -r dummy -U
assert $? 0 crm_resource "Un-migrate a resource"
}
-test_tools 2>&1 | sed s/cib-last-written.*\>/\>/ > $base/regression.out
+test_tools 2>&1 | sed s/cib-last-written.*\>/\>/ > $test_home/regression.out
rc=$?
if [ $do_save = 1 ]; then
- cp $base/regression.out $base/regression.exp
+ cp $test_home/regression.out $test_home/regression.exp
fi
-grep -e "^*" $base/regression.out
-diff -u $base/regression.exp $base/regression.out
+grep -e "^*" $test_home/regression.out
+diff -u $test_home/regression.exp $test_home/regression.out
diff_rc=$?
if [ $rc != 0 ]; then
echo Tests failed
exit 1
elif [ $diff_rc != 0 ]; then
echo Tests passed but diff failed
exit 2
else
echo Tests passed
exit 0
fi