Author: kpvdr
Date: 2008-05-30 14:59:09 -0400 (Fri, 30 May 2008)
New Revision: 2098
Modified:
store/trunk/cpp/lib/jrnl/jinf.cpp
store/trunk/cpp/tests/Makefile.am
store/trunk/cpp/tests/OrderingTest.cpp
store/trunk/cpp/tests/SimpleTest.cpp
store/trunk/cpp/tests/TransactionalTest.cpp
store/trunk/cpp/tests/TwoPhaseCommitTest.cpp
store/trunk/cpp/tests/clean.sh
store/trunk/cpp/tests/jrnl/Makefile.am
store/trunk/cpp/tests/jrnl/_st_basic.cpp
store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp
store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
store/trunk/cpp/tests/jrnl/_st_read.cpp
store/trunk/cpp/tests/jrnl/_st_read_txn.cpp
store/trunk/cpp/tests/jrnl/_ut_jdir.cpp
store/trunk/cpp/tests/jrnl/_ut_jinf.cpp
store/trunk/cpp/tests/jrnl/jtt/Makefile.am
store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp
store/trunk/cpp/tests/jrnl/jtt/args.cpp
store/trunk/cpp/tests/jrnl/jtt/args.hpp
store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp
store/trunk/cpp/tests/jrnl/run-journal-tests
store/trunk/cpp/tests/system_test.sh
Log:
Fixes for BZ446207: "[Journal] Unify and clean up test dir locations for journal
tests". All tests that write to disk now happen in a subdir of the local test
directory, and not in /tmp. When tests in a directory are complete, the test subdir is
deleted. This should eliminate the probems of 1) accumulating journals in /tmp/jdata; 2)
Two testers on the same box stomping on each others test dirs. TODO: prevent deletion of
test subdir for debug purposes in event of a test failure - right now the clean-up happens
unconditionally.
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -191,7 +191,7 @@
oss << _jdir << "/" << _base_filename <<
"." << JRNL_INFO_EXTENSION;
std::ofstream of(oss.str().c_str(), std::ofstream::out | std::ofstream::trunc);
if (!of.good())
- throw jexception(jerrno::JERR__FILEIO, oss.str(), "jcntl",
"write_infofile");
+ throw jexception(jerrno::JERR__FILEIO, oss.str(), "jinf",
"write");
of << xml_str();
of.close();
}
Modified: store/trunk/cpp/tests/Makefile.am
===================================================================
--- store/trunk/cpp/tests/Makefile.am 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/Makefile.am 2008-05-30 18:59:09 UTC (rev 2098)
@@ -1,20 +1,21 @@
abs_builddir=@abs_builddir@
abs_srcdir=@abs_srcdir@
-AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS) $(QPID_CXXFLAGS) \
- $(CPPUNIT_CXXFLAGS) -DBOOST_TEST_DYN_LINK
+AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS) $(QPID_CXXFLAGS) -DBOOST_TEST_DYN_LINK
INCLUDES=-I$(top_srcdir)/lib -I$(top_srcdir)/lib/gen
+TMPDIR=$(abs_srcdir)/test_tmp
+
SUBDIRS = jrnl .
TESTS = \
- clean.sh \
SimpleTest \
OrderingTest \
TransactionalTest \
TwoPhaseCommitTest \
- system_test.sh
+ system_test.sh \
+ clean.sh
check_PROGRAMS = \
SimpleTest \
@@ -38,12 +39,13 @@
$@-t
mv $@-t $@
-EXTRA_DIST = start_broker stop_broker clean.sh system_test.sh persistence.py
MessageUtils.h run_test vg_check .valgrindrc .valgrind.supp
+EXTRA_DIST = start_broker stop_broker system_test.sh persistence.py MessageUtils.h
run_test vg_check .valgrindrc .valgrind.supp
TESTS_ENVIRONMENT = \
QPID_DIR=$(QPID_DIR) \
VALGRIND=$(VALGRIND) \
abs_srcdir=$(abs_srcdir) \
LIBBDBSTORE=$(abs_builddir)/../lib/.libs/libbdbstore.so \
+ TMPDIR=$(TMPDIR) \
$(srcdir)/run_test
Modified: store/trunk/cpp/tests/OrderingTest.cpp
===================================================================
--- store/trunk/cpp/tests/OrderingTest.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/OrderingTest.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -34,8 +34,6 @@
#include <qpid/broker/RecoveryManagerImpl.h>
#include <qpid/framing/AMQHeaderBody.h>
-#define TESTDIR "/tmp"
-
using namespace qpid::broker;
using namespace qpid::framing;
using namespace rhm::bdbstore;
@@ -43,6 +41,8 @@
QPID_AUTO_TEST_SUITE(OrderingTest)
const std::string test_filename("OrderingTest");
+const char* tdp = getenv("TMPDIR");
+const string test_dir(tdp && strlen(tdp) > 0 ? tdp :
"/tmp/OrderingTest");
// === Helper fns ===
@@ -56,7 +56,7 @@
void setup(bool async)
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init(TESTDIR, async, true, 4, 1, 8);
+ store->init(test_dir, async, true, 4, 1, 8);
store->truncate();
queue = Queue::shared_ptr(new Queue(name, 0, store.get(), 0));
@@ -94,7 +94,7 @@
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init(TESTDIR, async, false, 4, 1, 8);
+ store->init(test_dir, async, false, 4, 1, 8);
ExchangeRegistry exchanges;
LinkRegistry links(0);
DtxManager mgr;
Modified: store/trunk/cpp/tests/SimpleTest.cpp
===================================================================
--- store/trunk/cpp/tests/SimpleTest.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/SimpleTest.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -35,8 +35,6 @@
#include <qpid/framing/AMQHeaderBody.h>
#include <qpid/framing/FieldTable.h>
-#define TESTDIR "/tmp"
-
using boost::intrusive_ptr;
using boost::static_pointer_cast;
using namespace qpid;
@@ -48,6 +46,8 @@
QPID_AUTO_TEST_SUITE(SimpleTest)
const string test_filename("SimpleTest");
+const char* tdp = getenv("TMPDIR");
+const string test_dir(tdp && strlen(tdp) > 0 ? tdp :
"/tmp/SimpleTest");
// === Helper fns ===
@@ -85,7 +85,7 @@
void testCreateDelete(bool async)
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
string name("CreateDeleteQueue");
Queue queue(name, 0, &store, 0);
@@ -100,7 +100,7 @@
void testEmptyRecover(bool async)
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
QueueRegistry registry;
registry.setStore (&store);
@@ -114,7 +114,7 @@
string name("MyDurableQueue");
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
store.create(queue, qpid::framing::FieldTable());
@@ -123,7 +123,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
QueueRegistry registry;
registry.setStore (&store);
recover(store, registry);
@@ -139,7 +139,7 @@
string name("MyDurableQueue");
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
FieldTable settings;
@@ -149,7 +149,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
QueueRegistry registry;
registry.setStore (&store);
recover(store, registry);
@@ -166,7 +166,7 @@
string name("MyDurableQueue");
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
store.create(queue, qpid::framing::FieldTable());
@@ -174,7 +174,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
QueueRegistry registry;
registry.setStore (&store);
recover(store, registry);
@@ -196,7 +196,7 @@
string data2("hijklmn");
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
Queue::shared_ptr queue(new Queue(name, 0, &store, 0));
FieldTable settings;
@@ -215,7 +215,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
QueueRegistry registry;
registry.setStore (&store);
recover(store, registry);
@@ -252,7 +252,7 @@
Uuid messageId(true);
string data("abcdefg");
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
Queue::shared_ptr queue(new Queue(name, 0, &store, 0));
FieldTable settings;
@@ -267,7 +267,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
QueueRegistry registry;
registry.setStore (&store);
recover(store, registry);
@@ -287,7 +287,7 @@
const string data2("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
//create & stage a message
@@ -329,7 +329,7 @@
{
//recover
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
QueueRegistry registry;
registry.setStore (&store);
ExchangeRegistry exchanges;
@@ -377,7 +377,7 @@
void testDestroyStagedMessage(bool async)
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
const string data("abcdefg");
@@ -401,7 +401,7 @@
void testDestroyEnqueuedMessage(bool async)
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
const string data("abcdefg");
@@ -433,7 +433,7 @@
args.setString("a", "A");
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
ExchangeRegistry registry;
Exchange::shared_ptr exchange = registry.declare(name, type, true, args).first;
@@ -443,7 +443,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
ExchangeRegistry registry;
recover(store, registry);
@@ -457,7 +457,7 @@
}
{
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
ExchangeRegistry registry;
recover(store, registry);
@@ -476,7 +476,7 @@
{
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
Exchange::shared_ptr exchange(new DirectExchange(exchangeName, true, args));
Queue::shared_ptr queue(new Queue(queueName, 0, &store, 0));
@@ -487,7 +487,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
ExchangeRegistry exchanges;
QueueRegistry queues;
LinkRegistry links(0);
@@ -502,7 +502,7 @@
}
{
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
ExchangeRegistry exchanges;
QueueRegistry queues;
LinkRegistry links(0);
@@ -538,7 +538,7 @@
FieldTable args;
{
BdbMessageStore store;
- store.init(TESTDIR, async, true, 4, 1, 8);
+ store.init(test_dir, async, true, 4, 1, 8);
store.truncate();//make sure it is empty to begin with
Exchange::shared_ptr exchange(new DirectExchange(exchangeName, true, args));
Queue::shared_ptr queue1(new Queue(queueName1, 0, &store, 0));
@@ -553,7 +553,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
ExchangeRegistry exchanges;
QueueRegistry queues;
LinkRegistry links(0);
@@ -570,7 +570,7 @@
}
{
BdbMessageStore store;
- store.init(TESTDIR, async, false, 4, 1, 8);
+ store.init(test_dir, async, false, 4, 1, 8);
ExchangeRegistry exchanges;
QueueRegistry queues;
LinkRegistry links(0);
Modified: store/trunk/cpp/tests/TransactionalTest.cpp
===================================================================
--- store/trunk/cpp/tests/TransactionalTest.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/TransactionalTest.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -34,8 +34,6 @@
#include <qpid/broker/Queue.h>
#include <qpid/broker/RecoveryManagerImpl.h>
-#define TESTDIR "/tmp"
-
using namespace rhm::bdbstore;
using namespace qpid::broker;
using namespace qpid::framing;
@@ -44,6 +42,8 @@
QPID_AUTO_TEST_SUITE(TransactionalTest)
const string test_filename("TransactionalTest");
+const char* tdp = getenv("TMPDIR");
+const string test_dir(tdp && strlen(tdp) > 0 ? tdp :
"/tmp/TransactionalTest");
// === Helper fns ===
@@ -58,7 +58,7 @@
void setup(bool async)
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init(TESTDIR, async, true, 4, 1, 8);
+ store->init(test_dir, async, true, 4, 1, 8);
store->truncate();
//create two queues:
@@ -82,7 +82,7 @@
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init(TESTDIR, async, false, 4, 1, 8);
+ store->init(test_dir, async, false, 4, 1, 8);
ExchangeRegistry exchanges;
LinkRegistry links(0);
DtxManager mgr;
Modified: store/trunk/cpp/tests/TwoPhaseCommitTest.cpp
===================================================================
--- store/trunk/cpp/tests/TwoPhaseCommitTest.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/TwoPhaseCommitTest.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -34,8 +34,6 @@
#include <qpid/broker/Queue.h>
#include <qpid/broker/RecoveryManagerImpl.h>
-#define TESTDIR "/tmp"
-
using namespace rhm::bdbstore;
using namespace qpid::broker;
using namespace qpid::framing;
@@ -44,6 +42,8 @@
QPID_AUTO_TEST_SUITE(TwoPhaseCommitTest)
const string test_filename("TwoPhaseCommitTest");
+const char* tdp = getenv("TMPDIR");
+string test_dir(tdp && strlen(tdp) > 0 ? tdp :
"/tmp/TwoPhaseCommitTest");
// === Helper fns ===
@@ -221,7 +221,7 @@
void setup()
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init(TESTDIR, async, true, 4, 1, 8);
+ store->init(test_dir, async, true, 4, 1, 8);
store->truncate();
//create two queues:
@@ -247,7 +247,7 @@
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init(TESTDIR, async, false, 4, 1, 8);
+ store->init(test_dir, async, false, 4, 1, 8);
ExchangeRegistry exchanges;
dtxmgr = std::auto_ptr<DtxManager>(new DtxManager);
dtxmgr->setStore (store.get());
Modified: store/trunk/cpp/tests/clean.sh
===================================================================
--- store/trunk/cpp/tests/clean.sh 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/clean.sh 2008-05-30 18:59:09 UTC (rev 2098)
@@ -25,8 +25,6 @@
# be run prior to the store system tests, as these are prone to crashing or
# hanging under some circumstances if the database is old or inconsistent.
-WORKING_DIR=/tmp
-
-if [ -d ${WORKING_DIR}/rhm ]; then
- rm -rf ${WORKING_DIR}/rhm/*
+if [ -d ${TMPDIR} ]; then
+ rm -rf ${TMPDIR}
fi
Modified: store/trunk/cpp/tests/jrnl/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.am 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/Makefile.am 2008-05-30 18:59:09 UTC (rev 2098)
@@ -20,15 +20,19 @@
# The GNU Lesser General Public License is available in the file COPYING.
abs_builddir=@abs_builddir@
+abs_srcdir=@abs_srcdir@
-AM_CXXFLAGS = $(WARNING_CFLAGS) $(CPPUNIT_CXXFLAGS) $(QPID_CXXFLAGS) -pthread
-DBOOST_TEST_DYN_LINK
+AM_CXXFLAGS = $(WARNING_CFLAGS) -pthread -DBOOST_TEST_DYN_LINK
INCLUDES=-I$(top_srcdir)/lib
+TMPDIR=$(abs_srcdir)/test_tmp
+
SUBDIRS = jtt .
-TESTS_ENVIRONMENT = \
- VALGRIND=$(VALGRIND) \
+TESTS_ENVIRONMENT = \
+ VALGRIND=$(VALGRIND) \
+ TMPDIR=$(TMPDIR) \
$(srcdir)/../run_test
all-local: .valgrindrc .valgrind.supp
@@ -43,15 +47,16 @@
_ut_jexception \
_ut_jerrno \
_ut_rec_hdr \
+ _ut_jdir \
_ut_jinf \
- _ut_jdir \
_ut_enq_map \
_ut_txn_map \
_st_basic \
_st_basic_txn \
_st_read \
_st_read_txn \
- run-journal-tests
+ run-journal-tests \
+ ../clean.sh
check_PROGRAMS = \
_ut_time_ns \
@@ -72,16 +77,16 @@
UNIT_TEST_LDADD = -lboost_unit_test_framework ${top_builddir}/lib/libbdbstore.la
_ut_time_ns_SOURCES = _ut_time_ns.cpp $(UNIT_TEST_SRCS)
-_ut_time_ns_LDFLAGS = $(UNIT_TEST_LDADD)
+_ut_time_ns_LDADD = $(UNIT_TEST_LDADD)
_ut_arr_cnt_SOURCES = _ut_arr_cnt.cpp $(UNIT_TEST_SRCS)
-_ut_arr_cnt_LDFLAGS = $(UNIT_TEST_LDADD)
+_ut_arr_cnt_LDADD = $(UNIT_TEST_LDADD) -lrt
_ut_jexception_SOURCES = _ut_jexception.cpp $(UNIT_TEST_SRCS)
-_ut_jexception_LDFLAGS = $(UNIT_TEST_LDADD)
+_ut_jexception_LDADD = $(UNIT_TEST_LDADD) -lrt
_ut_jerrno_SOURCES = _ut_jerrno.cpp $(UNIT_TEST_SRCS)
-_ut_jerrno_LDADD = $(UNIT_TEST_LDADD)
+_ut_jerrno_LDADD = $(UNIT_TEST_LDADD) -lrt
_ut_rec_hdr_SOURCES = _ut_rec_hdr.cpp $(UNIT_TEST_SRCS)
_ut_rec_hdr_LDADD = $(UNIT_TEST_LDADD) -lrt
Modified: store/trunk/cpp/tests/jrnl/_st_basic.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_basic.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/_st_basic.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -50,7 +50,7 @@
string test_name = get_test_name(test_filename, "instantiation");
try
{
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -62,7 +62,7 @@
string test_name = get_test_name(test_filename, "initialization");
try
{
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
BOOST_CHECK_EQUAL(jc.is_ready(), true);
@@ -78,7 +78,7 @@
{
string msg;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
BOOST_CHECK_EQUAL(enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false),
u_int64_t(m));
@@ -96,7 +96,7 @@
{
string msg;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<2*NUM_MSGS; m+=2)
{
@@ -115,7 +115,7 @@
{
string msg;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
unsigned n = num_msgs_to_full(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS *
JRNL_SBLK_SIZE,
MSG_REC_SIZE_DBLKS, true);
@@ -136,7 +136,7 @@
try
{
{
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
BOOST_CHECK_EQUAL(jc.is_read_only(), false);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
@@ -147,7 +147,7 @@
vector<string> txn_list;
u_int64_t hrid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
BOOST_CHECK_EQUAL(jc.is_read_only(), false);
jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
@@ -159,7 +159,7 @@
vector<string> txn_list;
u_int64_t hrid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
BOOST_CHECK_EQUAL(jc.is_read_only(), false);
jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
@@ -183,7 +183,7 @@
{
string msg;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
@@ -192,7 +192,7 @@
vector<string> txn_list;
u_int64_t hrid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
jc.recover_complete();
@@ -216,7 +216,7 @@
for (int m=0; m<2*NUM_MSGS; m+=2)
{
{
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
if (m == 0)
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS); // First time
only
else
@@ -228,7 +228,7 @@
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
}
{
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(m));
jc.recover_complete();
@@ -248,7 +248,7 @@
{
string msg;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
// Transient msgs - should not recover
for (int m=0; m<NUM_MSGS; m++)
@@ -268,7 +268,7 @@
vector<string> txn_list;
u_int64_t hrid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
// Recover non-transient msgs
for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
@@ -343,7 +343,7 @@
{
string msg;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
unsigned m;
@@ -379,7 +379,7 @@
{
string msg;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
unsigned m;
@@ -408,7 +408,7 @@
{
string msg;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
u_int64_t rid = enq_msg(jc, 0, create_msg(msg, 0, MSG_SIZE), false);
deq_msg(jc, rid);
Modified: store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -53,7 +53,7 @@
string msg;
string xid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
@@ -75,7 +75,7 @@
string msg;
string xid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
@@ -104,7 +104,7 @@
string msg;
string xid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
@@ -127,7 +127,7 @@
string msg;
string xid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
@@ -155,7 +155,7 @@
string msg;
string xid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
@@ -177,7 +177,7 @@
string msg;
string xid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
@@ -199,7 +199,7 @@
string msg;
string xid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
@@ -222,7 +222,7 @@
string msg;
string xid;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
Modified: store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -32,7 +32,6 @@
#define MAX_AIO_SLEEPS 500
#define AIO_SLEEP_TIME 1000
-#define JRNL_DIR "/tmp/jdata"
#define NUM_TEST_JFILES 4
#define NUM_DEFAULT_JFILES 8
#define JRNL_DEFAULT_FSIZE 24 // Multiples of JRNL_RMGR_PAGE_SIZE
@@ -49,6 +48,9 @@
#define XLARGE_MSG_RATIO (1.0 * LARGE_MSG_REC_SIZE / JRNL_DBLK_SIZE / JRNL_SBLK_SIZE /
JRNL_RMGR_PAGE_SIZE)
#define XLARGE_MSG_THRESHOLD (int)(JRNL_DEFAULT_FSIZE * NUM_DEFAULT_JFILES *
JRNL_ENQ_THRESHOLD / 100 / LARGE_MSG_RATIO)
+const char* tdp = getenv("TMPDIR");
+const string test_dir(tdp && strlen(tdp) > 0 ? tdp :
"/tmp/_ut_jdir");
+
class test_dtok : public data_tok
{
private:
Modified: store/trunk/cpp/tests/jrnl/_st_read.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_read.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/_st_read.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -57,7 +57,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
@@ -76,7 +76,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
@@ -109,7 +109,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<2*NUM_MSGS; m+=2)
{
@@ -137,7 +137,7 @@
{
string msg;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
@@ -151,7 +151,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
jc.recover_complete();
@@ -180,7 +180,7 @@
{
string msg;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
@@ -194,7 +194,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
for (int m=0; m<NUM_MSGS; m++)
@@ -216,7 +216,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
for (int m=0; m<NUM_MSGS; m++)
@@ -257,7 +257,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
unsigned m;
for (m=0; m<2*NUM_MSGS; m+=2)
@@ -285,7 +285,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
unsigned m;
unsigned read_buffer_size_dblks = JRNL_RMGR_PAGES * JRNL_RMGR_PAGE_SIZE *
JRNL_SBLK_SIZE;
@@ -315,7 +315,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
unsigned read_buffer_size_dblks = JRNL_RMGR_PAGES * JRNL_RMGR_PAGE_SIZE *
JRNL_SBLK_SIZE;
unsigned n = num_msgs_to_full(1, read_buffer_size_dblks, MSG_REC_SIZE_DBLKS,
true);
Modified: store/trunk/cpp/tests/jrnl/_st_read_txn.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_read_txn.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/_st_read_txn.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -57,7 +57,7 @@
string rxid;
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
@@ -92,7 +92,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
@@ -124,7 +124,7 @@
string rxid;
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 1, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
@@ -151,7 +151,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
@@ -180,7 +180,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 2, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
@@ -207,7 +207,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
@@ -236,7 +236,7 @@
bool externalFlag;
create_xid(xid, 3, XID_SIZE);
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
@@ -264,7 +264,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<3*NUM_MSGS; m+=3)
{
@@ -295,7 +295,7 @@
bool externalFlag;
create_xid(xid, 4, XID_SIZE);
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
@@ -331,7 +331,7 @@
bool transientFlag;
bool externalFlag;
- test_jrnl jc(test_name, JRNL_DIR, test_name);
+ test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<3*NUM_MSGS; m+=3)
{
Modified: store/trunk/cpp/tests/jrnl/_ut_jdir.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_jdir.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/_ut_jdir.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -55,6 +55,8 @@
QPID_AUTO_TEST_SUITE(jdir_suite)
const string test_filename("_ut_jdir");
+const char* tdp = getenv("TMPDIR");
+const string test_dir(tdp && strlen(tdp) > 0 ? tdp :
"/tmp/_ut_jdir");
// === Helper functions ===
@@ -68,6 +70,11 @@
::chmod(filename, fmode);
}
+void create_file(const string filename, mode_t fmode = S_IRUSR | S_IWUSR | S_IRGRP |
S_IROTH)
+{
+ create_file(filename.c_str(), fmode);
+}
+
void create_jdat_file(const char* dirname, const char* base_filename, u_int32_t fid,
u_int64_t first_rid)
{
@@ -178,12 +185,17 @@
BOOST_FAIL("Unable to remove directory " << dirname);
}
+void check_dir_not_existing(const string dirname)
+{
+ check_dir_not_existing(dirname.c_str());
+}
+
// === Test suite ===
QPID_AUTO_TEST_CASE(constructor)
{
cout << test_filename << ".constructor: " << flush;
- string dir("/tmp/A/B/C/D/E/F");
+ string dir(test_dir + "/A/B/C/D/E/F");
string bfn("test_base");
jdir dir1(dir, bfn);
BOOST_CHECK(dir1.dirname().compare(dir) == 0);
@@ -195,9 +207,9 @@
{
cout << test_filename << ".create_delete_dir: " <<
flush;
// Use instance
- string dir_A("/tmp/A");
- string dir_Ats("/tmp/A/"); // trailing '/'
- check_dir_not_existing("/tmp/A");
+ string dir_A(test_dir + "/A");
+ string dir_Ats(test_dir + "/A/"); // trailing '/'
+ check_dir_not_existing(test_dir + "/A");
jdir dir1(dir_A, "test_base");
dir1.create_dir();
// check all combos of jdir::exists and jdir::is_dir()
@@ -216,33 +228,33 @@
BOOST_CHECK(!jdir::exists(dir_A));
// Use static fn
- check_dir_not_existing("/tmp/B");
- jdir::create_dir("/tmp/B");
- BOOST_CHECK(jdir::is_dir("/tmp/B"));
- jdir::create_dir("/tmp/B");
- BOOST_CHECK(jdir::is_dir("/tmp/B"));
- jdir::delete_dir("/tmp/B");
- BOOST_CHECK(!jdir::exists("/tmp/B"));
+ check_dir_not_existing(test_dir + "/B");
+ jdir::create_dir(test_dir + "/B");
+ BOOST_CHECK(jdir::is_dir(test_dir + "/B"));
+ jdir::create_dir(test_dir + "/B");
+ BOOST_CHECK(jdir::is_dir(test_dir + "/B"));
+ jdir::delete_dir(test_dir + "/B");
+ BOOST_CHECK(!jdir::exists(test_dir + "/B"));
// Non-empty dirs
- check_dir_not_existing("/tmp/C");
- jdir::create_dir("/tmp/C");
- BOOST_CHECK(jdir::is_dir("/tmp/C"));
- create_file("/tmp/C/test_file_1.txt"); // mode 644 (default)
- create_file("/tmp/C/test_file_2.txt", S_IRWXU | S_IRWXG | S_IRWXO); // mode
777
- create_file("/tmp/C/test_file_3.txt", S_IRUSR | S_IRGRP | S_IROTH); // mode
444 (read-only)
- create_file("/tmp/C/test_file_4.txt", 0); // mode 000 (no permissions)
- BOOST_CHECK(jdir::is_dir("/tmp/C"));
- jdir::create_dir("/tmp/C");
- BOOST_CHECK(jdir::is_dir("/tmp/C"));
- jdir::delete_dir("/tmp/C");
- BOOST_CHECK(!jdir::exists("/tmp/C"));
+ check_dir_not_existing(test_dir + "/C");
+ jdir::create_dir(test_dir + "/C");
+ BOOST_CHECK(jdir::is_dir(test_dir + "/C"));
+ create_file(test_dir + "/C/test_file_1.txt"); // mode 644 (default)
+ create_file(test_dir + "/C/test_file_2.txt", S_IRWXU | S_IRWXG | S_IRWXO);
// mode 777
+ create_file(test_dir + "/C/test_file_3.txt", S_IRUSR | S_IRGRP | S_IROTH);
// mode 444 (read-only)
+ create_file(test_dir + "/C/test_file_4.txt", 0); // mode 000 (no
permissions)
+ BOOST_CHECK(jdir::is_dir(test_dir + "/C"));
+ jdir::create_dir(test_dir + "/C");
+ BOOST_CHECK(jdir::is_dir(test_dir + "/C"));
+ jdir::delete_dir(test_dir + "/C");
+ BOOST_CHECK(!jdir::exists(test_dir + "/C"));
// Check non-existent dirs fail
- check_dir_not_existing("/tmp/D");
+ check_dir_not_existing(test_dir + "/D");
try
{
- jdir::is_dir("/tmp/D");
+ jdir::is_dir(test_dir + "/D");
BOOST_ERROR("jdir::is_dir() failed to throw jexeption for non-existent
directory.");
}
catch(const jexception& e)
@@ -256,67 +268,67 @@
{
cout << test_filename << ".create_delete_dir_recursive: "
<< flush;
// Use instances
- check_dir_not_existing("/tmp/E");
- jdir dir1("/tmp/E/F/G/H", "test_base");
+ check_dir_not_existing(test_dir + "/E");
+ jdir dir1(test_dir + "/E/F/G/H", "test_base");
dir1.create_dir();
- BOOST_CHECK(jdir::is_dir("/tmp/E/F/G/H"));
+ BOOST_CHECK(jdir::is_dir(test_dir + "/E/F/G/H"));
dir1.delete_dir();
- BOOST_CHECK(!jdir::exists("/tmp/E/F/G/H")); // only H deleted, E/F/G
remain
- BOOST_CHECK(jdir::exists("/tmp/E"));
- jdir::delete_dir("/tmp/E"); // delete remaining dirs
- BOOST_CHECK(!jdir::exists("/tmp/E"));
+ BOOST_CHECK(!jdir::exists(test_dir + "/E/F/G/H")); // only H deleted, E/F/G
remain
+ BOOST_CHECK(jdir::exists(test_dir + "/E"));
+ jdir::delete_dir(test_dir + "/E"); // delete remaining dirs
+ BOOST_CHECK(!jdir::exists(test_dir + "/E"));
- check_dir_not_existing("/tmp/F");
- jdir dir2("/tmp/F/G/H/I/", "test_base"); // trailing '/'
+ check_dir_not_existing(test_dir + "/F");
+ jdir dir2(test_dir + "/F/G/H/I/", "test_base"); // trailing
'/'
dir2.create_dir();
- BOOST_CHECK(jdir::is_dir("/tmp/F/G/H/I/"));
+ BOOST_CHECK(jdir::is_dir(test_dir + "/F/G/H/I/"));
dir2.delete_dir();
- BOOST_CHECK(!jdir::exists("/tmp/F/G/H/I/"));
- BOOST_CHECK(jdir::exists("/tmp/F"));
- jdir::delete_dir("/tmp/F");
- BOOST_CHECK(!jdir::exists("/tmp/F"));
+ BOOST_CHECK(!jdir::exists(test_dir + "/F/G/H/I/"));
+ BOOST_CHECK(jdir::exists(test_dir + "/F"));
+ jdir::delete_dir(test_dir + "/F");
+ BOOST_CHECK(!jdir::exists(test_dir + "/F"));
// Use static fn
- check_dir_not_existing("/tmp/G");
- jdir::create_dir("/tmp/G/H/I/J");
- BOOST_CHECK(jdir::is_dir("/tmp/G/H/I/J"));
- jdir::delete_dir("/tmp/G/H/I/J");
- BOOST_CHECK(!jdir::exists("/tmp/G/H/I/J"));
- BOOST_CHECK(jdir::exists("/tmp/G"));
- jdir::delete_dir("/tmp/G");
- BOOST_CHECK(!jdir::exists("/tmp/G"));
+ check_dir_not_existing(test_dir + "/G");
+ jdir::create_dir(test_dir + "/G/H/I/J");
+ BOOST_CHECK(jdir::is_dir(test_dir + "/G/H/I/J"));
+ jdir::delete_dir(test_dir + "/G/H/I/J");
+ BOOST_CHECK(!jdir::exists(test_dir + "/G/H/I/J"));
+ BOOST_CHECK(jdir::exists(test_dir + "/G"));
+ jdir::delete_dir(test_dir + "/G");
+ BOOST_CHECK(!jdir::exists(test_dir + "/G"));
- check_dir_not_existing("/tmp/H");
- jdir::create_dir("/tmp/H/I/J/K/");
- BOOST_CHECK(jdir::is_dir("/tmp/H/I/J/K/"));
- jdir::delete_dir("/tmp/H/I/J/K/");
- BOOST_CHECK(!jdir::exists("/tmp/H/I/J/K/"));
- BOOST_CHECK(jdir::exists("/tmp/H"));
- jdir::delete_dir("/tmp/H");
- BOOST_CHECK(!jdir::exists("/tmp/H"));
+ check_dir_not_existing(test_dir + "/H");
+ jdir::create_dir(test_dir + "/H/I/J/K/");
+ BOOST_CHECK(jdir::is_dir(test_dir + "/H/I/J/K/"));
+ jdir::delete_dir(test_dir + "/H/I/J/K/");
+ BOOST_CHECK(!jdir::exists(test_dir + "/H/I/J/K/"));
+ BOOST_CHECK(jdir::exists(test_dir + "/H"));
+ jdir::delete_dir(test_dir + "/H");
+ BOOST_CHECK(!jdir::exists(test_dir + "/H"));
// Non-empty dirs
- check_dir_not_existing("/tmp/I");
- jdir::create_dir("/tmp/I/J/K1/L1");
- jdir::create_dir("/tmp/I/J/K1/L2");
- jdir::create_dir("/tmp/I/J/K1/L3");
- jdir::create_dir("/tmp/I/J/K1/L4");
- create_file("/tmp/I/J/K1/L4/test_file_1.txt"); // mode 644 (default)
- create_file("/tmp/I/J/K1/L4/test_file_2.txt", S_IRWXU | S_IRWXG | S_IRWXO);
// mode 777
- create_file("/tmp/I/J/K1/L4/test_file_3.txt", S_IRUSR | S_IRGRP | S_IROTH);
// mode 444
- create_file("/tmp/I/J/K1/L4/test_file_4.txt", 0); // mode 000 (no
permissions)
- jdir::create_dir("/tmp/I/J/K2");
- jdir::create_dir("/tmp/I/J/K3/L5");
- jdir::create_dir("/tmp/I/J/K3/L6");
- BOOST_CHECK(jdir::is_dir("/tmp/I/J/K1/L1"));
- BOOST_CHECK(jdir::is_dir("/tmp/I/J/K1/L2"));
- BOOST_CHECK(jdir::is_dir("/tmp/I/J/K1/L3"));
- BOOST_CHECK(jdir::is_dir("/tmp/I/J/K1/L4"));
- BOOST_CHECK(jdir::is_dir("/tmp/I/J/K2"));
- BOOST_CHECK(jdir::is_dir("/tmp/I/J/K3/L5"));
- BOOST_CHECK(jdir::is_dir("/tmp/I/J/K3/L6"));
- jdir::delete_dir("/tmp/I");
- BOOST_CHECK(!jdir::exists("/tmp/I"));
+ check_dir_not_existing(test_dir + "/I");
+ jdir::create_dir(test_dir + "/I/J/K1/L1");
+ jdir::create_dir(test_dir + "/I/J/K1/L2");
+ jdir::create_dir(test_dir + "/I/J/K1/L3");
+ jdir::create_dir(test_dir + "/I/J/K1/L4");
+ create_file(test_dir + "/I/J/K1/L4/test_file_1.txt"); // mode 644
(default)
+ create_file(test_dir + "/I/J/K1/L4/test_file_2.txt", S_IRWXU | S_IRWXG |
S_IRWXO); // mode 777
+ create_file(test_dir + "/I/J/K1/L4/test_file_3.txt", S_IRUSR | S_IRGRP |
S_IROTH); // mode 444
+ create_file(test_dir + "/I/J/K1/L4/test_file_4.txt", 0); // mode 000 (no
permissions)
+ jdir::create_dir(test_dir + "/I/J/K2");
+ jdir::create_dir(test_dir + "/I/J/K3/L5");
+ jdir::create_dir(test_dir + "/I/J/K3/L6");
+ BOOST_CHECK(jdir::is_dir(test_dir + "/I/J/K1/L1"));
+ BOOST_CHECK(jdir::is_dir(test_dir + "/I/J/K1/L2"));
+ BOOST_CHECK(jdir::is_dir(test_dir + "/I/J/K1/L3"));
+ BOOST_CHECK(jdir::is_dir(test_dir + "/I/J/K1/L4"));
+ BOOST_CHECK(jdir::is_dir(test_dir + "/I/J/K2"));
+ BOOST_CHECK(jdir::is_dir(test_dir + "/I/J/K3/L5"));
+ BOOST_CHECK(jdir::is_dir(test_dir + "/I/J/K3/L6"));
+ jdir::delete_dir(test_dir + "/I");
+ BOOST_CHECK(!jdir::exists(test_dir + "/I"));
cout << "ok" << endl;
}
Modified: store/trunk/cpp/tests/jrnl/_ut_jinf.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_jinf.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/_ut_jinf.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -50,11 +50,12 @@
QPID_AUTO_TEST_SUITE(jinf_suite)
const string test_filename("_ut_jinf");
+const char* tdp = getenv("TMPDIR");
+const string test_dir(tdp && strlen(tdp) > 0 ? tdp :
"/tmp/_ut_jinf");
// === Helper functions ===
const string jid("test journal id");
-const string jdir("/tmp");
const string base_filename("test_base");
timespec ts;
enum rid_scheme { RID_NONE, RID_LINEAR };
@@ -64,7 +65,7 @@
for (int fnum=0; fnum<NUM_JFILES; fnum++)
{
stringstream fn;
- fn << jdir << "/" << base_filename <<
".";
+ fn << test_dir << "/" << base_filename <<
".";
fn << setfill('0') << hex << setw(4) << fnum
<< "." << JRNL_DATA_EXTENSION;
jfiles.push_back(fn.str());
}
@@ -130,7 +131,7 @@
void clean_journal_info_file()
{
stringstream fn;
- fn << jdir << "/" << base_filename << "."
<< JRNL_INFO_EXTENSION;
+ fn << test_dir << "/" << base_filename <<
"." << JRNL_INFO_EXTENSION;
BOOST_WARN_MESSAGE(::unlink(fn.str().c_str()) == 0, "Failed to remove file
" << fn.str());
}
@@ -145,11 +146,11 @@
{
cout << test_filename << ".write_constructor: " <<
flush;
::clock_gettime(CLOCK_REALTIME, &ts);
- jinf ji(jid, jdir, base_filename, NUM_JFILES, JFSIZE_SBLKS, JRNL_WMGR_DEF_PAGE_SIZE,
+ jinf ji(jid, test_dir, base_filename, NUM_JFILES, JFSIZE_SBLKS,
JRNL_WMGR_DEF_PAGE_SIZE,
JRNL_WMGR_DEF_PAGES, ts);
BOOST_CHECK_EQUAL(ji.jver(), RHM_JDAT_VERSION);
BOOST_CHECK(ji.jid().compare(jid) == 0);
- BOOST_CHECK(ji.jdir().compare(jdir) == 0);
+ BOOST_CHECK(ji.jdir().compare(test_dir) == 0);
BOOST_CHECK(ji.base_filename().compare(base_filename) == 0);
timespec this_ts = ji.ts();
BOOST_CHECK_EQUAL(this_ts.tv_sec, ts.tv_sec);
@@ -166,11 +167,11 @@
{
cout << test_filename << ".read_constructor: " << flush;
stringstream fn;
- fn << jdir << "/" << base_filename << "."
<< JRNL_INFO_EXTENSION;
+ fn << test_dir << "/" << base_filename <<
"." << JRNL_INFO_EXTENSION;
jinf ji(fn.str(), false);
BOOST_CHECK_EQUAL(ji.jver(), RHM_JDAT_VERSION);
BOOST_CHECK(ji.jid().compare(jid) == 0);
- BOOST_CHECK(ji.jdir().compare(jdir) == 0);
+ BOOST_CHECK(ji.jdir().compare(test_dir) == 0);
BOOST_CHECK(ji.base_filename().compare(base_filename) == 0);
const timespec this_ts = ji.ts();
BOOST_CHECK_EQUAL(this_ts.tv_sec, ts.tv_sec);
@@ -186,7 +187,7 @@
{
cout << test_filename << ".validate: " << flush;
stringstream fn;
- fn << jdir << "/" << base_filename << "."
<< JRNL_INFO_EXTENSION;
+ fn << test_dir << "/" << base_filename <<
"." << JRNL_INFO_EXTENSION;
jinf ji(fn.str(), true);
// TODO: Check validation picks up conflict, but need to be friend to jinf to do it
cout << "ok" << endl;
@@ -201,7 +202,7 @@
create_journal_files(jfiles, RID_NONE);
stringstream fn;
- fn << jdir << "/" << base_filename << "."
<< JRNL_INFO_EXTENSION;
+ fn << test_dir << "/" << base_filename <<
"." << JRNL_INFO_EXTENSION;
jinf ji(fn.str(), false);
try { ji.analyze(); }
catch (const jexception& e)
@@ -225,7 +226,7 @@
create_journal_files(jfiles, RID_LINEAR, i, 0x12340000);
stringstream fn;
- fn << jdir << "/" << base_filename <<
"." << JRNL_INFO_EXTENSION;
+ fn << test_dir << "/" << base_filename <<
"." << JRNL_INFO_EXTENSION;
jinf ji(fn.str(), false);
BOOST_CHECK_EQUAL(ji.analyze(), i);
Modified: store/trunk/cpp/tests/jrnl/jtt/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/Makefile.am 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/jtt/Makefile.am 2008-05-30 18:59:09 UTC (rev 2098)
@@ -19,12 +19,18 @@
#
# The GNU Lesser General Public License is available in the file COPYING.
-AM_CXXFLAGS = -I${top_srcdir}/lib -Wall -Werror -Wextra -Wno-shadow -Wpointer-arith
-Wcast-qual -Wcast-align -Wno-long-long -Wvolatile-register-var -Winvalid-pch
-Wno-system-headers -pedantic -pthread -DBOOST_TEST_DYN_LINK
+abs_builddir=@abs_builddir@
+abs_srcdir=@abs_srcdir@
+AM_CXXFLAGS = $(WARNING_CFLAGS) -I${top_srcdir}/lib -pthread -DBOOST_TEST_DYN_LINK
+
+TMPDIR=$(abs_srcdir)/test_tmp
+
LINK_BDB = ${top_builddir}/lib/libbdbstore.la
-TESTS_ENVIRONMENT = \
- VALGRIND=$(VALGRIND) \
+TESTS_ENVIRONMENT = \
+ VALGRIND=$(VALGRIND) \
+ abs_srcdir=$(abs_srcdir) \
$(srcdir)/../../run_test
all-local: .valgrindrc .valgrind.supp
@@ -41,7 +47,8 @@
_ut_test_case_result \
_ut_test_case_result_agregation \
_ut_test_case_set \
- _ut_jrnl_instance
+ _ut_jrnl_instance \
+ ../../clean.sh
check_PROGRAMS = jtt \
_ut_data_src \
@@ -78,13 +85,20 @@
jtt_LDADD = -laio -lrt -lboost_program_options $(LINK_BDB)
-_ut_data_src_SOURCES = _ut_data_src.cpp data_src.cpp ../../unit_test.cpp
+_ut_data_src_SOURCES = \
+ _ut_data_src.cpp \
+ data_src.cpp \
+ ../../unit_test.cpp
_ut_data_src_LDADD = -lboost_unit_test_framework -lrt $(LINK_BDB)
-_ut_jrnl_init_params_SOURCES = _ut_jrnl_init_params.cpp ../../unit_test.cpp
jrnl_init_params.cpp
+_ut_jrnl_init_params_SOURCES = \
+ _ut_jrnl_init_params.cpp \
+ jrnl_init_params.cpp \
+ ../../unit_test.cpp
_ut_jrnl_init_params_LDADD = -lboost_unit_test_framework -lrt $(LINK_BDB)
-_ut_read_arg_SOURCES = _ut_read_arg.cpp ../../unit_test.cpp \
+_ut_read_arg_SOURCES = \
+ _ut_read_arg.cpp \
args.cpp \
data_src.cpp \
jrnl_init_params.cpp \
@@ -92,10 +106,12 @@
read_arg.cpp \
test_case.cpp \
test_case_result.cpp \
- test_case_result_agregation.cpp
+ test_case_result_agregation.cpp \
+ ../../unit_test.cpp
_ut_read_arg_LDADD = -lboost_unit_test_framework -lrt -lboost_program_options
$(LINK_BDB)
-_ut_jrnl_instance_SOURCES = _ut_jrnl_instance.cpp ../../unit_test.cpp \
+_ut_jrnl_instance_SOURCES = \
+ _ut_jrnl_instance.cpp \
args.cpp \
data_src.cpp \
jrnl_init_params.cpp \
@@ -103,23 +119,38 @@
read_arg.cpp \
test_case.cpp \
test_case_result.cpp \
- test_case_result_agregation.cpp
+ test_case_result_agregation.cpp \
+ ../../unit_test.cpp
_ut_jrnl_instance_LDADD = -lboost_unit_test_framework -laio -lrt -lboost_program_options
$(LINK_BDB)
-_ut_test_case_SOURCES = _ut_test_case.cpp ../../unit_test.cpp test_case.cpp
test_case_result.cpp test_case_result_agregation.cpp
+_ut_test_case_SOURCES = \
+ _ut_test_case.cpp \
+ test_case.cpp \
+ test_case_result.cpp \
+ test_case_result_agregation.cpp \
+ ../../unit_test.cpp
_ut_test_case_LDADD = -lboost_unit_test_framework -lrt $(LINK_BDB)
-_ut_test_case_result_SOURCES = _ut_test_case_result.cpp ../../unit_test.cpp
test_case_result.cpp
+_ut_test_case_result_SOURCES = \
+ _ut_test_case_result.cpp \
+ test_case_result.cpp \
+ ../../unit_test.cpp
_ut_test_case_result_LDADD = -lboost_unit_test_framework -lrt $(LINK_BDB)
-_ut_test_case_result_agregation_SOURCES = _ut_test_case_result_agregation.cpp
../../unit_test.cpp test_case_result.cpp test_case_result_agregation.cpp
+_ut_test_case_result_agregation_SOURCES = \
+ _ut_test_case_result_agregation.cpp \
+ test_case_result.cpp \
+ test_case_result_agregation.cpp \
+ ../../unit_test.cpp
_ut_test_case_result_agregation_LDADD = -lboost_unit_test_framework -lrt $(LINK_BDB)
-_ut_test_case_set_SOURCES = _ut_test_case_set.cpp ../../unit_test.cpp \
+_ut_test_case_set_SOURCES = \
+ _ut_test_case_set.cpp \
test_case.cpp \
test_case_set.cpp \
test_case_result.cpp \
- test_case_result_agregation.cpp
+ test_case_result_agregation.cpp \
+ ../../unit_test.cpp
_ut_test_case_set_LDADD = -lboost_unit_test_framework -lrt $(LINK_BDB)
EXTRA_DIST = \
Modified: store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp 2008-05-30 18:41:49 UTC (rev
2097)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp 2008-05-30 18:59:09 UTC (rev
2098)
@@ -37,12 +37,14 @@
QPID_AUTO_TEST_SUITE(jtt_jrnl_instance)
const string test_filename("_ut_jrnl_instance");
+const char* tdp = getenv("TMPDIR");
+const string test_dir(tdp && strlen(tdp) > 0 ? tdp :
"/tmp/OrderingTest");
QPID_AUTO_TEST_CASE(constructor_1)
{
cout << test_filename << ".constructor_1: " << flush;
const string jid = "jid1";
- const string jdir = "/tmp/test1";
+ const string jdir = test_dir + "/test1";
const string bfn = "test";
const u_int16_t num_jfiles = 20;
const u_int32_t jfsize_sblks = 128;
@@ -65,7 +67,7 @@
{
cout << test_filename << ".constructor_2: " << flush;
const string jid = "jid2";
- const string jdir = "/tmp/test2";
+ const string jdir = test_dir + "/test2";
const string bfn = "test";
const u_int16_t num_jfiles = 20;
const u_int32_t jfsize_sblks = 128;
@@ -90,7 +92,7 @@
{
cout << test_filename << ".constructor_3: " << flush;
const string jid = "jid3";
- const string jdir = "/tmp/test3";
+ const string jdir = test_dir + "/test3";
const string bfn = "test";
const u_int16_t num_jfiles = 20;
const u_int32_t jfsize_sblks = 128;
@@ -115,7 +117,7 @@
{
cout << test_filename << ".recover: " << flush;
const string jid = "jid5";
- const string jdir = "/tmp/test5";
+ const string jdir = test_dir + "/test5";
const string bfn = "test";
const u_int16_t num_jfiles = 20;
const u_int32_t jfsize_sblks = 128;
@@ -146,7 +148,7 @@
{
cout << test_filename << ".recover_no_files: " << flush;
const string jid = "jid6";
- const string jdir = "/tmp/test6";
+ const string jdir = test_dir + "/test6";
const string bfn = "test";
const u_int16_t num_jfiles = 20;
const u_int32_t jfsize_sblks = 128;
Modified: store/trunk/cpp/tests/jrnl/jtt/args.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/args.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/jtt/args.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -53,37 +53,72 @@
("csv-file,c",
po::value<std::string>(&test_case_csv_file_name)->default_value("jtt.csv"),
"CSV file containing test cases.")
- ("format-chk",
po::value<bool>(&format_chk)->zero_tokens(),
+
+ ("format-chk",
+ po::value<bool>(&format_chk)->zero_tokens(),
"Check the format of each journal file.")
+
("help,h", "This help message.")
- ("keep-jrnls",
po::value<bool>(&keep_jrnls)->zero_tokens(),
+
+ ("jrnl-dir",
+
po::value<std::string>(&journal_dir)->default_value("/tmp/jtt"),
+ "Directory in which journal files will be placed.")
+
+ ("keep-jrnls",
+ po::value<bool>(&keep_jrnls)->zero_tokens(),
"Keep all test journals.")
- ("lld-rd-num",
po::value<unsigned>(&lld_rd_num)->default_value(10),
+
+ ("lld-rd-num",
+ po::value<unsigned>(&lld_rd_num)->default_value(10),
"Number of consecutive messages to read after only dequeueing
<lld-skip-num> "
"messages during lazy-loading. Ignored if read-mode is not set to
LAZYLOAD.")
- ("lld-skip-num",
po::value<unsigned>(&lld_skip_num)->default_value(100),
+
+ ("lld-skip-num",
+ po::value<unsigned>(&lld_skip_num)->default_value(100),
"Number of consecutive messages to dequeue only (without reading) prior to
"
"reading <lld-rd-num> messages. Ignored if read-mode is not set to
LAZYLOAD.")
- ("num-jrnls",
po::value<unsigned>(&num_jrnls)->default_value(1),
+
+ ("num-jrnls",
+ po::value<unsigned>(&num_jrnls)->default_value(1),
"Number of simultaneous journal instances to test.")
- ("pause",
po::value<unsigned>(&pause_secs)->default_value(0),
+
+ ("pause",
+ po::value<unsigned>(&pause_secs)->default_value(0),
"Pause in seconds between test cases (allows disk to catch up).")
- ("randomize", po::value<bool>(&randomize)->zero_tokens(),
+
+ ("randomize",
+ po::value<bool>(&randomize)->zero_tokens(),
"Randomize the order of the test case execution.")
- ("read-mode",
po::value<read_arg>(&read_mode)->default_value(read_arg::NONE),
+
+ ("read-mode",
+ po::value<read_arg>(&read_mode)->default_value(read_arg::NONE),
read_arg::descr().c_str())
- ("read-prob",
po::value<unsigned>(&read_prob)->default_value(50),
+
+ ("read-prob",
+ po::value<unsigned>(&read_prob)->default_value(50),
"Read probability (percent) for each message when read-mode is set to
RANDOM.")
- ("recover-mode",
po::value<bool>(&recover_mode)->zero_tokens(),
+
+ ("recover-mode",
+ po::value<bool>(&recover_mode)->zero_tokens(),
"Recover journal from the previous test for each test case.")
- ("repeat", po::value<bool>(&repeat_flag)->zero_tokens(),
+
+ ("repeat",
+ po::value<bool>(&repeat_flag)->zero_tokens(),
"Repeat all test cases in CSV file indefinitely.")
- ("reuse-instance",
po::value<bool>(&reuse_instance)->zero_tokens(),
+
+ ("reuse-instance",
+ po::value<bool>(&reuse_instance)->zero_tokens(),
"Reuse journal instance for all test cases.")
- ("seed", po::value<unsigned>(&seed)->default_value(0),
+
+ ("seed",
+ po::value<unsigned>(&seed)->default_value(0),
"Seed for use in random number generator.")
- ("path", po::value<std::string>(&jtt_path));
-
+
+ ("ja-path",
+ po::value<std::string>(&jfile_analyze_path),
+ "Path to jfile_analyze file.")
+
+ ;
}
bool
Modified: store/trunk/cpp/tests/jrnl/jtt/args.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/args.hpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/jtt/args.hpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -38,8 +38,9 @@
boost::program_options::variables_map _vmap;
// Add args here
- std::string jtt_path;
+ std::string jfile_analyze_path;
std::string test_case_csv_file_name;
+ std::string journal_dir;
bool format_chk;
bool keep_jrnls;
unsigned lld_rd_num;
Modified: store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp 2008-05-30 18:59:09 UTC (rev 2098)
@@ -101,7 +101,7 @@
for (ji_list_citr jii=_ji_list.begin(); jii!=_ji_list.end(); jii++)
{
jrnl_init_params::shared_ptr jpp = (*jii)->params();
- std::string path = _args.jtt_path;
+ std::string path = _args.jfile_analyze_path;
if (path.empty()) path = ".";
if (path[path.size()-1] != '/') path += "/";
std::ostringstream oss;
@@ -161,7 +161,7 @@
jid << std::hex << std::setfill('0');
jid << "test_" << std::setw(4) << std::hex <<
i;
std::ostringstream jdir;
- jdir << "/tmp/" << jid.str();
+ jdir << _args.journal_dir << "/" << jid.str();
jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid.str(), jdir.str(),
jid.str()));
jrnl_instance::shared_ptr jip(new jrnl_instance(jpp));
_ji_list.push_back(jip);
Modified: store/trunk/cpp/tests/jrnl/run-journal-tests
===================================================================
--- store/trunk/cpp/tests/jrnl/run-journal-tests 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/jrnl/run-journal-tests 2008-05-30 18:59:09 UTC (rev 2098)
@@ -2,25 +2,24 @@
fail=0
num_jrnls=1
-rm -rf /tmp/test_0*
# Run jtt using default test set
echo
echo "===== Mode 1: New journal instance, no recover ====="
-jtt/jtt --path jtt --csv jtt/jtt.csv --format-chk --num-jrnls $num_jrnls || fail=1
-rm -rf /tmp/test_0*
+jtt/jtt --ja-path jtt --jrnl-dir ${TMPDIR} --csv jtt/jtt.csv --format-chk --num-jrnls
${num_jrnls} || fail=1
+rm -rf ${TMPDIR}/test_0*
echo
echo "===== Mode 2: Re-use journal instance, no recover ====="
-jtt/jtt --path jtt --csv jtt/jtt.csv --reuse-instance --format-chk --num-jrnls $num_jrnls
|| fail=1
-rm -rf /tmp/test_0*
+jtt/jtt --ja-path jtt --jrnl-dir ${TMPDIR} --csv jtt/jtt.csv --reuse-instance
--format-chk --num-jrnls ${num_jrnls} || fail=1
+rm -rf ${TMPDIR}/test_0*
echo
echo "===== Mode 3: New journal instance, recover previous test journal ====="
-jtt/jtt --path jtt --csv jtt/jtt.csv --recover-mode --format-chk --num-jrnls $num_jrnls
|| fail=1
-rm -rf /tmp/test_0*
+jtt/jtt --ja-path jtt --jrnl-dir ${TMPDIR} --csv jtt/jtt.csv --recover-mode --format-chk
--num-jrnls ${num_jrnls} || fail=1
+rm -rf ${TMPDIR}/test_0*
echo
echo "===== Mode 4: Re-use journal instance, recover previous test journal
====="
-jtt/jtt --path jtt --csv jtt/jtt.csv --reuse-instance --recover-mode --format-chk
--num-jrnls $num_jrnls || fail=1
-rm -rf /tmp/test_0*
+jtt/jtt --ja-path jtt --jrnl-dir ${TMPDIR} --csv jtt/jtt.csv --reuse-instance
--recover-mode --format-chk --num-jrnls ${num_jrnls} || fail=1
+rm -rf ${TMPDIR}/test_0*
echo
exit $fail
Modified: store/trunk/cpp/tests/system_test.sh
===================================================================
--- store/trunk/cpp/tests/system_test.sh 2008-05-30 18:41:49 UTC (rev 2097)
+++ store/trunk/cpp/tests/system_test.sh 2008-05-30 18:59:09 UTC (rev 2098)
@@ -34,7 +34,11 @@
export PYTHONPATH=$QPID_DIR/python
# Create a temporary directory for store data.
-export TMPDIR=`mktemp -d` || error "Can't create temporary directory."
+#if test $TESTDIRx == x ; then
+# export TMPDIR=`mktemp -d` || error "Can't create temporary
directory."
+#else
+# export TMPDIR=$TESTDIR
+#fi
echo "Using directory $TMPDIR"
fail=0
@@ -54,5 +58,4 @@
echo 'BDB persistence...'
run_tests --store-async no
-test "$fail" = 0 && rm -rf $WORKING_DIR
exit $fail