[rhmessaging-commits] rhmessaging commits: r3307 - in store/trunk/cpp: lib and 2 other directories.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Fri Apr 17 16:13:06 EDT 2009
Author: kpvdr
Date: 2009-04-17 16:13:06 -0400 (Fri, 17 Apr 2009)
New Revision: 3307
Added:
store/trunk/cpp/tests/cluster/
store/trunk/cpp/tests/cluster/.valgrind.supp
store/trunk/cpp/tests/cluster/.valgrindrc
store/trunk/cpp/tests/cluster/Makefile.am
store/trunk/cpp/tests/cluster/_st_cluster_basic.cpp
store/trunk/cpp/tests/cluster/run_cluster_tests
Modified:
store/trunk/cpp/configure.ac
store/trunk/cpp/lib/MessageStoreImpl.cpp
store/trunk/cpp/lib/StorePlugin.cpp
store/trunk/cpp/lib/TxnCtxt.cpp
store/trunk/cpp/tests/Makefile.am
Log:
Initial cluster tests taken from qpid, but which makes all queues and messages durable. More to follow.
Modified: store/trunk/cpp/configure.ac
===================================================================
--- store/trunk/cpp/configure.ac 2009-04-17 17:16:10 UTC (rev 3306)
+++ store/trunk/cpp/configure.ac 2009-04-17 20:13:06 UTC (rev 3307)
@@ -87,8 +87,8 @@
AC_MSG_ERROR([$QPID_DIR does not appear to be a valid qpid checkout.])
test -d $QPID_DIR/python -a -d $QPID_DIR/specs || \
AC_MSG_ERROR([$QPID_DIR does not have python and specs directories.])
- QPID_LIBS="$QPID_SRC/libqpidbroker.la $QPID_SRC/libqpidcommon.la"
- QPID_CXXFLAGS="-I$QPID_SRC -I${QPID_SRC}/gen"
+ QPID_LIBS="$QPID_SRC/libqpidbroker.la $QPID_SRC/libqpidclient.la $QPID_SRC/libqpidcommon.la"
+ QPID_CXXFLAGS="-I$QPID_SRC -I${QPID_SRC}/gen -I${QPID_SRC}/tests"
else
fail=0
AC_CHECK_HEADERS([qpid/broker/MessageStore.h], , [fail=1])
@@ -179,12 +179,56 @@
AC_CHECK_PROG([RPMLINT], [rpmlint], [rpmlint])
AM_CONDITIONAL([HAS_RPMLINT], [test -n "$RPMLINT"])
+# Check for optional cluster requirements.
+tmp_LIBS=$LIBS
+LDFLAGS="$LDFLAGS -L/usr/lib/openais -L/usr/lib64/openais -L/usr/lib/corosync -L/usr/lib64/corosync"
+AC_CHECK_LIB([cpg],[cpg_local_get],[have_libcpg=yes],)
+AC_CHECK_HEADERS([openais/cpg.h corosync/cpg.h],[have_cpg_h=yes],)
+AC_ARG_WITH([cpg],
+ [AS_HELP_STRING([--with-cpg], [Build with CPG support for clustering.])],
+ [case "${withval}" in
+ yes) # yes - require dependencies
+ test x$have_libcpg = xyes || AC_MSG_ERROR([libcpg not found, install openais-devel or corosync-devel])
+ test x$have_cpg_h = xyes || AC_MSG_ERROR([cpg.h not found, install openais-devel or corosync-devel])
+ with_cpg=yes
+ ;;
+ no) with_cpg=no ;;
+ *) AC_MSG_ERROR([Bad value ${withval} for --with-cpg option]) ;;
+ esac],
+ [ # not specified - use if present
+ test x$have_libcpg = xyes -a x$have_cpg_h = xyes && with_cpg=yes
+ ]
+)
+AM_CONDITIONAL([HAVE_LIBCPG], [test x$with_cpg = xyes])
+
+AC_CHECK_LIB([cman],[cman_is_quorate],have_libcman=yes,)
+AC_CHECK_HEADERS([libcman.h],have_libcman_h=yes,)
+AC_ARG_WITH([libcman],
+ [AS_HELP_STRING([--with-libcman], [Integration with libcman quorum service.])],
+ [case "${withval}" in
+ yes) # yes - require dependencies
+ test x$have_libcman = xyes || AC_MSG_ERROR([libcman not found, install cman-devel or cmanlib-devel])
+ test x$have_libcman_h = xyes || AC_MSG_ERROR([libcman.h not found, install cman-devel or cmanlib-devel])
+ with_libcman=yes
+ ;;
+ no) with_libcman=no ;;
+ *) AC_MSG_ERROR([Bad value ${withval} for --with-libcman option]) ;;
+ esac],
+ [ # not specified - use if present and we're using with_cpg
+ test x$have_libcman = xyes -a x$have_libcman_h = xyes -a x$with_cpg = xyes && with_libcman=yes
+ ]
+)
+AM_CONDITIONAL([HAVE_LIBCMAN], [test x$with_libcman = xyes])
+
+LIBS=$tmp_LIBS
+
# Also doxygen for documentation...
AC_CHECK_PROG([do_doxygen], [doxygen], [yes])
AM_CONDITIONAL([DOXYGEN], [test x$do_doxygen = xyes])
AC_CONFIG_FILES([
Makefile
+ tests/cluster/Makefile
tests/Makefile
tests/jrnl/Makefile
tests/jrnl/jtt/Makefile
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-04-17 17:16:10 UTC (rev 3306)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-04-17 20:13:06 UTC (rev 3307)
@@ -293,8 +293,8 @@
TxnCtxt txn;
try {
// Databases are constructed here instead of the constructor so that the DB_RECOVER flag can be used
- // against the database enviroment. Recover can only be performed if no databases have been created
- // against the environmnet at the time of recovery, as recovery invalidates the environment.
+ // against the database environment. Recover can only be performed if no databases have been created
+ // against the environment at the time of recovery, as recovery invalidates the environment.
queueDb.reset(new Db(&env, 0));
configDb.reset(new Db(&env, 0));
exchangeDb.reset(new Db(&env, 0));
@@ -1130,7 +1130,7 @@
if (!tplStorePtr->is_ready())
recoverTplStore();
- // Abort unprepaired xids and populate the locked maps
+ // Abort unprepared xids and populate the locked maps
for (TplRecoverMapCitr i = tplRecoverMap.begin(); i != tplRecoverMap.end(); i++) {
LockedMappings::shared_ptr enq_ptr;
enq_ptr.reset(new LockedMappings);
@@ -1584,7 +1584,7 @@
try {
chkTplStoreInit(); // Late initialize (if needed)
- // This sync is requred to ensure multi-queue atomicity - ie all txn data
+ // This sync is required to ensure multi-queue atomicity - ie all txn data
// must hit the disk on *all* queues before the TPL prepare (enq) is written.
ctxt->sync();
Modified: store/trunk/cpp/lib/StorePlugin.cpp
===================================================================
--- store/trunk/cpp/lib/StorePlugin.cpp 2009-04-17 17:16:10 UTC (rev 3306)
+++ store/trunk/cpp/lib/StorePlugin.cpp 2009-04-17 20:13:06 UTC (rev 3307)
@@ -49,7 +49,7 @@
if (options.storeDir.empty ())
{
if (!dataDir.isEnabled ())
- throw Exception ("If --data-dir is blank or --no-data-dir is specified, --store-dir must be present.");
+ throw Exception ("msgstore: If --data-dir is blank or --no-data-dir is specified, --store-dir must be present.");
options.storeDir = dataDir.getPath ();
}
@@ -62,6 +62,8 @@
Broker* broker = dynamic_cast<Broker*>(&target);
((mrg::msgstore::MessageStoreImpl*) store)->initManagement (broker);
}
+
+ const char* id() {return "StorePlugin";}
};
static StorePlugin instance; // Static initialization.
Modified: store/trunk/cpp/lib/TxnCtxt.cpp
===================================================================
--- store/trunk/cpp/lib/TxnCtxt.cpp 2009-04-17 17:16:10 UTC (rev 3306)
+++ store/trunk/cpp/lib/TxnCtxt.cpp 2009-04-17 20:13:06 UTC (rev 3307)
@@ -38,7 +38,7 @@
}
}
-//static
+// static
uuid_t TxnCtxt::uuid;
// static
@@ -54,7 +54,7 @@
}
TxnCtxt::TxnCtxt(IdSequence* _loggedtx) : loggedtx(_loggedtx), dtokp(new DataTokenImpl), preparedXidStorePtr(0), txn(0) {
- if (loggedtx) {
+ if (loggedtx) {
// // Human-readable tid: 53 bytes
// // uuit_t is a char[16]
// tid.reserve(53);
Modified: store/trunk/cpp/tests/Makefile.am
===================================================================
--- store/trunk/cpp/tests/Makefile.am 2009-04-17 17:16:10 UTC (rev 3306)
+++ store/trunk/cpp/tests/Makefile.am 2009-04-17 20:13:06 UTC (rev 3307)
@@ -28,7 +28,7 @@
TMPDIR=$(abs_srcdir)/test_tmp
-SUBDIRS = jrnl .
+SUBDIRS = cluster jrnl .
TESTS = \
SimpleTest \
Added: store/trunk/cpp/tests/cluster/.valgrind.supp
===================================================================
--- store/trunk/cpp/tests/cluster/.valgrind.supp (rev 0)
+++ store/trunk/cpp/tests/cluster/.valgrind.supp 2009-04-17 20:13:06 UTC (rev 3307)
@@ -0,0 +1,32 @@
+{
+ Benign error in libcpg.
+ Memcheck:Param
+ socketcall.sendmsg(msg.msg_iov[i])
+ obj:*/libpthread-2.5.so
+ obj:*/libcpg.so.2.0.0
+}
+
+{
+ Uninitialised value problem in _dl_relocate (F7, F8)
+ Memcheck:Cond
+ fun:_dl_relocate_object
+ fun:*dl_*
+}
+
+{
+ False "possibly leaked" in boost program_options - global std::string var.
+ Memcheck:Leak
+ fun:_Znwj
+ fun:_ZNSs4_Rep9_S_createEjjRKSaIcE
+ obj:/usr/lib/libstdc++.so.6.0.8
+ fun:_ZNSsC1EPKcRKSaIcE
+ obj:/usr/lib/libboost_program_options.so.1.33.1
+}
+
+{
+ Bogus epoll_ctl error on i386
+ Memcheck:Param
+ epoll_ctl(event)
+ fun:epoll_ctl
+}
+
Added: store/trunk/cpp/tests/cluster/.valgrindrc
===================================================================
--- store/trunk/cpp/tests/cluster/.valgrindrc (rev 0)
+++ store/trunk/cpp/tests/cluster/.valgrindrc 2009-04-17 20:13:06 UTC (rev 3307)
@@ -0,0 +1,7 @@
+--gen-suppressions=all
+--leak-check=full
+--demangle=yes
+--suppressions=.valgrind.supp
+--num-callers=25
+--trace-children=yes
+
Added: store/trunk/cpp/tests/cluster/Makefile.am
===================================================================
--- store/trunk/cpp/tests/cluster/Makefile.am (rev 0)
+++ store/trunk/cpp/tests/cluster/Makefile.am 2009-04-17 20:13:06 UTC (rev 3307)
@@ -0,0 +1,70 @@
+# Copyright (c) 2007, 2008, 2009 Red Hat, Inc.
+#
+# This file is part of the Qpid async store library msgstore.so.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser 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 library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+# USA
+#
+# The GNU Lesser General Public License is available in the file COPYING.
+
+
+abs_builddir=@abs_builddir@
+abs_srcdir=@abs_srcdir@
+
+if HAVE_LIBCPG
+
+
+AM_CXXFLAGS = $(WARNING_CFLAGS) -pthread -DBOOST_TEST_DYN_LINK
+
+INCLUDES=-I$(top_srcdir)/lib $(QPID_CXXFLAGS)
+
+TMPDIR=$(abs_srcdir)/test_tmp
+
+QPID_TEST_DIR = $(QPID_DIR)/cpp/src/tests
+
+CLUSTER_TEST_LDADD = -L$(QPID_TEST_DIR)
+
+all-local: .valgrindrc .valgrind.supp
+.valgrindrc: $(top_srcdir)/tests/.valgrindrc
+ cp $^ .
+.valgrind.supp: $(top_srcdir)/tests/.valgrind.supp
+ cp $^ .
+
+TESTS = run_cluster_tests
+
+check_PROGRAMS = \
+ _st_cluster_basic
+
+UNIT_TEST_SRCS = ../unit_test.cpp
+UNIT_TEST_LDADD = -lboost_unit_test_framework ${top_builddir}/lib/msgstore.la \
+ $(QPID_TEST_DIR)/ClusterFixture.o \
+ $(QPID_TEST_DIR)/ForkedBroker.o
+
+_st_cluster_basic_SOURCES = _st_cluster_basic.cpp $(UNIT_TEST_SRCS)
+_st_cluster_basic_LDADD = $(UNIT_TEST_LDADD) $(CLUSTER_TEST_LDADD)
+
+TESTS_ENVIRONMENT = \
+ QPID_DIR=$(QPID_DIR) \
+ VALGRIND=$(VALGRIND) \
+ LIBCLUSTER=$(QPID_DIR)/cpp/src/.libs/cluster.so \
+ LIBSTORE=$(abs_builddir)/../../lib/.libs/msgstore.so \
+ QPID_FORKED_BROKER=$(QPID_DIR)/cpp/src/qpidd \
+ TMPDIR=$(TMPDIR) \
+ abs_srcdir=$(abs_srcdir)
+
+EXTRA_DIST = \
+ run_cluster_tests
+
+endif
\ No newline at end of file
Added: store/trunk/cpp/tests/cluster/_st_cluster_basic.cpp
===================================================================
--- store/trunk/cpp/tests/cluster/_st_cluster_basic.cpp (rev 0)
+++ store/trunk/cpp/tests/cluster/_st_cluster_basic.cpp 2009-04-17 20:13:06 UTC (rev 3307)
@@ -0,0 +1,199 @@
+/*
+ Copyright (c) 2007, 2008, 2009 Red Hat, Inc.
+
+ This file is part of the Qpid async store library msgstore.so.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser 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 library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ USA
+
+ The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#include "../unit_test.h"
+#include <boost/assign.hpp>
+#include <cstdlib>
+#include "ClusterFixture.h"
+
+#define SET_LOG_LEVEL(level) \
+ qpid::log::Options opts(""); \
+ opts.selectors.clear(); \
+ opts.selectors.push_back(level); \
+ qpid::log::Logger::instance().configure(opts);
+
+QPID_AUTO_TEST_SUITE(SimpleTests)
+
+// Timeout for tests that wait for messages
+const sys::Duration TIMEOUT=sys::TIME_SEC/4;
+
+const string test_filename("_st_cluster_basic");
+
+std::string getLibPath(const char* envName)
+{
+ const char* p = std::getenv(envName);
+ assert(p);
+ return p;
+}
+
+Message ttlMessage(const string& data, const string& key, uint64_t ttl) {
+ Message m(data, key);
+ m.getDeliveryProperties().setTtl(ttl);
+ return m;
+}
+
+vector<string> browse(Client& c, const string& q, int n) {
+ SubscriptionSettings browseSettings(
+ FlowControl::unlimited(),
+ ACCEPT_MODE_NONE,
+ ACQUIRE_MODE_NOT_ACQUIRED,
+ 0 // No auto-ack.
+ );
+ LocalQueue lq;
+ c.subs.subscribe(lq, q, browseSettings);
+ vector<string> result;
+ for (int i = 0; i < n; ++i) {
+ Message m;
+ if (!lq.get(m, TIMEOUT))
+ break;
+ result.push_back(m.getData());
+ }
+ c.subs.getSubscription(q).cancel();
+ return result;
+}
+
+QPID_AUTO_TEST_CASE(TestMessageEnqueue)
+{
+ SET_LOG_LEVEL("error+"); // This only needs to be set once.
+
+ cout << test_filename << ".TestMessageEnqueue: " << flush;
+ ClusterFixture::Args args = boost::assign::list_of<std::string>
+ ("--load-module")(getLibPath("LIBSTORE"))
+ ("--auth")("no")
+ ("TMP_DATA_DIR");
+ ClusterFixture cluster(2, -1, args, getLibPath("LIBCLUSTER"));
+ Client c0(cluster[0]);
+ c0.session.queueDeclare("q", arg::durable=true);
+ c0.session.messageTransfer(arg::content=Message("foo", "q"), arg::durable=true);
+ c0.session.messageTransfer(arg::content=Message("bar", "q"), arg::durable=true);
+ c0.session.close();
+ Client c1(cluster[1]);
+ Message msg;
+ BOOST_CHECK(c1.subs.get(msg, "q", TIMEOUT));
+ BOOST_CHECK_EQUAL(string("foo"), msg.getData());
+ BOOST_CHECK(c1.subs.get(msg, "q", TIMEOUT));
+ BOOST_CHECK_EQUAL(string("bar"), msg.getData());
+ cout << " done" << endl << flush;
+}
+
+QPID_AUTO_TEST_CASE(testMessageDequeue) {
+ cout << test_filename << ".testMessageDequeue: " << flush;
+ ClusterFixture::Args args = boost::assign::list_of<std::string>
+ ("--load-module")(getLibPath("LIBSTORE"))
+ ("--auth")("no")
+ ("TMP_DATA_DIR");
+
+ // Enqueue on one broker, dequeue on two others.
+ ClusterFixture cluster(3, -1, args, getLibPath("LIBCLUSTER"));
+ Client c0(cluster[0], "c0");
+ c0.session.queueDeclare("q", arg::durable=true);
+ c0.session.messageTransfer(arg::content=Message("foo", "q"), arg::durable=true);
+ c0.session.messageTransfer(arg::content=Message("bar", "q"), arg::durable=true);
+
+ Message msg;
+
+ // Dequeue on 2 others, ensure correct order.
+ Client c1(cluster[1], "c1");
+ BOOST_CHECK(c1.subs.get(msg, "q"));
+ BOOST_CHECK_EQUAL("foo", msg.getData());
+
+ Client c2(cluster[2], "c2");
+ BOOST_CHECK(c1.subs.get(msg, "q"));
+ BOOST_CHECK_EQUAL("bar", msg.getData());
+
+ // Queue should be empty on all cluster members.
+ BOOST_CHECK_EQUAL(0u, c0.session.queueQuery("q").getMessageCount());
+ BOOST_CHECK_EQUAL(0u, c1.session.queueQuery("q").getMessageCount());
+ BOOST_CHECK_EQUAL(0u, c2.session.queueQuery("q").getMessageCount());
+ cout << " done" << endl << flush;
+}
+
+QPID_AUTO_TEST_CASE(testDequeueWaitingSubscription) {
+ cout << test_filename << ".testDequeueWaitingSubscription: " << flush;
+ ClusterFixture::Args args = boost::assign::list_of<std::string>
+ ("--load-module")(getLibPath("LIBSTORE"))
+ ("--auth")("no")
+ ("TMP_DATA_DIR");
+
+ ClusterFixture cluster(3, -1, args, getLibPath("LIBCLUSTER"));
+ Client c0(cluster[0]);
+ BOOST_REQUIRE_EQUAL(knownBrokerPorts(c0.connection, 3).size(), 3u); // Wait for brokers.
+
+ // First start a subscription.
+ c0.session.queueDeclare("q", arg::durable=true);
+ c0.subs.subscribe(c0.lq, "q", FlowControl::messageCredit(2));
+
+ // Now send messages
+ Client c1(cluster[1]);
+ c1.session.messageTransfer(arg::content=Message("foo", "q"), arg::durable=true);
+ c1.session.messageTransfer(arg::content=Message("bar", "q"), arg::durable=true);
+
+ // Check they arrived
+ Message m;
+ BOOST_CHECK(c0.lq.get(m, TIMEOUT));
+ BOOST_CHECK_EQUAL("foo", m.getData());
+ BOOST_CHECK(c0.lq.get(m, TIMEOUT));
+ BOOST_CHECK_EQUAL("bar", m.getData());
+
+ // Queue should be empty on all cluster members.
+ Client c2(cluster[2]);
+ BOOST_CHECK_EQUAL(0u, c0.session.queueQuery("q").getMessageCount());
+ BOOST_CHECK_EQUAL(0u, c1.session.queueQuery("q").getMessageCount());
+ BOOST_CHECK_EQUAL(0u, c2.session.queueQuery("q").getMessageCount());
+ cout << " done" << endl << flush;
+}
+
+QPID_AUTO_TEST_CASE(testMessageTimeToLive) {
+ cout << test_filename << ".testMessageTimeToLive: " << flush;
+ ClusterFixture::Args args = boost::assign::list_of<std::string>
+ ("--load-module")(getLibPath("LIBSTORE"))
+ ("--auth")("no")
+ ("TMP_DATA_DIR");
+
+ // Note: this doesn't actually test for cluster race conditions around TTL,
+ // it just verifies that basic TTL functionality works.
+ //
+ ClusterFixture cluster(2, -1, args, getLibPath("LIBCLUSTER"));
+ Client c0(cluster[0], "c0");
+ Client c1(cluster[1], "c1");
+ c0.session.queueDeclare("p", arg::durable=true);
+ c0.session.queueDeclare("q", arg::durable=true);
+ c0.session.messageTransfer(arg::content=ttlMessage("a", "q", 200), arg::durable=true);
+ c0.session.messageTransfer(arg::content=Message("b", "q"), arg::durable=true);
+ c0.session.messageTransfer(arg::content=ttlMessage("x", "p", 10000), arg::durable=true);
+ c0.session.messageTransfer(arg::content=Message("y", "p"), arg::durable=true);
+ cluster.add();
+ Client c2(cluster[1], "c2");
+
+ BOOST_CHECK_EQUAL(browse(c0, "p", 2), boost::assign::list_of<string>("x")("y"));
+ BOOST_CHECK_EQUAL(browse(c1, "p", 2), boost::assign::list_of<string>("x")("y"));
+ BOOST_CHECK_EQUAL(browse(c2, "p", 2), boost::assign::list_of<string>("x")("y"));
+
+ sys::usleep(200*1000);
+ BOOST_CHECK_EQUAL(browse(c0, "q", 1), boost::assign::list_of<string>("b"));
+ BOOST_CHECK_EQUAL(browse(c1, "q", 1), boost::assign::list_of<string>("b"));
+ BOOST_CHECK_EQUAL(browse(c2, "q", 1), boost::assign::list_of<string>("b"));
+ cout << " done" << endl << flush;
+}
+
+QPID_AUTO_TEST_SUITE_END()
Added: store/trunk/cpp/tests/cluster/run_cluster_tests
===================================================================
--- store/trunk/cpp/tests/cluster/run_cluster_tests (rev 0)
+++ store/trunk/cpp/tests/cluster/run_cluster_tests 2009-04-17 20:13:06 UTC (rev 3307)
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# Copyright (c) 2008, 2009 Red Hat, Inc.
+#
+# This file is part of the Qpid async store library msgstore.so.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser 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 library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+# USA
+#
+# The GNU Lesser General Public License is available in the file COPYING.
+
+srcdir=`dirname $0`
+
+# Check AIS requirements and run tests if found.
+id -nG | grep '\<ais\>' >/dev/null || \
+ NOGROUP="You are not a member of the ais group."
+ps -u root | grep 'aisexec\|corosync' >/dev/null || \
+ NOAISEXEC="The aisexec or corosync daemon is not running as root"
+
+if test -n "$NOGROUP" -o -n "$NOAISEXEC"; then
+ cat <<EOF
+
+ =========== WARNING: NOT RUNNING AIS TESTS ==============
+
+ Tests that depend on the openais library (used for clustering)
+ will not be run because:
+
+ $NOGROUP
+ $NOAISEXEC
+
+ ==========================================================
+
+EOF
+ exit 0; # A warning, not a failure.
+fi
+
+# Execute command with the ais group set.
+with_ais_group() {
+ id -nG | grep '\<ais\>' >/dev/null || { echo "You are not a member of the ais group."; exit 1; }
+ echo $* | newgrp ais
+}
+
+# Run the tests
+srcdir=`dirname $0`
+with_ais_group ./_st_cluster_basic || ERROR=1
+exit $ERROR
Property changes on: store/trunk/cpp/tests/cluster/run_cluster_tests
___________________________________________________________________
Name: svn:executable
+ *
More information about the rhmessaging-commits
mailing list