[rhmessaging-commits] rhmessaging commits: r1572 - in store/trunk/cpp/tests/jrnl: jtt and 1 other directory.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Fri Jan 18 10:40:45 EST 2008
Author: kpvdr
Date: 2008-01-18 10:40:45 -0500 (Fri, 18 Jan 2008)
New Revision: 1572
Added:
store/trunk/cpp/tests/jrnl/jtt/
store/trunk/cpp/tests/jrnl/jtt/Makefile.am
store/trunk/cpp/tests/jrnl/jtt/_ut_data_src.cpp
store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp
store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp
store/trunk/cpp/tests/jrnl/jtt/_ut_test_case.cpp
store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result.cpp
store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result_agregation.cpp
store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.cpp
store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.csv
store/trunk/cpp/tests/jrnl/jtt/bootstrap
store/trunk/cpp/tests/jrnl/jtt/configure.ac
store/trunk/cpp/tests/jrnl/jtt/data_src.cpp
store/trunk/cpp/tests/jrnl/jtt/data_src.hpp
store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.cpp
store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.hpp
store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp
store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp
store/trunk/cpp/tests/jrnl/jtt/jtt.csv
store/trunk/cpp/tests/jrnl/jtt/main.cpp
store/trunk/cpp/tests/jrnl/jtt/test_case.cpp
store/trunk/cpp/tests/jrnl/jtt/test_case.hpp
store/trunk/cpp/tests/jrnl/jtt/test_case_result.cpp
store/trunk/cpp/tests/jrnl/jtt/test_case_result.hpp
store/trunk/cpp/tests/jrnl/jtt/test_case_result_agregation.cpp
store/trunk/cpp/tests/jrnl/jtt/test_case_result_agregation.hpp
store/trunk/cpp/tests/jrnl/jtt/test_case_set.cpp
store/trunk/cpp/tests/jrnl/jtt/test_case_set.hpp
store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp
store/trunk/cpp/tests/jrnl/jtt/test_mgr.hpp
Log:
Journal test tool
Added: store/trunk/cpp/tests/jrnl/jtt/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/Makefile.am (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/Makefile.am 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,140 @@
+# Copyright (C) 2008 Red Hat Inc.
+#
+# This file is part of Red Hat Messaging.
+#
+# Red Hat Messaging 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.
+
+
+LIBDIR = ../../../lib
+LIBOBJDIR = ${LIBDIR}/.libs
+JRNLDIR = ${LIBDIR}/jrnl
+
+AM_CXXFLAGS = -I${LIBDIR} -Wall -Werror -Wextra -Wno-shadow -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wvolatile-register-var -Winvalid-pch -Wno-system-headers -pedantic -pthread
+
+TESTS = \
+ _ut_data_src \
+ _ut_jrnl_init_params \
+ _ut_test_case \
+ _ut_test_case_result \
+ _ut_test_case_result_agregation \
+ _ut_test_case_set \
+ _ut_jrnl_instance
+
+bin_PROGRAMS = jtt
+
+check_PROGRAMS = \
+ _ut_data_src \
+ _ut_jrnl_init_params \
+ _ut_test_case \
+ _ut_test_case_result \
+ _ut_test_case_result_agregation \
+ _ut_test_case_set \
+ _ut_jrnl_instance
+
+jtt_SOURCES = \
+ data_src.cpp \
+ jrnl_init_params.cpp \
+ jrnl_instance.cpp \
+ main.cpp \
+ test_case.cpp \
+ test_case_result.cpp \
+ test_case_result_agregation.cpp \
+ test_case_set.cpp \
+ test_mgr.cpp
+jtt_LDADD = \
+ ${LIBOBJDIR}/data_tok.o \
+ ${LIBOBJDIR}/deq_rec.o \
+ ${LIBOBJDIR}/enq_map.o \
+ ${LIBOBJDIR}/enq_rec.o \
+ ${LIBOBJDIR}/jcntl.o \
+ ${LIBOBJDIR}/jdir.o \
+ ${LIBOBJDIR}/jerrno.o \
+ ${LIBOBJDIR}/jexception.o \
+ ${LIBOBJDIR}/jinf.o \
+ ${LIBOBJDIR}/jrec.o \
+ ${LIBOBJDIR}/lfh.o \
+ ${LIBOBJDIR}/nlfh.o \
+ ${LIBOBJDIR}/pmgr.o \
+ ${LIBOBJDIR}/rmgr.o \
+ ${LIBOBJDIR}/rrfc.o \
+ ${LIBOBJDIR}/txn_map.o \
+ ${LIBOBJDIR}/txn_rec.o \
+ ${LIBOBJDIR}/wmgr.o \
+ ${LIBOBJDIR}/wrfc.o
+jtt_LDFLAGS = -laio -lrt -lboost_program_options
+
+_ut_data_src_SOURCES = _ut_data_src.cpp ../../unit_test.cpp
+_ut_data_src_LDFLAGS = -lboost_unit_test_framework -lrt
+_ut_data_src_LDADD = data_src.o
+
+_ut_jrnl_init_params_SOURCES = _ut_jrnl_init_params.cpp ../../unit_test.cpp
+_ut_jrnl_init_params_LDFLAGS = -lboost_unit_test_framework -lrt
+_ut_jrnl_init_params_LDADD = jrnl_init_params.o
+
+_ut_jrnl_instance_SOURCES = _ut_jrnl_instance.cpp ../../unit_test.cpp
+_ut_jrnl_instance_LDFLAGS = -lboost_unit_test_framework -laio -lrt
+_ut_jrnl_instance_LDADD = \
+ data_src.o \
+ jrnl_init_params.o \
+ jrnl_instance.o \
+ test_case.o \
+ test_case_result.o \
+ test_case_result_agregation.o \
+ ${LIBOBJDIR}/data_tok.o \
+ ${LIBOBJDIR}/deq_rec.o \
+ ${LIBOBJDIR}/enq_map.o \
+ ${LIBOBJDIR}/enq_rec.o \
+ ${LIBOBJDIR}/jcntl.o \
+ ${LIBOBJDIR}/jdir.o \
+ ${LIBOBJDIR}/jerrno.o \
+ ${LIBOBJDIR}/jexception.o \
+ ${LIBOBJDIR}/jinf.o \
+ ${LIBOBJDIR}/jrec.o \
+ ${LIBOBJDIR}/lfh.o \
+ ${LIBOBJDIR}/nlfh.o \
+ ${LIBOBJDIR}/pmgr.o \
+ ${LIBOBJDIR}/rmgr.o \
+ ${LIBOBJDIR}/rrfc.o \
+ ${LIBOBJDIR}/txn_map.o \
+ ${LIBOBJDIR}/txn_rec.o \
+ ${LIBOBJDIR}/wmgr.o \
+ ${LIBOBJDIR}/wrfc.o
+
+_ut_test_case_SOURCES = _ut_test_case.cpp ../../unit_test.cpp
+_ut_test_case_LDFLAGS = -lboost_unit_test_framework -lrt
+_ut_test_case_LDADD = test_case.o test_case_result.o test_case_result_agregation.o
+
+_ut_test_case_result_SOURCES = _ut_test_case_result.cpp ../../unit_test.cpp
+_ut_test_case_result_LDFLAGS = -lboost_unit_test_framework -lrt
+_ut_test_case_result_LDADD = test_case_result.o \
+ ${LIBOBJDIR}/jerrno.o \
+ ${LIBOBJDIR}/jexception.o
+
+_ut_test_case_result_agregation_SOURCES = _ut_test_case_result_agregation.cpp ../../unit_test.cpp
+_ut_test_case_result_agregation_LDFLAGS = -lboost_unit_test_framework -lrt
+_ut_test_case_result_agregation_LDADD = test_case_result.o test_case_result_agregation.o \
+ ${LIBOBJDIR}/jerrno.o \
+ ${LIBOBJDIR}/jexception.o
+
+_ut_test_case_set_SOURCES = _ut_test_case_set.cpp ../../unit_test.cpp
+_ut_test_case_set_LDFLAGS = -lboost_unit_test_framework -lrt
+_ut_test_case_set_LDADD = test_case.o test_case_set.o test_case_result.o test_case_result_agregation.o
+
+EXTRA_DIST = \
+ jtt.csv \
+ _ut_test_case_set.csv
Added: store/trunk/cpp/tests/jrnl/jtt/_ut_data_src.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_data_src.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_data_src.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,69 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "data_src.hpp"
+#include <iostream>
+
+using namespace boost::unit_test;
+using namespace rhm::jtt;
+
+QPID_AUTO_TEST_SUITE(jtt_data_src)
+
+BOOST_AUTO_TEST_CASE(data_src_data)
+{
+ BOOST_CHECK(data_src::max_dsize > 0);
+ for (size_t i=0; i<1024; i++)
+ {
+ const char* dp = data_src::get_data(i);
+ BOOST_CHECK_EQUAL(*dp, static_cast<char>('0' + ((i + 1) % 10)));
+ }
+ for (size_t i=data_src::max_dsize-1024; i<data_src::max_dsize; i++)
+ {
+ const char* dp = data_src::get_data(i);
+ BOOST_CHECK_EQUAL(*dp, static_cast<char>('0' + ((i + 1) % 10)));
+ }
+ const char* dp1 = data_src::get_data(data_src::max_dsize);
+ BOOST_CHECK_EQUAL(dp1,(char*) 0);
+ const char* dp2 = data_src::get_data(data_src::max_dsize + 0x1000);
+ BOOST_CHECK_EQUAL(dp2, (char*)0);
+}
+
+BOOST_AUTO_TEST_CASE(data_src_xid_data)
+{
+ BOOST_CHECK(data_src::max_xsize > 0);
+ for (size_t i=0; i<1024; i++)
+ {
+ const char* dp = data_src::get_xid(i);
+ BOOST_CHECK_EQUAL(*dp, static_cast<char>('a' + (i % 26)));
+ }
+ for (size_t i=data_src::max_xsize-1024; i<data_src::max_xsize; i++)
+ {
+ const char* dp = data_src::get_xid(i);
+ BOOST_CHECK_EQUAL(*dp, static_cast<char>('a' + (i % 26)));
+ }
+ const char* dp1 = data_src::get_xid(data_src::max_xsize);
+ BOOST_CHECK_EQUAL(dp1, (char*)0);
+ const char* dp2 = data_src::get_xid(data_src::max_xsize + 0x1000);
+ BOOST_CHECK_EQUAL(dp2, (char*)0);
+}
Added: store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,78 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "jrnl_init_params.hpp"
+
+using namespace boost::unit_test;
+using namespace rhm::jtt;
+
+QPID_AUTO_TEST_SUITE(jtt_jrnl_init_params)
+
+BOOST_AUTO_TEST_CASE(jrnl_init_params_constructor)
+{
+ const std::string jid = "jid";
+ const std::string jdir = "jdir";
+ const std::string bfn = "base filename";
+ const u_int16_t num_jfiles = 123;
+ const u_int32_t jfsize_sblks = 456;
+ jrnl_init_params jip(jid, jdir, bfn, num_jfiles, jfsize_sblks);
+ BOOST_CHECK_EQUAL(jip.jid(), jid);
+ BOOST_CHECK_EQUAL(jip.jdir(), jdir);
+ BOOST_CHECK_EQUAL(jip.base_filename(), bfn);
+ BOOST_CHECK_EQUAL(jip.num_jfiles(), num_jfiles);
+ BOOST_CHECK_EQUAL(jip.jfsize_sblks(), jfsize_sblks);
+}
+
+BOOST_AUTO_TEST_CASE(jrnl_init_params_copy_constructor_1)
+{
+ const std::string jid = "jid";
+ const std::string jdir = "jdir";
+ const std::string bfn = "base filename";
+ const u_int16_t num_jfiles = 123;
+ const u_int32_t jfsize_sblks = 456;
+ jrnl_init_params jip1(jid, jdir, bfn, num_jfiles, jfsize_sblks);
+ jrnl_init_params jip2(jip1);
+ BOOST_CHECK_EQUAL(jip2.jid(), jid);
+ BOOST_CHECK_EQUAL(jip2.jdir(), jdir);
+ BOOST_CHECK_EQUAL(jip2.base_filename(), bfn);
+ BOOST_CHECK_EQUAL(jip2.num_jfiles(), num_jfiles);
+ BOOST_CHECK_EQUAL(jip2.jfsize_sblks(), jfsize_sblks);
+}
+
+BOOST_AUTO_TEST_CASE(jrnl_init_params_copy_constructor_2)
+{
+ const std::string jid = "jid";
+ const std::string jdir = "jdir";
+ const std::string bfn = "base filename";
+ const u_int16_t num_jfiles = 123;
+ const u_int32_t jfsize_sblks = 456;
+ jrnl_init_params::shared_ptr p(new jrnl_init_params(jid, jdir, bfn, num_jfiles, jfsize_sblks));
+ jrnl_init_params jip2(p.get());
+ BOOST_CHECK_EQUAL(jip2.jid(), jid);
+ BOOST_CHECK_EQUAL(jip2.jdir(), jdir);
+ BOOST_CHECK_EQUAL(jip2.base_filename(), bfn);
+ BOOST_CHECK_EQUAL(jip2.num_jfiles(), num_jfiles);
+ BOOST_CHECK_EQUAL(jip2.jfsize_sblks(), jfsize_sblks);
+}
+
Added: store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,204 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "jrnl_init_params.hpp"
+#include "jrnl_instance.hpp"
+#include <jrnl/jdir.hpp>
+#include <jrnl/jerrno.hpp>
+
+using namespace boost::unit_test;
+using namespace rhm::journal;
+using namespace rhm::jtt;
+
+QPID_AUTO_TEST_SUITE(jtt_jrnl_instance)
+
+BOOST_AUTO_TEST_CASE(jrnl_instance_constructor_1)
+{
+ const std::string jid = "jid1";
+ const std::string jdir = "/tmp/test1";
+ const std::string bfn = "test";
+ const u_int16_t num_jfiles = 20;
+ const u_int32_t jfsize_sblks = 128;
+
+ using rhm::jtt::test_case;
+ test_case::shared_ptr p(new test_case(1, 0, 0, 0, false, 0, 0, test_case::JTT_PERSISTNET,
+ test_case::JDL_INTERNAL, "t1"));
+ jrnl_instance ji(jid, jdir, bfn, num_jfiles, jfsize_sblks);
+ ji.init_tc(p, false, false, true);
+ ji.run_tc();
+ ji.tc_wait_compl();
+ try { jdir::verify_dir(jdir, bfn); }
+ catch (const jexception& e) { BOOST_ERROR(e.what()); }
+ jdir::delete_dir(jdir);
+}
+
+BOOST_AUTO_TEST_CASE(jrnl_instance_constructor_2)
+{
+ const std::string jid = "jid2";
+ const std::string jdir = "/tmp/test2";
+ const std::string bfn = "test";
+ const u_int16_t num_jfiles = 20;
+ const u_int32_t jfsize_sblks = 128;
+
+ using rhm::jtt::test_case;
+ test_case::shared_ptr p(new test_case(2, 0, 0, 0, false, 0, 0, test_case::JTT_PERSISTNET,
+ test_case::JDL_INTERNAL, "t2"));
+ jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles,
+ jfsize_sblks));
+ jrnl_instance ji(jpp);
+ ji.init_tc(p, false, false, true);
+ ji.run_tc();
+ ji.tc_wait_compl();
+ try { jdir::verify_dir(jdir, bfn); }
+ catch (const jexception& e) { BOOST_ERROR(e.what()); }
+ jdir::delete_dir(jdir);
+}
+
+BOOST_AUTO_TEST_CASE(jrnl_instance_constructor_3)
+{
+ const std::string jid = "jid3";
+ const std::string jdir = "/tmp/test3";
+ const std::string bfn = "test";
+ const u_int16_t num_jfiles = 20;
+ const u_int32_t jfsize_sblks = 128;
+
+ using rhm::jtt::test_case;
+ test_case::shared_ptr p(new test_case(3, 0, 0, 0, false, 0, 0, test_case::JTT_PERSISTNET,
+ test_case::JDL_INTERNAL, "t3"));
+ jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles,
+ jfsize_sblks));
+ jrnl_instance ji(jpp);
+ ji.init_tc(p, false, false, true);
+ ji.run_tc();
+ ji.tc_wait_compl();
+ try { jdir::verify_dir(jdir, bfn); }
+ catch (const jexception& e) { BOOST_ERROR(e.what()); }
+ jdir::delete_dir(jdir);
+}
+
+BOOST_AUTO_TEST_CASE(jrnl_instance_reuse)
+{
+ const std::string jid = "jid4";
+ const std::string jdir = "/tmp/test4";
+ const std::string bfn = "test";
+ const u_int16_t num_jfiles = 20;
+ const u_int32_t jfsize_sblks = 128;
+
+ using rhm::jtt::test_case;
+ test_case::shared_ptr p(new test_case(4, 0, 0, 0, false, 0, 0, test_case::JTT_PERSISTNET,
+ test_case::JDL_INTERNAL, "t4"));
+ jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles,
+ jfsize_sblks));
+ jrnl_instance ji(jpp);
+ ji.init_tc(p, true, false, true);
+ ji.run_tc();
+ ji.tc_wait_compl();
+ try { jdir::verify_dir(jdir, bfn); }
+ catch (const jexception& e) { BOOST_ERROR(e.what()); }
+ ji.init_tc(p, true, true, true);
+ ji.run_tc();
+ ji.tc_wait_compl();
+ try { jdir::verify_dir(jdir, bfn); }
+ catch (const jexception& e) { BOOST_ERROR(e.what()); }
+ jdir::delete_dir(jdir);
+}
+
+BOOST_AUTO_TEST_CASE(jrnl_instance_recover)
+{
+ const std::string jid = "jid5";
+ const std::string jdir = "/tmp/test5";
+ const std::string bfn = "test";
+ const u_int16_t num_jfiles = 20;
+ const u_int32_t jfsize_sblks = 128;
+
+ using rhm::jtt::test_case;
+ test_case::shared_ptr p(new test_case(5, 0, 0, 0, false, 0, 0, test_case::JTT_PERSISTNET,
+ test_case::JDL_INTERNAL, "t5"));
+ jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles,
+ jfsize_sblks));
+ jrnl_instance ji(jpp);
+ ji.init_tc(p, false, false, true);
+ ji.run_tc();
+ ji.tc_wait_compl();
+ try { jdir::verify_dir(jdir, bfn); }
+ catch (const jexception& e) { BOOST_ERROR(e.what()); }
+ ji.init_tc(p, false, true, true);
+ ji.run_tc();
+ ji.tc_wait_compl();
+ try { jdir::verify_dir(jdir, bfn); }
+ catch (const jexception& e) { BOOST_ERROR(e.what()); }
+ jdir::delete_dir(jdir);
+}
+
+BOOST_AUTO_TEST_CASE(jrnl_instance_recover_no_files)
+{
+ const std::string jid = "jid6";
+ const std::string jdir = "/tmp/test6";
+ const std::string bfn = "test";
+ const u_int16_t num_jfiles = 20;
+ const u_int32_t jfsize_sblks = 128;
+
+ using rhm::jtt::test_case;
+ test_case::shared_ptr p(new test_case(6, 0, 0, 0, false, 0, 0, test_case::JTT_PERSISTNET,
+ test_case::JDL_INTERNAL, "t6"));
+ jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles,
+ jfsize_sblks));
+ jrnl_instance ji(jpp);
+ ji.init_tc(p, false, true, true);
+ ji.run_tc();
+ ji.tc_wait_compl();
+ try { jdir::verify_dir(jdir, bfn); }
+ catch (const jexception& e) { BOOST_ERROR(e.what()); }
+ jdir::delete_dir(jdir);
+}
+
+BOOST_AUTO_TEST_CASE(jrnl_instance_no_jrnl_keep)
+{
+ const std::string jid = "jid7";
+ const std::string jdir = "/tmp/test7";
+ const std::string bfn = "test";
+ const u_int16_t num_jfiles = 20;
+ const u_int32_t jfsize_sblks = 128;
+
+ using rhm::jtt::test_case;
+ test_case::shared_ptr p(new test_case(7, 0, 0, 0, false, 0, 0, test_case::JTT_PERSISTNET,
+ test_case::JDL_INTERNAL, "t7"));
+ jrnl_instance ji(jid, jdir, bfn, num_jfiles, jfsize_sblks);
+ ji.init_tc(p, false, false, false);
+ ji.run_tc();
+ ji.tc_wait_compl();
+ try
+ {
+ jdir::verify_dir(jdir, bfn);
+ BOOST_ERROR("Failed to delete journal directory.");
+ }
+ catch (const jexception& e)
+ {
+ if (e.err_code() != rhm::journal::jerrno::JERR_JDIR_STAT)
+ BOOST_ERROR(e.what());
+ }
+ jdir::delete_dir(jdir);
+}
+
+
Added: store/trunk/cpp/tests/jrnl/jtt/_ut_test_case.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_test_case.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_test_case.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,103 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 <iomanip>
+#include "../../unit_test.h"
+#include "test_case.hpp"
+#include "test_case_result.hpp"
+
+using namespace boost::unit_test;
+using namespace rhm::jtt;
+
+QPID_AUTO_TEST_SUITE(jtt_test_case)
+
+BOOST_AUTO_TEST_CASE(test_case_constructor)
+{
+ const unsigned test_case_num = 0x12345;
+ const u_int32_t num_msgs = 0x100;
+ const size_t min_data_size = 0x1000;
+ const size_t max_data_size = 0;
+ const bool auto_deq = true;
+ const size_t min_xid_size = 0x200;
+ const size_t max_xid_size = 0x200;
+ using rhm::jtt::test_case;
+ const test_case::transient_t transient = test_case::JTT_PERSISTNET;
+ const test_case::external_t external = test_case::JDL_INTERNAL;
+ const std::string comment = "This is a test";
+
+ test_case tc(test_case_num, num_msgs, min_data_size, max_data_size, auto_deq,
+ min_xid_size, max_xid_size, transient, external, comment);
+ BOOST_CHECK_EQUAL(tc.test_case_num(), test_case_num);
+ BOOST_CHECK_EQUAL(tc.num_msgs(), num_msgs);
+ BOOST_CHECK_EQUAL(tc.min_data_size(), min_data_size);
+ BOOST_CHECK_EQUAL(tc.max_data_size(), max_data_size);
+ BOOST_CHECK_EQUAL(tc.auto_deq(), auto_deq);
+ BOOST_CHECK_EQUAL(tc.min_xid_size(), min_xid_size);
+ BOOST_CHECK_EQUAL(tc.max_xid_size(), max_xid_size);
+ BOOST_CHECK_EQUAL(tc.transient(), transient);
+ BOOST_CHECK_EQUAL(tc.external(), external);
+ BOOST_CHECK_EQUAL(tc.comment(), comment);
+}
+
+BOOST_AUTO_TEST_CASE(test_case_results)
+{
+ const unsigned test_case_num = 0x12345;
+ const u_int32_t num_msgs = 0x100;
+ const size_t min_data_size = 0x1000;
+ const size_t max_data_size = 0;
+ const bool auto_deq = true;
+ const size_t min_xid_size = 0x200;
+ const size_t max_xid_size = 0x200;
+ using rhm::jtt::test_case;
+ const test_case::transient_t transient = test_case::JTT_PERSISTNET;
+ const test_case::external_t external = test_case::JDL_INTERNAL;
+ const std::string comment = "This is a test";
+ const unsigned num_results = 20;
+
+ test_case tc(test_case_num, num_msgs, min_data_size, max_data_size, auto_deq,
+ min_xid_size, max_xid_size, transient, external, comment);
+ for (unsigned i=0; i<num_results; i++)
+ {
+ std::ostringstream oss;
+ oss << "JID_" << std::setfill('0') << std::setw(2) << i;
+ test_case_result::shared_ptr p(new test_case_result(oss.str()));
+ tc.add_result(p);
+ }
+ BOOST_CHECK_EQUAL(tc.num_results(), num_results);
+ test_case_result_agregation ave = tc.average();
+ unsigned i=0;
+ for (test_case_result_agregation::tcrp_list_citr j=ave.rlist_begin(); j!=ave.rlist_end(); i++,j++)
+ {
+ std::ostringstream oss;
+ oss << "JID_" << std::setfill('0') << std::setw(2) << i;
+ BOOST_CHECK_EQUAL((*j)->jid(), oss.str());
+ }
+ for (unsigned i=0; i<num_results; i++)
+ {
+ std::ostringstream oss;
+ oss << "JID_" << std::setfill('0') << std::setw(2) << i;
+ BOOST_CHECK_EQUAL(ave[i]->jid(), oss.str());
+ }
+ tc.clear();
+ BOOST_CHECK_EQUAL(tc.num_results(), unsigned(0));
+}
Added: store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,166 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 <jrnl/jexception.hpp>
+#include "test_case_result.hpp"
+
+using namespace boost::unit_test;
+using namespace rhm::journal;
+using namespace rhm::jtt;
+
+QPID_AUTO_TEST_SUITE(jtt_test_case_result)
+
+BOOST_AUTO_TEST_CASE(test_case_result_constructor)
+{
+ const std::string jid("journal id 1");
+ test_case_result tcr(jid);
+ BOOST_CHECK_EQUAL(tcr.jid(), jid);
+ BOOST_CHECK_EQUAL(tcr.exception(), false);
+ BOOST_CHECK_EQUAL(tcr.err_code(), u_int32_t(0));
+ BOOST_CHECK_EQUAL(tcr.what(), "");
+ const timespec& ts1 = tcr.start_time();
+ BOOST_CHECK_EQUAL(ts1.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts1.tv_nsec, 0);
+ const timespec& ts2 = tcr.stop_time();
+ BOOST_CHECK_EQUAL(ts2.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts2.tv_nsec, 0);
+ const timespec& ts3 = tcr.test_time();
+ BOOST_CHECK_EQUAL(ts3.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts3.tv_nsec, 0);
+}
+
+BOOST_AUTO_TEST_CASE(test_case_result_start_stop)
+{
+ const std::string jid("journal id 2");
+ test_case_result tcr(jid);
+ BOOST_CHECK_EQUAL(tcr.exception(), false);
+ BOOST_CHECK_EQUAL(tcr.err_code(), u_int32_t(0));
+ BOOST_CHECK_EQUAL(tcr.what(), "");
+ const timespec& ts1 = tcr.start_time();
+ BOOST_CHECK_EQUAL(ts1.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts1.tv_nsec, 0);
+ const timespec& ts2 = tcr.stop_time();
+ BOOST_CHECK_EQUAL(ts2.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts2.tv_nsec, 0);
+ const timespec& ts3 = tcr.test_time();
+ BOOST_CHECK_EQUAL(ts3.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts3.tv_nsec, 0);
+
+ tcr.set_start_time();
+ BOOST_CHECK_EQUAL(tcr.exception(), false);
+ BOOST_CHECK_EQUAL(tcr.err_code(), u_int32_t(0));
+ BOOST_CHECK_EQUAL(tcr.what(), "");
+ const timespec& ts4 = tcr.start_time();
+ BOOST_CHECK(ts4.tv_sec > 0);
+ BOOST_CHECK(ts4.tv_nsec > 0);
+ const timespec& ts5 = tcr.stop_time();
+ BOOST_CHECK_EQUAL(ts5.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts5.tv_nsec, 0);
+ const timespec& ts6 = tcr.test_time();
+ BOOST_CHECK_EQUAL(ts6.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts6.tv_nsec, 0);
+
+ ::usleep(1100000); // 1.1 sec in microseconds
+ tcr.set_stop_time();
+ BOOST_CHECK_EQUAL(tcr.exception(), false);
+ BOOST_CHECK_EQUAL(tcr.err_code(), u_int32_t(0));
+ BOOST_CHECK_EQUAL(tcr.what(), "");
+ const timespec& ts7 = tcr.stop_time();
+ BOOST_CHECK(ts7.tv_sec > 0);
+ BOOST_CHECK(ts7.tv_nsec > 0);
+ const timespec& ts8 = tcr.test_time();
+ BOOST_CHECK(ts8.tv_sec == 1);
+ BOOST_CHECK(ts8.tv_nsec > 100000000); // 0.1 sec in nanoseconds
+ BOOST_CHECK(ts8.tv_nsec < 200000000); // 0.2 sec in nanoseconds
+}
+
+BOOST_AUTO_TEST_CASE(test_case_result_start_exception_stop)
+{
+ const std::string jid("journal id 3");
+ test_case_result tcr(jid);
+ const u_int32_t err_code = 0x321;
+ const std::string err_msg = "exception message";
+ const jexception e(err_code, err_msg);
+ tcr.set_start_time();
+ ::usleep(1100000); // 1.1 sec in microseconds
+ tcr.set_exception(e);
+ BOOST_CHECK_EQUAL(tcr.exception(), true);
+ BOOST_CHECK_EQUAL(tcr.err_code(), err_code);
+ BOOST_CHECK_EQUAL(tcr.what(), e.what());
+ const timespec& ts1 = tcr.stop_time();
+ BOOST_CHECK(ts1.tv_sec > 0);
+ BOOST_CHECK(ts1.tv_nsec > 0);
+ const timespec& ts2 = tcr.test_time();
+ BOOST_CHECK(ts2.tv_sec == 1);
+ BOOST_CHECK(ts2.tv_nsec > 100000000); // 0.1 sec in nanoseconds
+ BOOST_CHECK(ts2.tv_nsec < 200000000); // 0.2 sec in nanoseconds
+}
+
+BOOST_AUTO_TEST_CASE(test_case_result_start_exception)
+{
+ const std::string jid("journal id 4");
+ test_case_result tcr(jid);
+ u_int32_t err_code = 0x654;
+ const std::string err_msg = "exception message";
+ const jexception e(err_code, err_msg);
+ tcr.set_start_time();
+ ::usleep(1100000); // 1.1 sec in microseconds
+ tcr.set_exception(e, false);
+ BOOST_CHECK_EQUAL(tcr.exception(), true);
+ BOOST_CHECK_EQUAL(tcr.err_code(), err_code);
+ BOOST_CHECK_EQUAL(tcr.what(), e.what());
+ const timespec& ts1 = tcr.stop_time();
+ BOOST_CHECK_EQUAL(ts1.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts1.tv_nsec, 0);
+ const timespec& ts2 = tcr.test_time();
+ BOOST_CHECK_EQUAL(ts2.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts2.tv_nsec, 0);
+}
+
+BOOST_AUTO_TEST_CASE(test_case_counters)
+{
+ const u_int32_t num_enq = 125;
+ const u_int32_t num_deq = 64;
+ const u_int32_t num_read = 22;
+ const std::string jid("journal id 5");
+ test_case_result tcr(jid);
+ BOOST_CHECK_EQUAL(tcr.num_enq(), u_int32_t(0));
+ BOOST_CHECK_EQUAL(tcr.num_deq(), u_int32_t(0));
+ BOOST_CHECK_EQUAL(tcr.num_read(), u_int32_t(0));
+ for (unsigned i=0; i<num_enq; i++)
+ tcr.incr_num_enq();
+ BOOST_CHECK_EQUAL(tcr.num_enq(), num_enq);
+ BOOST_CHECK_EQUAL(tcr.num_deq(), u_int32_t(0));
+ BOOST_CHECK_EQUAL(tcr.num_read(), u_int32_t(0));
+ for (unsigned j=0; j<num_deq; j++)
+ tcr.incr_num_deq();
+ BOOST_CHECK_EQUAL(tcr.num_enq(), num_enq);
+ BOOST_CHECK_EQUAL(tcr.num_deq(), num_deq);
+ BOOST_CHECK_EQUAL(tcr.num_read(), u_int32_t(0));
+ for (unsigned k=0; k<num_read; k++)
+ tcr.incr_num_read();
+ BOOST_CHECK_EQUAL(tcr.num_enq(), num_enq);
+ BOOST_CHECK_EQUAL(tcr.num_deq(), num_deq);
+ BOOST_CHECK_EQUAL(tcr.num_read(), num_read);
+}
Added: store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result_agregation.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result_agregation.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result_agregation.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,183 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "test_case_result_agregation.hpp"
+
+#include <iostream>
+
+using namespace boost::unit_test;
+using namespace rhm::journal;
+using namespace rhm::jtt;
+
+QPID_AUTO_TEST_SUITE(jtt_test_case_result_agregation)
+
+// helper fn forward decls
+void check_agregate(const test_case_result_agregation& tcra, const u_int32_t num_enq,
+ const u_int32_t num_deq, const u_int32_t num_reads, const u_int32_t num_results,
+ const u_int32_t num_exceptions, const time_t secs, const long nsec);
+test_case_result::shared_ptr make_result(const std::string& jid, const u_int32_t num_enq,
+ const u_int32_t num_deq, const u_int32_t num_reads, const time_t secs, const long nsec);
+
+BOOST_AUTO_TEST_CASE(test_case_result_agregation_constructor_1)
+{
+ test_case_result_agregation tcra;
+ BOOST_CHECK_EQUAL(tcra.tc_average_mode(), true);
+ BOOST_CHECK_EQUAL(tcra.jid(), "Average");
+ BOOST_CHECK_EQUAL(tcra.exception(), false);
+ BOOST_CHECK_EQUAL(tcra.err_code(), u_int32_t(0));
+ BOOST_CHECK_EQUAL(tcra.what(), "");
+ const timespec& ts1 = tcra.start_time();
+ BOOST_CHECK_EQUAL(ts1.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts1.tv_nsec, 0);
+ const timespec& ts2 = tcra.stop_time();
+ BOOST_CHECK_EQUAL(ts2.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts2.tv_nsec, 0);
+ const timespec& ts3 = tcra.test_time();
+ BOOST_CHECK_EQUAL(ts3.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts3.tv_nsec, 0);
+}
+
+BOOST_AUTO_TEST_CASE(test_case_result_agregation_constructor_2)
+{
+ std::string jid("journal id");
+ test_case_result_agregation tcra(jid);
+ BOOST_CHECK_EQUAL(tcra.tc_average_mode(), false);
+ BOOST_CHECK_EQUAL(tcra.jid(), jid);
+ BOOST_CHECK_EQUAL(tcra.exception(), false);
+ BOOST_CHECK_EQUAL(tcra.err_code(), u_int32_t(0));
+ BOOST_CHECK_EQUAL(tcra.what(), "");
+ const timespec& ts1 = tcra.start_time();
+ BOOST_CHECK_EQUAL(ts1.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts1.tv_nsec, 0);
+ const timespec& ts2 = tcra.stop_time();
+ BOOST_CHECK_EQUAL(ts2.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts2.tv_nsec, 0);
+ const timespec& ts3 = tcra.test_time();
+ BOOST_CHECK_EQUAL(ts3.tv_sec, 0);
+ BOOST_CHECK_EQUAL(ts3.tv_nsec, 0);
+}
+
+BOOST_AUTO_TEST_CASE(test_case_result_agregation_add_test_case)
+{
+ std::string jid("jid1");
+ test_case_result::shared_ptr tcrp1 = make_result("jid1", 10, 10, 0, 1, 101010101L);
+ test_case_result::shared_ptr tcrp2 = make_result("jid1", 25, 0, 35, 10, 20202020L);
+ test_case_result::shared_ptr tcrp3 = make_result("jid1", 0, 15, 5, 2, 555555555L);
+ test_case_result::shared_ptr tcrp4 = make_result("jid2", 100, 100, 100, 100, 323232324L);
+ test_case_result::shared_ptr tcrp5 = make_result("jid1", 5, 0, 0, 0, 100L);
+ tcrp5->set_exception(std::string("error 1"), false);
+ test_case_result::shared_ptr tcrp6 = make_result("jid3", 0, 5, 0, 0, 100L);
+ jexception e(0x123, "exception 2");
+ tcrp6->set_exception(e, false);
+ test_case_result::shared_ptr tcrp7 = make_result("jid1", 0, 0, 0, 0, 0L);
+ test_case_result::shared_ptr tcrp8 = make_result("jid1", 200, 100, 300, 12, 323232224L);
+
+ test_case_result_agregation tcra(jid);
+ check_agregate(tcra, 0, 0, 0, 0, 0, 0, 0L);
+ tcra.add_test_result(tcrp1);
+ check_agregate(tcra, 10, 10, 0, 1, 0, 1, 101010101L);
+ tcra.add_test_result(tcrp2);
+ check_agregate(tcra, 35, 10, 35, 2, 0, 11, 121212121L);
+ tcra.add_test_result(tcrp3);
+ check_agregate(tcra, 35, 25, 40, 3, 0, 13, 676767676L);
+ tcra.add_test_result(tcrp4);
+ check_agregate(tcra, 35, 25, 40, 3, 0, 13, 676767676L);
+ tcra.add_test_result(tcrp5);
+ check_agregate(tcra, 40, 25, 40, 4, 1, 13, 676767776L);
+ tcra.add_test_result(tcrp6);
+ check_agregate(tcra, 40, 25, 40, 4, 1, 13, 676767776L);
+ tcra.add_test_result(tcrp7);
+ check_agregate(tcra, 40, 25, 40, 5, 1, 13, 676767776L);
+ tcra.add_test_result(tcrp8);
+ check_agregate(tcra, 240, 125, 340, 6, 1, 26, 0L);
+}
+
+BOOST_AUTO_TEST_CASE(test_case_result_agregation_add_test_case_average)
+{
+ test_case_result::shared_ptr tcrp1 = make_result("jid1", 10, 10, 0, 1, 101010101L);
+ test_case_result::shared_ptr tcrp2 = make_result("jid2", 25, 0, 35, 10, 20202020L);
+ test_case_result::shared_ptr tcrp3 = make_result("jid3", 0, 15, 5, 2, 555555555L);
+ test_case_result::shared_ptr tcrp4 = make_result("jid4", 100, 100, 100, 100, 323232324L);
+ test_case_result::shared_ptr tcrp5 = make_result("jid5", 5, 0, 0, 0, 100L);
+ tcrp5->set_exception(std::string("error 1"), false);
+ test_case_result::shared_ptr tcrp6 = make_result("jid6", 0, 5, 0, 0, 100L);
+ jexception e(0x123, "exception 2");
+ tcrp6->set_exception(e, false);
+ test_case_result::shared_ptr tcrp7 = make_result("jid7", 0, 0, 0, 0, 0L);
+ test_case_result::shared_ptr tcrp8 = make_result("jid8", 200, 100, 300, 12, 222222022L);
+
+ test_case_result_agregation tcra;
+ check_agregate(tcra, 0, 0, 0, 0, 0, 0, 0L);
+ tcra.add_test_result(tcrp1);
+ check_agregate(tcra, 10, 10, 0, 1, 0, 1, 101010101L);
+ tcra.add_test_result(tcrp2);
+ check_agregate(tcra, 35, 10, 35, 2, 0, 11, 121212121L);
+ tcra.add_test_result(tcrp3);
+ check_agregate(tcra, 35, 25, 40, 3, 0, 13, 676767676L);
+ tcra.add_test_result(tcrp4);
+ check_agregate(tcra, 135, 125, 140, 4, 0, 114, 0L);
+ tcra.add_test_result(tcrp5);
+ check_agregate(tcra, 140, 125, 140, 5, 1, 114, 100L);
+ tcra.add_test_result(tcrp6);
+ check_agregate(tcra, 140, 130, 140, 6, 2, 114, 200L);
+ tcra.add_test_result(tcrp7);
+ check_agregate(tcra, 140, 130, 140, 7, 2, 114, 200L);
+ tcra.add_test_result(tcrp8);
+ check_agregate(tcra, 340, 230, 440, 8, 2, 126, 222222222L);
+}
+
+
+// Helper functions
+
+void check_agregate(const test_case_result_agregation& tcra, const u_int32_t num_enq,
+ const u_int32_t num_deq, const u_int32_t num_reads, const u_int32_t num_results,
+ const u_int32_t num_exceptions, const time_t secs, const long nsec)
+{
+ BOOST_CHECK_EQUAL(tcra.num_enq(), num_enq);
+ BOOST_CHECK_EQUAL(tcra.num_deq(), num_deq);
+ BOOST_CHECK_EQUAL(tcra.num_read(), num_reads);
+ BOOST_CHECK_EQUAL(tcra.num_results(), num_results);
+ BOOST_CHECK_EQUAL(tcra.num_exceptions(), num_exceptions);
+ BOOST_CHECK_EQUAL(tcra.exception(), num_exceptions > 0);
+ const timespec& ts1 = tcra.test_time();
+ BOOST_CHECK_EQUAL(ts1.tv_sec, secs);
+ BOOST_CHECK_EQUAL(ts1.tv_nsec, nsec);
+}
+
+test_case_result::shared_ptr make_result(const std::string& jid, const u_int32_t num_enq,
+ const u_int32_t num_deq, const u_int32_t num_reads, const time_t secs, const long nsec)
+{
+ test_case_result::shared_ptr tcrp(new test_case_result(jid));
+ for (unsigned i=0; i<num_enq; i++)
+ tcrp->incr_num_enq();
+ for (unsigned i=0; i<num_deq; i++)
+ tcrp->incr_num_deq();
+ for (unsigned i=0; i<num_reads; i++)
+ tcrp->incr_num_read();
+ timespec ts;
+ ts.tv_sec = secs;
+ ts.tv_nsec = nsec;
+ tcrp->set_test_time(ts);
+ return tcrp;
+}
Added: store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,130 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 <sys/stat.h>
+#include "test_case.hpp"
+#include "test_case_set.hpp"
+
+using namespace boost::unit_test;
+using namespace rhm::jtt;
+
+QPID_AUTO_TEST_SUITE(jtt_test_case_set)
+
+// helper fn forward decls
+bool check_csv_file(const char* filename);
+
+const std::string csv_file("_ut_test_case_set.csv");
+
+BOOST_AUTO_TEST_CASE(test_case_set_constructor)
+{
+ test_case_set tcs;
+ BOOST_CHECK(tcs.empty());
+ BOOST_CHECK_EQUAL(tcs.size(), unsigned(0));
+}
+
+BOOST_AUTO_TEST_CASE(test_case_set_append_1)
+{
+ const unsigned test_case_num = 0x12345;
+ const u_int32_t num_msgs = 0x100;
+ const size_t min_data_size = 0x1000;
+ const size_t max_data_size = 0;
+ const bool auto_deq = true;
+ const size_t min_xid_size = 0x200;
+ const size_t max_xid_size = 0x200;
+ using rhm::jtt::test_case;
+ const test_case::transient_t transient = test_case::JTT_PERSISTNET;
+ const test_case::external_t external = test_case::JDL_INTERNAL;
+ const std::string comment = "This is a test";
+
+ test_case_set tcs;
+ tcs.append(test_case_num, num_msgs, min_data_size, max_data_size, auto_deq, min_xid_size,
+ max_xid_size, transient, external, comment);
+ BOOST_CHECK(!tcs.empty());
+ BOOST_CHECK_EQUAL(tcs.size(), unsigned(1));
+ test_case::shared_ptr tcp = tcs[0];
+ BOOST_CHECK_EQUAL(tcp->test_case_num(), test_case_num);
+ BOOST_CHECK_EQUAL(tcp->num_msgs(), num_msgs);
+ BOOST_CHECK_EQUAL(tcp->min_data_size(), min_data_size);
+ BOOST_CHECK_EQUAL(tcp->max_data_size(), max_data_size);
+ BOOST_CHECK_EQUAL(tcp->min_xid_size(), min_xid_size);
+ BOOST_CHECK_EQUAL(tcp->max_xid_size(), max_xid_size);
+ BOOST_CHECK_EQUAL(tcp->transient(), transient);
+ BOOST_CHECK_EQUAL(tcp->external(), external);
+ BOOST_CHECK_EQUAL(tcp->comment(), comment);
+}
+
+BOOST_AUTO_TEST_CASE(test_case_set_append_2)
+{
+ const unsigned test_case_num = 0x12345;
+ const u_int32_t num_msgs = 0x100;
+ const size_t min_data_size = 0x1000;
+ const size_t max_data_size = 0;
+ const bool auto_deq = true;
+ const size_t min_xid_size = 0x200;
+ const size_t max_xid_size = 0x200;
+ using rhm::jtt::test_case;
+ const test_case::transient_t transient = test_case::JTT_PERSISTNET;
+ const test_case::external_t external = test_case::JDL_INTERNAL;
+ const std::string comment = "This is a test";
+
+ test_case::shared_ptr tcp(new test_case(test_case_num, num_msgs, min_data_size, max_data_size,
+ auto_deq, min_xid_size, max_xid_size, transient, external, comment));
+ test_case_set tcs;
+ tcs.append(tcp);
+ BOOST_CHECK(!tcs.empty());
+ BOOST_CHECK_EQUAL(tcs.size(), unsigned(1));
+ tcp = tcs[0];
+ BOOST_CHECK_EQUAL(tcp->test_case_num(), test_case_num);
+ BOOST_CHECK_EQUAL(tcp->num_msgs(), num_msgs);
+ BOOST_CHECK_EQUAL(tcp->min_data_size(), min_data_size);
+ BOOST_CHECK_EQUAL(tcp->max_data_size(), max_data_size);
+ BOOST_CHECK_EQUAL(tcp->min_xid_size(), min_xid_size);
+ BOOST_CHECK_EQUAL(tcp->max_xid_size(), max_xid_size);
+ BOOST_CHECK_EQUAL(tcp->transient(), transient);
+ BOOST_CHECK_EQUAL(tcp->external(), external);
+ BOOST_CHECK_EQUAL(tcp->comment(), comment);
+}
+
+BOOST_AUTO_TEST_CASE(test_case_set_append_from_csv)
+{
+ test_case_set tcs;
+ BOOST_REQUIRE_MESSAGE(check_csv_file(csv_file.c_str()), "Test CSV file \"" << csv_file <<
+ "\" is missing.");
+ unsigned num_tcs = tcs.append_from_csv(csv_file);
+ BOOST_CHECK(!tcs.empty());
+ BOOST_CHECK_EQUAL(num_tcs, unsigned(44));
+ BOOST_CHECK_EQUAL(tcs.size(), unsigned(44));
+}
+
+
+// Helper functions
+bool check_csv_file(const char* filename)
+{
+ struct stat s;
+ if (::stat(filename, &s))
+ return false;
+ if (S_ISREG(s.st_mode))
+ return true;
+ return false;
+}
Added: store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.csv
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.csv (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.csv 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,76 @@
+# Copyright (C) 2008 Red Hat Inc.
+#
+# This file is part of Red Hat Messaging.
+#
+# Red Hat Messaging 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.
+
+,,,,,,,"Msg size",,"Xid size",,,,,"enq-size",,"deq-size",,"txn-size",,
+"Col. 0","1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"
+"Test #","tf","pf","amn","mn incr","#msgs","ms incr","Min","Max","Min","Max","auto-deq","transient","extern","bytes","dblks","bytes","dblks","bytes","dblks","comment"
+,,,,,,,,,,,,,,,,,,,,
+"Initialize only",,,,,,,,,,,,,,,,,,,,
+0,"L",0,0,0,0,0,0,0,0,0,FALSE,FALSE,FALSE,44,1,0,0,0,0,"No messages - journal creation/initialization only"
+,,,,,,,,,,,,,,,,,,,,
+"Simple message combinations of persistent/deq transientueued/non-dequeued, transactional/non-transactional",,,,,,,,,,,,,,,,,,,,
+1,"L",1,1,0,1,0,10,10,0,0,FALSE,FALSE,FALSE,54,1,0,0,0,0,"1 * 10-byte message"
+2,"L",1,10,0,10,0,10,10,0,0,FALSE,FALSE,FALSE,54,1,0,0,0,0,"10 * 10-byte message"
+3,"L",1,1,0,1,0,10,10,0,0,FALSE,TRUE,FALSE,54,1,0,0,0,0,"1 * 10-byte message [transient]"
+4,"L",1,10,0,10,0,10,10,0,0,FALSE,TRUE,FALSE,54,1,0,0,0,0,"10 * 10-byte message [transient]"
+5,"L",1,1,0,1,0,10,10,10,10,FALSE,FALSE,FALSE,64,1,0,0,0,0,"1 * 10-byte message [txn]"
+6,"L",1,10,0,10,0,10,10,10,10,FALSE,FALSE,FALSE,64,1,0,0,0,0,"10 * 10-byte message [txn]"
+7,"L",1,1,0,1,0,10,10,10,10,FALSE,TRUE,FALSE,64,1,0,0,0,0,"1 * 10-byte message [txn transient]"
+8,"L",1,10,0,10,0,10,10,10,10,FALSE,TRUE,FALSE,64,1,0,0,0,0,"10 * 10-byte message [txn transient]"
+9,"L",1,1,0,1,0,10,10,0,0,TRUE,FALSE,FALSE,54,1,32,1,0,0,"1 * 10-byte message [deq]"
+10,"L",1,10,0,10,0,10,10,0,0,TRUE,FALSE,FALSE,54,1,32,1,0,0,"10 * 10-byte message [deq]"
+11,"L",1,1,0,1,0,10,10,0,0,TRUE,TRUE,FALSE,54,1,32,1,0,0,"1 * 10-byte message [deq transient]"
+12,"L",1,10,0,10,0,10,10,0,0,TRUE,TRUE,FALSE,54,1,32,1,0,0,"10 * 10-byte message [deq transient]"
+13,"L",1,1,0,1,0,10,10,10,10,TRUE,FALSE,FALSE,64,1,54,1,46,1,"1 * 10-byte message [deq txn]"
+14,"L",1,10,0,10,0,10,10,10,10,TRUE,FALSE,FALSE,64,1,54,1,46,1,"10 * 10-byte message [deq txn]"
+15,"L",1,1,0,1,0,10,10,10,10,TRUE,TRUE,FALSE,64,1,54,1,46,1,"1 * 10-byte message [txn deq transient]"
+16,"L",1,10,0,10,0,10,10,10,10,TRUE,TRUE,FALSE,64,1,54,1,46,1,"10 * 10-byte message [txn deq transient]"
+17,"L",1,1,0,1,0,10,10,0,0,FALSE,FALSE,TRUE,54,1,0,0,0,0,"1 * 10-byte message [extern]"
+18,"L",1,10,0,10,0,10,10,0,0,FALSE,FALSE,TRUE,54,1,0,0,0,0,"10 * 10-byte message [extern]"
+19,"L",1,1,0,1,0,10,10,0,0,FALSE,TRUE,TRUE,54,1,0,0,0,0,"1 * 10-byte message [transient extern]"
+20,"L",1,10,0,10,0,10,10,0,0,FALSE,TRUE,TRUE,54,1,0,0,0,0,"10 * 10-byte message [transient extern]"
+21,"L",1,1,0,1,0,10,10,10,10,FALSE,FALSE,TRUE,64,1,0,0,0,0,"1 * 10-byte message [txn extern]"
+22,"L",1,10,0,10,0,10,10,10,10,FALSE,FALSE,TRUE,64,1,0,0,0,0,"10 * 10-byte message [txn extern]"
+23,"L",1,1,0,1,0,10,10,10,10,FALSE,TRUE,TRUE,64,1,0,0,0,0,"1 * 10-byte message [txn transient extern]"
+24,"L",1,10,0,10,0,10,10,10,10,FALSE,TRUE,TRUE,64,1,0,0,0,0,"10 * 10-byte message [txn transient extern]"
+25,"L",1,1,0,1,0,10,10,0,0,TRUE,FALSE,TRUE,54,1,32,1,0,0,"1 * 10-byte message [deq extern]"
+26,"L",1,10,0,10,0,10,10,0,0,TRUE,FALSE,TRUE,54,1,32,1,0,0,"10 * 10-byte message [deq extern]"
+27,"L",1,1,0,1,0,10,10,0,0,TRUE,TRUE,TRUE,54,1,32,1,0,0,"1 * 10-byte message [deq transient extern]"
+28,"L",1,10,0,10,0,10,10,0,0,TRUE,TRUE,TRUE,54,1,32,1,0,0,"10 * 10-byte message [deq transient extern]"
+29,"L",1,1,0,1,0,10,10,10,10,TRUE,FALSE,TRUE,64,1,54,1,46,1,"1 * 10-byte message [deq txn extern]"
+30,"L",1,10,0,10,0,10,10,10,10,TRUE,FALSE,TRUE,64,1,54,1,46,1,"10 * 10-byte message [deq txn extern]"
+31,"L",1,1,0,1,0,10,10,10,10,TRUE,TRUE,TRUE,64,1,54,1,46,1,"1 * 10-byte message [txn deq transient extern]"
+32,"L",1,10,0,10,0,10,10,10,10,TRUE,TRUE,TRUE,64,1,54,1,46,1,"10 * 10-byte message [txn deq transient extern]"
+,,,,,,,,,,,,,,,,,,,,
+"High volume tests of random message lengths - RHM_WRONLY req'd for auto-dequeue == FALSE",,,,,,,,,,,,,,,,,,,,
+33,"M",1,5000000,0,5000000,0,0,100,1,100,FALSE,RANDOM,RANDOM,244,2,0,0,0,0,"100 bytes xid max + 100 bytes data max [txn]"
+34,"M",3,3000000,0,3000000,0,0,300,1,300,FALSE,RANDOM,RANDOM,644,6,0,0,0,0,"300 bytes xid max + 300 bytes data max [txn]"
+35,"M",10,1600000,0,1600000,0,0,1000,1,1000,FALSE,RANDOM,RANDOM,2044,16,0,0,0,0,"1000 bytes xid max + 1000 bytes data max [txn]"
+36,"M",30,600000,0,600000,0,0,3000,1,3000,FALSE,RANDOM,RANDOM,6044,48,0,0,0,0,"3000 bytes xid max + 3000 bytes data max [txn]"
+37,"M",100,200000,0,200000,0,0,10000,1,10000,FALSE,RANDOM,RANDOM,20044,157,0,0,0,0,"10000 bytes xid max + 10000 bytes data max [txn]"
+38,"M",300,60000,0,60000,0,0,30000,1,30000,FALSE,RANDOM,RANDOM,60044,470,0,0,0,0,"30000 bytes xid max + 30000 bytes data max [txn]"
+39,"M",1000,20000,0,20000,0,0,100000,1,100000,FALSE,RANDOM,RANDOM,200044,1563,0,0,0,0,"100000 bytes xid max + 100000 bytes data max [txn]"
+,,,,,,,,,,,,,,,,,,,,
+"STANDARD PERFORMANCE BENCHMARK: 10,000,000 writes, data=212b (2 dblks)",,,,,,,,,,,,,,,,,,,,
+40,"M",1,10000000,0,10000000,0,212,212,0,0,FALSE,FALSE,FALSE,256,2,0,0,0,0,"212 bytes data (2 dblks enq)"
+41,"M",1,10000000,0,10000000,0,148,148,64,64,FALSE,FALSE,FALSE,256,2,0,0,0,0,"148 bytes data + 64 bytes xid (2 dblks enq)"
+42,"M",1,10000000,0,10000000,0,212,212,0,0,TRUE,FALSE,FALSE,256,2,32,1,0,0,"212 bytes data (2 dblks enq + 1 dblk deq)"
+43,"M",1,10000000,0,10000000,0,148,148,64,64,TRUE,FALSE,FALSE,256,2,108,1,100,1,"148 bytes data + 64 bytes xid (2 dblks enq + 1 dblks deq + 1 dblks txn)"
Added: store/trunk/cpp/tests/jrnl/jtt/bootstrap
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/bootstrap (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/bootstrap 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# Copyright (C) 2008 Red Hat Inc.
+#
+# This file is part of Red Hat Messaging.
+#
+# Red Hat Messaging 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.
+
+autoreconf --install
Property changes on: store/trunk/cpp/tests/jrnl/jtt/bootstrap
___________________________________________________________________
Name: svn:executable
+ *
Added: store/trunk/cpp/tests/jrnl/jtt/configure.ac
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/configure.ac (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/configure.ac 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,29 @@
+dnl # Copyright (C) 2008 Red Hat Inc.
+dnl #
+dnl # This file is part of Red Hat Messaging.
+dnl #
+dnl # Red Hat Messaging is free software; you can redistribute it and/or
+dnl # modify it under the terms of the GNU Lesser General Public
+dnl # License as published by the Free Software Foundation; either
+dnl # version 2.1 of the License, or (at your option) any later version.
+dnl #
+dnl # This library is distributed in the hope that it will be useful,
+dnl # but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl # Lesser General Public License for more details.
+dnl #
+dnl # You should have received a copy of the GNU Lesser General Public
+dnl # License along with this library; if not, write to the Free Software
+dnl # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+dnl # USA
+dnl #
+dnl # The GNU Lesser General Public License is available in the file COPYING.
+
+AC_INIT([Journal Test Tool], [0.1], [kim.vdriet at redhat.com])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+AC_PROG_CXX
+AC_CONFIG_HEADERS([config.hpp])
+AC_CONFIG_FILES([
+ Makefile
+])
+AC_OUTPUT
Added: store/trunk/cpp/tests/jrnl/jtt/data_src.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/data_src.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/data_src.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,64 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "data_src.hpp"
+
+namespace rhm
+{
+namespace jtt
+{
+
+char data_src::_data_src[data_src::max_dsize];
+char data_src::_xid_src[data_src::max_xsize];
+bool data_src::_initialized = data_src::__init();
+
+data_src::data_src()
+{}
+
+bool
+data_src::__init()
+{
+ for (unsigned i=0; i<max_dsize; i++)
+ _data_src[i] = '0' + ((i + 1) % 10); // 123456789012345...
+ for (unsigned j=0; j<max_xsize; j++)
+ _xid_src[j] = 'a' + (j % 26); // abc...xyzabc...
+ return true;
+}
+
+const char* const
+data_src::get_data(const size_t offs)
+{
+ if (offs >= max_dsize) return 0;
+ return _data_src + offs;
+}
+
+const char* const
+data_src::get_xid(const size_t offs)
+{
+ if (offs >= max_xsize) return 0;
+ return _xid_src + offs;
+}
+
+} // namespace jtt
+} // namespace rhm
+
Added: store/trunk/cpp/tests/jrnl/jtt/data_src.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/data_src.hpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/data_src.hpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,54 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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.
+*/
+
+#ifndef rhm_jtt_data_src_hpp
+#define rhm_jtt_data_src_hpp
+
+#include <sys/types.h>
+
+namespace rhm
+{
+namespace jtt
+{
+ class data_src
+ {
+ public:
+ static const size_t max_dsize = 1024 * 1024;
+ static const size_t max_xsize = 1024 * 1024;
+
+ private:
+ static char _data_src[];
+ static char _xid_src[];
+ static bool _initialized;
+ static bool __init();
+ data_src();
+
+ public:
+ static const char* const get_data(const size_t offs);
+ static const char* const get_xid(const size_t offs);
+ };
+
+} // namespace jtt
+} // namespace rhm
+
+#endif // ifndef rhm_jtt_data_src_hpp
Added: store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,733 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2007,2008 Red Hat Inc.
+#
+# This file is part of Red Hat Messaging.
+#
+# Red Hat Messaging 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.
+
+import sys
+import getopt
+import xml.parsers.expat
+from struct import unpack, calcsize
+from time import gmtime, strftime
+
+dblk_size = 128
+sblk_size = 4 * dblk_size
+jfsize = None
+hdr_ver = 1
+
+TEST_NUM_COL = 0
+NUM_MSGS_COL = 5
+MIN_MSG_SIZE_COL = 7
+MAX_MSG_SIZE_COL = 8
+MIN_XID_SIZE_COL = 9
+MAX_XID_SIZE_COL = 10
+AUTO_DEQ_COL = 11
+TRANSIENT_COL = 12
+EXTERN_COL = 13
+COMMENT_COL = 20
+
+owi_mask = 0x01
+transient_mask = 0x10
+extern_mask = 0x20
+
+#== global functions ===========================================================
+
+def load(f, klass):
+ args = load_args(f, klass)
+ subclass = klass.descriminate(args)
+ result = subclass(*args)
+ if subclass != klass:
+ result.init(f, *load_args(f, subclass))
+ result.skip(f)
+ return result;
+
+def load_args(f, klass):
+ size = calcsize(klass.format)
+ foffs = f.tell(),
+ bin = f.read(size)
+ if len(bin) != size:
+ raise Exception("end of file")
+ return foffs + unpack(klass.format, bin)
+
+def size_blks(size, blk_size):
+ return (size + blk_size - 1)/blk_size
+
+def rem_in_blk(f, blk_size):
+ foffs = f.tell()
+ return (size_blks(f.tell(), blk_size) * blk_size) - foffs;
+
+def file_full(f):
+ return f.tell() >= jfsize
+
+def print_xid(xidsize, xid):
+ if xid == None:
+ if xidsize > 0:
+ raise Exception('Inconsistent XID size: xidsize=%d, xid=None' % xidsize)
+ return ''
+ if len(xid) > 25:
+ xidstr = xid[:10] + ' ... ' + xid[-10:]
+ else:
+ xidstr = xid
+ if xidsize != len(xid):
+ raise Exception('Inconsistent XID size: xidsize=%d, xid(%d)=\"%s\"' % (xidsize, len(xid), xidstr))
+ return 'xid(%d)=\"%s\" ' % (xidsize, xidstr)
+
+def print_data(dsize, data):
+ if data == None:
+ return ''
+ if len(data) > 25:
+ datastr = data[:10] + ' ... ' + data[-10:]
+ else:
+ datastr = data
+ if dsize != len(data):
+ raise Exception('Inconsistent data size: dsize=%d, data(%d)=\"%s\"' % (dsize, len(data), datastr))
+ return 'data(%d)=\"%s\" ' % (dsize, datastr)
+
+def inv_str(s):
+ si = ''
+ for i in range(0,len(s)):
+ si += chr(~ord(s[i]) & 0xff)
+ return si
+
+def load_file_data(f, size, data):
+ if size == 0:
+ return (data, True)
+ if data == None:
+ loaded = 0
+ else:
+ loaded = len(data)
+ foverflow = f.tell() + size - loaded > jfsize
+ if foverflow:
+ rsize = jfsize - f.tell()
+ else:
+ rsize = size - loaded
+ bin = f.read(rsize)
+ if data == None:
+ data = unpack('%ds' % (rsize), bin)[0]
+ else:
+ data = data + unpack('%ds' % (rsize), bin)[0]
+ return (data, not foverflow)
+
+def exit(code, qflag):
+ if code != 0 or not qflag:
+ print out.getvalue()
+ out.close()
+ sys.exit(code)
+
+#== class Sizeable =============================================================
+
+class Sizeable:
+
+ def size(self):
+ classes = [self.__class__]
+
+ size = 0
+ while classes:
+ cls = classes.pop()
+ if hasattr(cls, "format"):
+ size += calcsize(cls.format)
+ classes.extend(cls.__bases__)
+
+ return size
+
+
+#== class Hdr ==================================================================
+
+class Hdr(Sizeable):
+
+ format = '=4sBBHQ'
+
+ @staticmethod
+ def descriminate(args):
+ return CLASSES.get(args[1][-1], Hdr)
+
+ def __init__(self, foffs, magic, ver, end, flags, rid):
+ self.foffs = foffs
+ self.magic = magic
+ self.ver = ver
+ self.end = end
+ self.flags = flags
+ self.rid = rid
+ if self.magic[-1] not in ['0x00', 'a', 'c', 'd', 'e', 'f', 'x']:
+ error = 3
+
+ def __str__(self):
+ if self.empty():
+ return '0x%08x: <empty>' % (self.foffs)
+ if self.magic[-1] == 'x':
+ return '0x%08x: \"%s\"' % (self.foffs, self.magic)
+ if self.magic[-1] in ['a', 'c', 'd', 'e', 'f', 'x']:
+ return '0x%08x: \"%s\" v=%d e=%d f=0x%04x rid=%d' % (self.foffs, self.magic, self.ver, self.end, self.flags, self.rid)
+ return '0x%08x: <error, unknown magic \"%s\" (possible overwrite boundary?)>' % (self.foffs, self.magic)
+
+ def empty(self):
+ return self.magic == '\x00'*4
+
+ def owi(self):
+ return self.flags & owi_mask != 0
+
+ def skip(self, f):
+ f.read(rem_in_blk(f, dblk_size))
+
+ def check(self):
+ if self.empty() or self.magic[-1] not in ['a', 'c', 'd', 'e', 'f', 'x']:
+ return True
+ if self.ver != hdr_ver and self.magic[-1] != 'x':
+ raise Exception('%s: Invalid header version: found %d, expected %d.' % (self, self.ver, hdr_ver))
+ return False
+
+
+#== class FileHdr ==============================================================
+
+class FileHdr(Hdr):
+
+ format = '=I4x3Q'
+
+ def init(self, f, foffs, fid, fro, time_sec, time_ns):
+ self.fid = fid
+ self.fro = fro
+ self.time_sec = time_sec
+ self.time_ns = time_ns
+
+ def __str__(self):
+ return '%s fid=%d fro=0x%08x t=%s' % (Hdr.__str__(self), self.fid, self.fro, self.timestamp_str())
+
+ def skip(self, f):
+ f.read(rem_in_blk(f, sblk_size))
+
+ def timestamp(self):
+ return (self.time_sec, self.time_ns)
+
+ def timestamp_str(self):
+ ts = gmtime(self.time_sec)
+ fstr = '%%a %%b %%d %%H:%%M:%%S.%d %%Y' % (self.time_ns)
+ return strftime(fstr, ts)
+
+
+#== class DeqHdr ===============================================================
+
+class DeqHdr(Hdr):
+
+ format = '=QQ'
+
+ def init(self, f, foffs, deq_rid, xidsize):
+ self.deq_rid = deq_rid
+ self.xidsize = xidsize
+ self.xid = None
+ self.deq_tail = None
+ self.xid_complete = False
+ self.tail_complete = False
+ self.tail_bin = None
+ self.tail_offs = 0
+ self.load(f)
+
+ def load(self, f):
+ if self.xidsize == 0:
+ self.xid_complete = True
+ self.tail_complete = True
+ else:
+ if not self.xid_complete:
+ ret = load_file_data(f, self.xidsize, self.xid)
+ self.xid = ret[0]
+ self.xid_complete = ret[1]
+ if self.xid_complete and not self.tail_complete:
+ ret = load_file_data(f, calcsize(RecTail.format), self.tail_bin)
+ self.tail_bin = ret[0]
+ if ret[1]:
+ self.enq_tail = RecTail(self.tail_offs, *unpack(RecTail.format, self.tail_bin))
+ if self.enq_tail.magic_inv != inv_str(self.magic) or self.enq_tail.rid != self.rid:
+ print " > %s" % self
+ raise Exception('Invalid enqueue record tail (magic=0x%08x; rid=%d) at 0x%08x' % (self.enq_tail.magic_inv, self.enq_tail.rid, self.enq_tail.foffs))
+ self.enq_tail.skip(f)
+ self.tail_complete = ret[1]
+ return self.complete()
+
+ def complete(self):
+ return self.xid_complete and self.tail_complete
+
+ def __str__(self):
+ return '%s %sdrid=%d' % (Hdr.__str__(self), print_xid(self.xidsize, self.xid), self.deq_rid)
+
+
+#== class TxnHdr ===============================================================
+
+class TxnHdr(Hdr):
+
+ format = '=Q'
+
+ def init(self, f, foffs, xidsize):
+ self.xidsize = xidsize
+ self.xid = None
+ self.tx_tail = None
+ self.xid_complete = False
+ self.tail_complete = False
+ self.tail_bin = None
+ self.tail_offs = 0
+ self.load(f)
+
+ def load(self, f):
+ if not self.xid_complete:
+ ret = load_file_data(f, self.xidsize, self.xid)
+ self.xid = ret[0]
+ self.xid_complete = ret[1]
+ if self.xid_complete and not self.tail_complete:
+ ret = load_file_data(f, calcsize(RecTail.format), self.tail_bin)
+ self.tail_bin = ret[0]
+ if ret[1]:
+ self.enq_tail = RecTail(self.tail_offs, *unpack(RecTail.format, self.tail_bin))
+ if self.enq_tail.magic_inv != inv_str(self.magic) or self.enq_tail.rid != self.rid:
+ print " > %s" % self
+ raise Exception('Invalid enqueue record tail (magic=0x%08x; rid=%d) at 0x%08x' % (self.enq_tail.magic_inv, self.enq_tail.rid, self.enq_tail.foffs))
+ self.enq_tail.skip(f)
+ self.tail_complete = ret[1]
+ return self.complete()
+
+ def complete(self):
+ return self.xid_complete and self.tail_complete
+
+ def __str__(self):
+ return '%s %s' % (Hdr.__str__(self), print_xid(self.xidsize, self.xid))
+
+
+#== class RecTail ==============================================================
+
+class RecTail(Sizeable):
+
+ format = '=4sQ'
+
+ def __init__(self, foffs, magic_inv, rid):
+ self.foffs = foffs
+ self.magic_inv = magic_inv
+ self.rid = rid
+
+ def __str__(self):
+ magic = inv_str(self.magic_inv)
+ return '[\"%s\" rid=%d]' % (magic, self.rid)
+
+ def skip(self, f):
+ f.read(rem_in_blk(f, dblk_size))
+
+
+#== class EnqRec ===============================================================
+
+class EnqRec(Hdr):
+
+ format = '=QQ'
+
+ def init(self, f, foffs, xidsize, dsize):
+ self.xidsize = xidsize
+ self.dsize = dsize
+ self.transient = self.flags & transient_mask > 0
+ self.extern = self.flags & extern_mask > 0
+ self.xid = None
+ self.data = None
+ self.enq_tail = None
+ self.xid_complete = False
+ self.data_complete = False
+ self.tail_complete = False
+ self.tail_bin = None
+ self.tail_offs = 0
+ self.load(f)
+
+ def load(self, f):
+ if not self.xid_complete:
+ ret = load_file_data(f, self.xidsize, self.xid)
+ self.xid = ret[0]
+ self.xid_complete = ret[1]
+ if self.xid_complete and not self.data_complete:
+ if self.extern:
+ self.data_complete = True
+ else:
+ ret = load_file_data(f, self.dsize, self.data)
+ self.data = ret[0]
+ self.data_complete = ret[1]
+ if self.data_complete and not self.tail_complete:
+ ret = load_file_data(f, calcsize(RecTail.format), self.tail_bin)
+ self.tail_bin = ret[0]
+ if ret[1]:
+ self.enq_tail = RecTail(self.tail_offs, *unpack(RecTail.format, self.tail_bin))
+ if self.enq_tail.magic_inv != inv_str(self.magic) or self.enq_tail.rid != self.rid:
+ print " > %s" % self
+ raise Exception('Invalid enqueue record tail (magic=0x%08x; rid=%d) at 0x%08x' % (self.enq_tail.magic_inv, self.enq_tail.rid, self.enq_tail.foffs))
+ self.enq_tail.skip(f)
+ self.tail_complete = ret[1]
+ return self.complete()
+
+ def complete(self):
+ return self.xid_complete and self.data_complete and self.tail_complete
+
+ def print_flags(self):
+ s = ''
+ if self.transient:
+ s = '*TRANSIENT'
+ if self.extern:
+ if len(s) > 0:
+ s += ',EXTERNAL'
+ else:
+ s = '*EXTERNAL'
+ if len(s) > 0:
+ s += '*'
+ return s
+
+ def __str__(self):
+ return '%s %s%s %s %s' % (Hdr.__str__(self), print_xid(self.xidsize, self.xid), print_data(self.dsize, self.data), self.enq_tail, self.print_flags())
+
+
+#== class Main =================================================================
+
+class Main:
+ def __init__(self, argv):
+ self.bfn = None
+ self.csvfn = None
+ self.jdir = None
+ self.hflag = False
+ self.qflag = False
+ self.tnum = None
+ self.num_jfiles = None
+ self.num_msgs = None
+ self.msg_len = None
+ self.auto_deq = None
+ self.xid_len = None
+ self.transient = None
+ self.extern = None
+
+ self.file_start = 0
+ self.file_num = 0
+ self.fro = 0x200
+ self.enqueued = {}
+ self.msg_cnt = 0
+ self.fhdr = None
+ self.f = None
+ self.first_rec = False
+ self.last_file = False
+ self.last_rid = -1
+
+ self.proc_args(argv)
+ self.proc_csv()
+ self.read_jinf()
+
+ def run(self):
+ try:
+ start_info = self.analyze_files()
+ stop = self.advance_file(*start_info)
+ except Exception:
+ print 'WARNING: All journal files are empty.'
+ if self.num_msgs > 0:
+ raise Exception('All journal files are empty, but %d msgs expectd.' % self.num_msgs)
+ else:
+ stop = True
+ while not stop:
+ warn = ''
+ if file_full(self.f):
+ stop = self.advance_file()
+ if stop:
+ break
+ hdr = load(self.f, Hdr)
+ if hdr.empty():
+ stop = True;
+ break
+ if hdr.check():
+ stop = True;
+ if self.first_rec:
+ if self.fhdr.fro != hdr.foffs:
+ raise Exception('File header first record offset mismatch: fro=0x%08x; rec_offs=0x%08x' % (self.fhdr.fro, hdr.foffs))
+ else:
+ if not self.qflag: print ' * fro ok: 0x%08x' % self.fhdr.fro
+ self.first_rec = False
+ if isinstance(hdr, EnqRec) and not stop:
+ while not hdr.complete():
+ stop = self.advance_file()
+ if stop:
+ break
+ hdr.load(self.f)
+ if self.extern != None:
+ if hdr.extern:
+ if hdr.data != None:
+ raise Exception('Message data found on external record')
+ else:
+ if self.msg_len > 0 and len(hdr.data) != self.msg_len:
+ raise Exception('Message length (%d) incorrect; expected %d' % (len(hdr.data), self.msg_len))
+ else:
+ if self.msg_len > 0 and len(hdr.data) != self.msg_len:
+ raise Exception('Message length (%d) incorrect; expected %d' % (len(hdr.data), self.msg_len))
+ if self.xid_len > 0 and len(hdr.xid) != self.xid_len:
+ print ' ERROR: XID length (%d) incorrect; expected %d' % (len(hdr.xid), self.xid_len)
+ sys.exit(1)
+ #raise Exception('XID length (%d) incorrect; expected %d' % (len(hdr.xid), self.xid_len))
+ if self.transient != None:
+ if self.transient:
+ if not hdr.transient:
+ raise Exception('Expected transient record, found persistent')
+ else:
+ if hdr.transient:
+ raise Exception('Expected persistent record, found transient')
+ stop = not self.check_rid(hdr)
+ if stop:
+ warn = ' (WARNING: rid out of order, rid = %d; last rid = %d - could be overwrite boundary.)' % (hdr.rid, self.last_rid)
+ else:
+ self.msg_cnt += 1
+ if self.auto_deq:
+ self.enqueued[hdr.rid] = hdr
+ elif isinstance(hdr, DeqHdr) and not stop:
+ while not hdr.complete():
+ stop = self.advance_file()
+ if stop:
+ break
+ hdr.load(self.f)
+ if self.auto_deq:
+ if hdr.deq_rid in self.enqueued:
+ del self.enqueued[hdr.deq_rid]
+ else:
+ warn = ' (WARNING: dequeue rid %d not found in enqueued records)' % hdr.deq_rid
+ stop = not self.check_rid(hdr)
+ if stop:
+ warn = ' (WARNING: rid out of order, rid = %d; last rid = %d - could be overwrite boundary.)' % (hdr.rid, self.last_rid)
+ elif self.auto_deq != None:
+ if not self.auto_deq:
+ warn = ' WARNING: Dequeue record rid=%d found in non-dequeue test - ignoring.' % hdr.rid
+ elif isinstance(hdr, TxnHdr) and not stop:
+ while not hdr.complete():
+ stop = self.advance_file()
+ if stop:
+ break
+ hdr.load(self.f)
+ stop = not self.check_rid(hdr)
+ if stop:
+ warn = ' (WARNING: rid out of order, rid = %d; last rid = %d - could be overwrite boundary.)' % (hdr.rid, self.last_rid)
+ if not self.qflag: print ' > %s%s' % (hdr, warn)
+ if not stop:
+ stop = (self.last_file and hdr.check()) or hdr.empty() or self.fhdr.empty()
+
+ def analyze_files(self):
+ fname = ''
+ fnum = -1
+ rid = -1
+ fro = -1
+ tss = ''
+ if not self.qflag: print 'Analyzing journal files:'
+ owi_found = False
+ for i in range(0, self.num_jfiles):
+ jfn = self.jdir + '/' + self.bfn + '.%04d.jdat' % i
+ f = open(jfn)
+ fhdr = load(f, Hdr)
+ if fhdr.empty():
+ if not self.qflag:
+ print ' %s: file empty' % jfn
+ break
+ if i == 0:
+ init_owi = fhdr.owi()
+ fname = jfn
+ fnum = i
+ rid = fhdr.rid
+ fro = fhdr.fro
+ tss = fhdr.timestamp_str()
+ elif fhdr.owi() != init_owi and not owi_found:
+ fname = jfn
+ fnum = i
+ rid = fhdr.rid
+ fro = fhdr.fro
+ tss = fhdr.timestamp_str()
+ owi_found = True
+ if not self.qflag:
+ print ' %s: owi=%s rid=%d, fro=0x%08x ts=%s' % (jfn, fhdr.owi(), fhdr.rid, fhdr.fro, fhdr.timestamp_str())
+ if fnum < 0 or rid < 0 or fro < 0:
+ raise Exception('All journal files empty')
+ if not self.qflag: print ' Oldest complete file: %s: rid=%d, fro=0x%08x ts=%s' % (fname, rid, fro, tss)
+ return (fnum, rid, fro)
+
+ def advance_file(self, *start_info):
+ seek_flag = False
+ if len(start_info) == 3:
+ self.file_start = self.file_num = start_info[0]
+ self.fro = start_info[2]
+ seek_flag = True
+ if self.f != None and file_full(self.f):
+ self.file_num = self.incr_fnum()
+ if self.file_num == self.file_start:
+ return True
+ if self.file_start == 0:
+ self.last_file = self.file_num == self.num_jfiles - 1
+ else:
+ self.last_file = self.file_num == self.file_start - 1
+ if self.file_num < 0 or self.file_num >= self.num_jfiles:
+ raise Exception('Bad file number %d' % self.file_num)
+ jfn = self.jdir + '/' + self.bfn + '.%04d.jdat' % self.file_num
+ self.f = open(jfn)
+ self.fhdr = load(self.f, Hdr)
+ if seek_flag and self.f.tell() != self.fro:
+ self.f.seek(self.fro)
+ self.first_rec = True
+ if not self.qflag: print jfn, ": ", self.fhdr
+ return False
+
+ def incr_fnum(self):
+ self.file_num += 1
+ if self.file_num >= self.num_jfiles:
+ self.file_num = 0;
+ return self.file_num
+
+ def check_rid(self, hdr):
+ if self.last_rid != -1 and hdr.rid != self.last_rid + 1:
+ return False
+ self.last_rid = hdr.rid
+ return True
+
+ def read_jinf(self):
+ filename = self.jdir + '/' + self.bfn + '.jinf'
+ try:
+ f = open(filename, 'r')
+ except IOError:
+ print 'ERROR: Unable to open jinf file %s' % filename
+ sys.exit(1)
+ p = xml.parsers.expat.ParserCreate()
+ p.StartElementHandler = self.handleStartElement
+ p.CharacterDataHandler = self.handleCharData
+ p.EndElementHandler = self.handleEndElement
+ p.ParseFile(f)
+ if self.num_jfiles == None:
+ print 'ERROR: number_jrnl_files not found in jinf file "%s"!' % filename
+ if jfsize == None:
+ print 'ERROR: jrnl_file_size_sblks not found in jinf file "%s"!' % filename
+ if self.num_jfiles == None or jfsize == None:
+ sys.exit(1)
+
+ def handleStartElement(self, name, attrs):
+ global jfsize
+ if name == 'number_jrnl_files':
+ self.num_jfiles = int(attrs['value'])
+ if name == 'jrnl_file_size_sblks':
+ jfsize = (int(attrs['value']) + 1) * sblk_size
+
+ def handleCharData(self, data): pass
+
+ def handleEndElement(self, name): pass
+
+ def proc_csv(self):
+ if self.csvfn != None and self.tnum != None:
+ tparams = self.get_test(self.csvfn, self.tnum)
+ if tparams == None:
+ print 'ERROR: Test %d not found in CSV file "%s"' % (self.tnum, self.csvfn)
+ sys.exit(1)
+ self.num_msgs = tparams['num_msgs']
+ if tparams['min_size'] == tparams['max_size']:
+ self.msg_len = tparams['max_size']
+ else:
+ self.msg_len = 0
+ self.auto_deq = tparams['auto_deq']
+ if tparams['xid_min_size'] == tparams['xid_max_size']:
+ self.xid_len = tparams['xid_max_size']
+ else:
+ self.xid_len = 0
+ self.transient = tparams['transient']
+ self.extern = tparams['extern']
+
+ def get_test(self, filename, tnum):
+ try:
+ f=open(filename, 'r')
+ except IOError:
+ print 'ERROR: Unable to open CSV file "%s"' % filename
+ sys.exit(1)
+ for l in f:
+ sl = l.strip().split(',')
+ if len(sl[0]) > 0 and sl[0][0] != '"':
+ try:
+ if (int(sl[TEST_NUM_COL]) == tnum):
+ return { 'num_msgs':int(sl[NUM_MSGS_COL]),
+ 'min_size':int(sl[MIN_MSG_SIZE_COL]),
+ 'max_size':int(sl[MAX_MSG_SIZE_COL]),
+ 'auto_deq':not (sl[AUTO_DEQ_COL] == 'FALSE' or sl[AUTO_DEQ_COL] == '0'),
+ 'xid_min_size':int(sl[MIN_XID_SIZE_COL]),
+ 'xid_max_size':int(sl[MAX_XID_SIZE_COL]),
+ 'transient':not (sl[TRANSIENT_COL] == 'FALSE' or sl[TRANSIENT_COL] == '0'),
+ 'extern':not (sl[EXTERN_COL] == 'FALSE' or sl[EXTERN_COL] == '0'),
+ 'comment':sl[COMMENT_COL] }
+ except Exception:
+ pass
+ return None
+
+ def proc_args(self, argv):
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "b:c:d:hqt:", ["base-filename=", "csv-filename=", "dir=", "help", "quiet", "test-num="])
+ except getopt.GetoptError:
+ self.usage()
+ sys.exit(2)
+ for o, a in opts:
+ if o in ("-h", "--help"):
+ self.usage()
+ sys.exit()
+ if o in ("-b", "--base-filename"):
+ self.bfn = a
+ if o in ("-c", "--csv-filename"):
+ self.csvfn = a
+ if o in ("-d", "--dir"):
+ self.jdir = a
+ if o in ("-q", "--quiet"):
+ self.qflag = True
+ if o in ("-t", "--test-num"):
+ if not a.isdigit():
+ print 'ERROR: Illegal test-num argument. Must be a non-negative number'
+ sys.exit(2)
+ self.tnum = int(a)
+ if self.bfn == None or self.jdir == None:
+ print 'ERROR: Missing requred args.'
+ self.usage()
+ sys.exit(2)
+ if self.tnum != None and self.csvfn == None:
+ print 'ERROR: Test number specified, but not CSV file'
+ self.usage()
+ sys.exit(2)
+
+ def usage(self):
+ print 'Usage: %s opts' % sys.argv[0]
+ print ' where opts are in either short or long format (*=req\'d):'
+ print ' -b --base-filename [string] * Base filename for journal files'
+ print ' -c --csv-filename [string] CSV filename containing test parameters'
+ print ' -d --dir [string] * Journal directory containing journal files'
+ print ' -h --help Print help'
+ print ' -q --quiet Quiet (reduced output)'
+ print ' -t --test-num [int] Test number from CSV file - only valid if CSV file named'
+
+ def report(self):
+ if not self.qflag:
+ if self.num_msgs > 0 and self.msg_cnt != self.num_msgs:
+ print 'WARNING: Found %d messages; %d expected.' % (self.msg_cnt, self.num_msgs)
+ if len(self.enqueued) > 0:
+ print 'Remaining enqueued records: ', len(self.enqueued)
+ for h in self.enqueued:
+ print self.enqueued[h]
+ print 'WARNING: Enqueue-Dequeue mismatch, %d enqueued records remain.' % len(self.enqueued)
+ print 'Test passed; %d records processed.' % self.msg_cnt
+
+
+#===============================================================================
+
+CLASSES = {
+ "a": TxnHdr,
+ "c": TxnHdr,
+ "d": DeqHdr,
+ "e": EnqRec,
+ "f": FileHdr
+}
+
+m = Main(sys.argv)
+m.run()
+m.report()
+
+sys.exit(None)
Property changes on: store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
___________________________________________________________________
Name: svn:executable
+ *
Added: store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,63 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "jrnl_init_params.hpp"
+
+namespace rhm
+{
+namespace jtt
+{
+
+jrnl_init_params::jrnl_init_params(const std::string& jid, const std::string& jdir,
+ const std::string& base_filename, const u_int16_t num_jfiles,
+ const u_int32_t jfsize_sblks):
+ _jid(jid),
+ _jdir(jdir),
+ _base_filename(base_filename),
+ _num_jfiles(num_jfiles),
+ _jfsize_sblks(jfsize_sblks)
+{}
+
+jrnl_init_params::jrnl_init_params(const jrnl_init_params& jp):
+ _jid(jp._jid),
+ _jdir(jp._jdir),
+ _base_filename(jp._base_filename),
+ _num_jfiles(jp._num_jfiles),
+ _jfsize_sblks(jp._jfsize_sblks)
+{}
+
+jrnl_init_params::jrnl_init_params(const jrnl_init_params* const jp_ptr):
+ _jid(jp_ptr->_jid),
+ _jdir(jp_ptr->_jdir),
+ _base_filename(jp_ptr->_base_filename),
+ _num_jfiles(jp_ptr->_num_jfiles),
+ _jfsize_sblks(jp_ptr->_jfsize_sblks)
+{}
+
+// static initializers
+
+const u_int16_t jrnl_init_params::def_num_jfiles = 8;
+const u_int32_t jrnl_init_params::def_jfsize_sblks = 0xc00;
+
+} // namespace jtt
+} // namespace rhm
Added: store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.hpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.hpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,68 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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.
+*/
+
+#ifndef rhm_jtt_jrnl_init_params_hpp
+#define rhm_jtt_jrnl_init_params_hpp
+
+#include <boost/shared_ptr.hpp>
+#include <string>
+#include <sys/types.h>
+
+namespace rhm
+{
+namespace jtt
+{
+
+ class jrnl_init_params
+ {
+ public:
+ static const u_int16_t def_num_jfiles;
+ static const u_int32_t def_jfsize_sblks;
+
+ typedef boost::shared_ptr<jrnl_init_params> shared_ptr;
+
+ private:
+ std::string _jid;
+ std::string _jdir;
+ std::string _base_filename;
+ u_int16_t _num_jfiles;
+ u_int32_t _jfsize_sblks;
+
+ public:
+ jrnl_init_params(const std::string& jid, const std::string& jdir,
+ const std::string& base_filename, const u_int16_t num_jfiles = def_num_jfiles,
+ const u_int32_t jfsize_sblks = def_jfsize_sblks);
+ jrnl_init_params(const jrnl_init_params& jp);
+ jrnl_init_params(const jrnl_init_params* const jp_ptr);
+
+ inline const std::string& jid() const { return _jid; }
+ inline const std::string& jdir() const { return _jdir; }
+ inline const std::string& base_filename() const { return _base_filename; }
+ inline const u_int16_t num_jfiles() const { return _num_jfiles; }
+ inline const u_int32_t jfsize_sblks() const { return _jfsize_sblks; }
+ };
+
+} // namespace jtt
+} // namespace rhm
+
+#endif // ifndef rhm_jtt_jrnl_init_params_hpp
Added: store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,279 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "jrnl_instance.hpp"
+
+#include "data_src.hpp"
+#include "test_case_result.hpp"
+#include <jrnl/data_tok.hpp>
+#include <jrnl/jerrno.hpp>
+
+#include <iostream> // debug
+
+#define SLEEP_US 1000 // 1 ms
+#define MAX_SLEEP_CNT 2000 // 2 sec max
+
+namespace rhm
+{
+namespace jtt
+{
+
+jrnl_instance::jrnl_instance(const std::string& jid, const std::string& jdir,
+ const std::string& base_filename, const u_int16_t num_jfiles, const u_int32_t jfsize_sblks):
+ rhm::journal::jcntl(jid, jdir, base_filename, num_jfiles, jfsize_sblks),
+ _jpp(new jrnl_init_params(jid, jdir, base_filename, num_jfiles, jfsize_sblks)),
+ _dtok_master_list(),
+ _dtok_deq_list(),
+ _tcp(),
+ _tcrp(),
+ _recover_mode(false),
+ _keep_jrnls(false)
+{}
+
+jrnl_instance::jrnl_instance(const jrnl_init_params::shared_ptr& p):
+ rhm::journal::jcntl(p->jid(), p->jdir(), p->base_filename(), p->num_jfiles(),
+ p->jfsize_sblks()),
+ _jpp(p),
+ _dtok_master_list(),
+ _dtok_deq_list(),
+ _tcp(),
+ _tcrp(),
+ _recover_mode(false),
+ _keep_jrnls(false)
+{
+ pthread_mutex_init(&_dm, 0);
+}
+
+jrnl_instance::~jrnl_instance()
+{
+ pthread_mutex_destroy(&_dm);
+}
+
+void
+jrnl_instance::init_tc(test_case::shared_ptr& tcp, const bool /* reuse_instance */,
+ const bool recover_mode, const bool keep_jrnls)
+{
+ _tcp = tcp;
+ _recover_mode = recover_mode;
+ _keep_jrnls = keep_jrnls;
+
+ if (_recover_mode)
+ {
+ try
+ {
+ std::vector<std::string> prep_txn_list;
+ u_int64_t highest_rid;
+ recover(0, 0, prep_txn_list, highest_rid);
+ recover_complete();
+ }
+ catch (const rhm::journal::jexception& e)
+ {
+ if (e.err_code() == rhm::journal::jerrno::JERR_JDIR_STAT)
+ initialize(0, 0);
+ else
+ throw;
+ }
+ }
+ else
+ initialize(aio_rd_callback, aio_wr_callback);
+
+ test_case_result::shared_ptr p(new test_case_result(_jpp->jid()));
+ _tcrp = p;
+}
+
+void
+jrnl_instance::run_tc()
+{
+ _tcrp->set_start_time();
+ ::pthread_create(&_enq_thread, 0, run_enq, this);
+ ::pthread_create(&_deq_thread, 0, run_deq, this);
+ ::pthread_create(&_read_thread, 0, run_read, this);
+}
+
+void
+jrnl_instance::tc_wait_compl()
+{
+ ::pthread_join(_enq_thread, 0);
+ ::pthread_join(_deq_thread, 0);
+ ::pthread_join(_read_thread, 0);
+ stop(true);
+ _tcrp->set_stop_time();
+ _tcp->add_result(_tcrp);
+
+ if (!_recover_mode && !_keep_jrnls)
+ rhm::journal::jdir::delete_dir(_jpp->jdir());
+}
+
+void
+jrnl_instance::run_enq() throw ()
+{
+ unsigned sleep_cnt = 0U;
+ while(_tcrp->num_enq() < _tcp->num_msgs() && !_tcrp->exception())
+ {
+ dtok_ptr p(new rhm::journal::data_tok);
+ _dtok_master_list.push_back(p);
+ const char* msgp = data_src::get_data(_tcrp->num_enq() % 10);
+ const size_t msg_size = _tcp->this_data_size();
+ const char* xidp = data_src::get_xid(_tcrp->num_enq() % 26);
+ const size_t xid_size = _tcp->this_xid_size();
+ const std::string xid(xidp, xid_size);
+ const bool external = _tcp->this_external();
+ const bool transient = _tcp->this_transience();
+ try
+ {
+ rhm::journal::iores res;
+ if (xid_size)
+ {
+ if (external)
+ res = enqueue_extern_txn_data_record(msg_size, p.get(), xid, transient);
+ else
+ res = enqueue_txn_data_record(msgp, msg_size, msg_size, p.get(), xid,
+ transient);
+ }
+ else
+ {
+ if (external)
+ res = enqueue_extern_data_record(msg_size, p.get(), transient);
+ else
+ res = enqueue_data_record(msgp, msg_size, msg_size, p.get(), transient);
+ }
+ if (res == rhm::journal::RHM_IORES_SUCCESS)
+ {
+ sleep_cnt = 0U;
+ _tcrp->incr_num_enq();
+ }
+ else if (res == rhm::journal::RHM_IORES_ENQCAPTHRESH)
+ {
+ if (sleep_cnt++ > MAX_SLEEP_CNT)
+ {
+ std::ostringstream oss;
+ oss << "ERROR: Timeout waiting for journal \"" << _jid;
+ oss << "\" to empty.";
+ _tcrp->set_exception(oss.str());
+ }
+ else
+ ::usleep(SLEEP_US); // 1ms
+ }
+ else
+ {
+ std::ostringstream oss;
+ oss << "ERROR: enqueue operation in journal \"" << _jid << "\" returned ";
+ oss << rhm::journal::iores_str(res) << ".";
+ _tcrp->set_exception(oss.str());
+ }
+
+ }
+ catch (const rhm::journal::jexception& e) { _tcrp->set_exception(e); }
+ }
+ flush();
+}
+
+void
+jrnl_instance::run_deq() throw ()
+{
+ if (_tcp->auto_deq())
+ {
+ unsigned sleep_cnt = 0U;
+ while(_tcrp->num_deq() < _tcp->num_msgs() && !_tcrp->exception())
+ {
+ if (_dtok_deq_list.empty())
+ {
+ if (sleep_cnt++ > MAX_SLEEP_CNT)
+ {
+ std::ostringstream oss;
+ oss << "ERROR: Timeout waiting for AIO in journal \"" << _jid;
+ oss << "\": num_enq=" << _tcp->num_msgs() << " num_deq=" << _tcrp->num_deq();
+ _tcrp->set_exception(oss.str());
+ }
+ get_wr_events();
+ ::usleep(SLEEP_US); // 1ms
+ }
+ else
+ {
+ journal::data_tok* dtokp;
+ {
+ rhm::journal::slock sl(&_dm);
+ dtokp = _dtok_deq_list.back();
+ _dtok_deq_list.pop_back();
+ }
+
+ switch (dtokp->wstate())
+ {
+ case rhm::journal::data_tok::ENQ: // dequeue these, enqueue complete
+ try
+ {
+ rhm::journal::iores res;
+ if (dtokp->has_xid())
+ res = dequeue_txn_data_record(dtokp, dtokp->xid());
+ else
+ res = dequeue_data_record(dtokp);
+ if (res == rhm::journal::RHM_IORES_SUCCESS)
+ {
+ sleep_cnt = 0U;
+ _tcrp->incr_num_deq();
+ }
+ else
+ {
+ std::ostringstream oss;
+ oss << "ERROR: dequeue operation in journal \"" << _jid;
+ oss << "\" returned " << rhm::journal::iores_str(res) << ".";
+ _tcrp->set_exception(oss.str());
+ }
+ }
+ catch (const rhm::journal::jexception& e) { _tcrp->set_exception(e); }
+ break;
+ case rhm::journal::data_tok::DEQ: // ignore these, dequeue complete
+ break;
+ default: // these should not happen in regular tests
+ std::ostringstream oss;
+ oss << "Unexpected dtok wstate in journal \"" << _jid << "\": id=0x";
+ oss << std::hex << dtokp->id() << std::dec << " wstate=" << dtokp->wstate_str();
+ _tcrp->set_exception(oss.str());
+ }
+ sleep_cnt = 0U;
+ }
+ }
+ flush();
+ }
+}
+
+void
+jrnl_instance::run_read() throw ()
+{}
+
+// static AIO callback fns
+
+void
+jrnl_instance::aio_wr_callback(jcntl* journal, std::vector<journal::data_tok*>& dtokl)
+{
+ for (std::vector<journal::data_tok*>::const_iterator i=dtokl.begin(); i!=dtokl.end(); i++)
+ if ((*i)->wstate() == journal::data_tok::ENQ)
+ jrnl_instance::push_dtokp(journal, *i);
+}
+
+void
+jrnl_instance::aio_rd_callback(jcntl* /* journal */, std::vector<journal::data_tok*>& /* dtokl */)
+{}
+
+} // namespace jtt
+} // namespace rhm
Added: store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,102 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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.
+*/
+
+#ifndef rhm_jtt_jrnl_instance_hpp
+#define rhm_jtt_jrnl_instance_hpp
+
+#include "jrnl_init_params.hpp"
+#include "test_case.hpp"
+
+#include <boost/shared_ptr.hpp>
+#include <jrnl/data_tok.hpp>
+#include <jrnl/jcntl.hpp>
+#include <jrnl/slock.hpp>
+#include <vector>
+
+namespace rhm
+{
+namespace jtt
+{
+
+ class jrnl_instance : public rhm::journal::jcntl
+ {
+ public:
+ typedef boost::shared_ptr<jrnl_instance> shared_ptr;
+ typedef boost::shared_ptr<journal::data_tok> dtok_ptr;
+
+ private:
+ jrnl_init_params::shared_ptr _jpp;
+ std::vector<dtok_ptr> _dtok_master_list;
+ std::vector<journal::data_tok*> _dtok_deq_list;
+ pthread_mutex_t _dm; ///< Dequeue vector mutex
+ pthread_t _enq_thread;
+ pthread_t _deq_thread;
+ pthread_t _read_thread;
+ test_case::shared_ptr _tcp;
+ test_case_result::shared_ptr _tcrp;
+ bool _recover_mode;
+ bool _keep_jrnls;
+
+ public:
+ jrnl_instance(const std::string& jid, const std::string& jdir,
+ const std::string& base_filename,
+ const u_int16_t num_jfiles = jrnl_init_params::def_num_jfiles,
+ const u_int32_t jfsize_sblks = jrnl_init_params::def_jfsize_sblks);
+ jrnl_instance(const jrnl_init_params::shared_ptr& params);
+ ~jrnl_instance();
+
+ inline const jrnl_init_params::shared_ptr& params() const { return _jpp; }
+ inline const std::string& jid() const { return _jpp->jid(); }
+
+ void init_tc(test_case::shared_ptr& tcp, const bool reuse_instance, const bool recover_mode,
+ const bool keep_jrnls);
+ void run_tc();
+ void tc_wait_compl();
+
+ private:
+ inline void push_dtokp(rhm::journal::data_tok* dtokp)
+ { rhm::journal::slock sl(&_dm); _dtok_deq_list.push_back(dtokp); }
+ static inline void push_dtokp(jcntl* jp, rhm::journal::data_tok* dtokp)
+ { static_cast<jrnl_instance*>(jp)->push_dtokp(dtokp); }
+
+ void run_enq() throw ();
+ inline static void* run_enq(void* p)
+ { static_cast<jrnl_instance*>(p)->run_enq(); return 0; }
+
+ void run_deq() throw ();
+ inline static void* run_deq(void* p)
+ { static_cast<jrnl_instance*>(p)->run_deq(); return 0; }
+
+ void run_read() throw ();
+ inline static void* run_read(void* p)
+ { static_cast<jrnl_instance*>(p)->run_read(); return 0; }
+
+ // static callbacks
+ static void aio_wr_callback(jcntl* journal, std::vector<journal::data_tok*>& dtokl);
+ static void aio_rd_callback(jcntl* journal, std::vector<journal::data_tok*>& dtokl);
+ };
+
+} // namespace jtt
+} // namespace rhm
+
+#endif // ifndef rhm_jtt_jrnl_instance_hpp
Added: store/trunk/cpp/tests/jrnl/jtt/jtt.csv
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jtt.csv (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/jtt.csv 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,215 @@
+,,,,,,,"Msg size",,"Xid size",,,,,"enq-size",,"deq-size",,"txn-size",,
+"Test #","tf","pf","amn","mn incr","#msgs","ms incr","Min","Max","Min","Max","auto-deq","transient","extern","bytes","dblks","bytes","dblks","bytes","dblks","comment"
+,,,,,,,,,,,,,,,,,,,,
+"Initialize only",,,,,,,,,,,,,,,,,,,,
+0,"L",0,0,0,0,0,0,0,0,0,FALSE,FALSE,FALSE,44,1,0,0,0,0,"No messages - journal creation/initialization only"
+,,,,,,,,,,,,,,,,,,,,
+"Simple message combinations of persistent/deq transientueued/non-dequeued, transactional/non-transactional",,,,,,,,,,,,,,,,,,,,
+1,"L",1,1,0,1,0,10,10,0,0,FALSE,FALSE,FALSE,54,1,0,0,0,0,"1 * 10-byte message"
+2,"L",1,10,0,10,0,10,10,0,0,FALSE,FALSE,FALSE,54,1,0,0,0,0,"10 * 10-byte message"
+3,"L",1,1,0,1,0,10,10,0,0,FALSE,TRUE,FALSE,54,1,0,0,0,0,"1 * 10-byte message [transient]"
+4,"L",1,10,0,10,0,10,10,0,0,FALSE,TRUE,FALSE,54,1,0,0,0,0,"10 * 10-byte message [transient]"
+5,"L",1,1,0,1,0,10,10,10,10,FALSE,FALSE,FALSE,64,1,0,0,0,0,"1 * 10-byte message [txn]"
+6,"L",1,10,0,10,0,10,10,10,10,FALSE,FALSE,FALSE,64,1,0,0,0,0,"10 * 10-byte message [txn]"
+7,"L",1,1,0,1,0,10,10,10,10,FALSE,TRUE,FALSE,64,1,0,0,0,0,"1 * 10-byte message [txn transient]"
+8,"L",1,10,0,10,0,10,10,10,10,FALSE,TRUE,FALSE,64,1,0,0,0,0,"10 * 10-byte message [txn transient]"
+9,"L",1,1,0,1,0,10,10,0,0,TRUE,FALSE,FALSE,54,1,32,1,0,0,"1 * 10-byte message [deq]"
+10,"L",1,10,0,10,0,10,10,0,0,TRUE,FALSE,FALSE,54,1,32,1,0,0,"10 * 10-byte message [deq]"
+11,"L",1,1,0,1,0,10,10,0,0,TRUE,TRUE,FALSE,54,1,32,1,0,0,"1 * 10-byte message [deq transient]"
+12,"L",1,10,0,10,0,10,10,0,0,TRUE,TRUE,FALSE,54,1,32,1,0,0,"10 * 10-byte message [deq transient]"
+13,"L",1,1,0,1,0,10,10,10,10,TRUE,FALSE,FALSE,64,1,54,1,46,1,"1 * 10-byte message [deq txn]"
+14,"L",1,10,0,10,0,10,10,10,10,TRUE,FALSE,FALSE,64,1,54,1,46,1,"10 * 10-byte message [deq txn]"
+15,"L",1,1,0,1,0,10,10,10,10,TRUE,TRUE,FALSE,64,1,54,1,46,1,"1 * 10-byte message [txn deq transient]"
+16,"L",1,10,0,10,0,10,10,10,10,TRUE,TRUE,FALSE,64,1,54,1,46,1,"10 * 10-byte message [txn deq transient]"
+17,"L",1,1,0,1,0,10,10,0,0,FALSE,FALSE,TRUE,54,1,0,0,0,0,"1 * 10-byte message [extern]"
+18,"L",1,10,0,10,0,10,10,0,0,FALSE,FALSE,TRUE,54,1,0,0,0,0,"10 * 10-byte message [extern]"
+19,"L",1,1,0,1,0,10,10,0,0,FALSE,TRUE,TRUE,54,1,0,0,0,0,"1 * 10-byte message [transient extern]"
+20,"L",1,10,0,10,0,10,10,0,0,FALSE,TRUE,TRUE,54,1,0,0,0,0,"10 * 10-byte message [transient extern]"
+21,"L",1,1,0,1,0,10,10,10,10,FALSE,FALSE,TRUE,64,1,0,0,0,0,"1 * 10-byte message [txn extern]"
+22,"L",1,10,0,10,0,10,10,10,10,FALSE,FALSE,TRUE,64,1,0,0,0,0,"10 * 10-byte message [txn extern]"
+23,"L",1,1,0,1,0,10,10,10,10,FALSE,TRUE,TRUE,64,1,0,0,0,0,"1 * 10-byte message [txn transient extern]"
+24,"L",1,10,0,10,0,10,10,10,10,FALSE,TRUE,TRUE,64,1,0,0,0,0,"10 * 10-byte message [txn transient extern]"
+25,"L",1,1,0,1,0,10,10,0,0,TRUE,FALSE,TRUE,54,1,32,1,0,0,"1 * 10-byte message [deq extern]"
+26,"L",1,10,0,10,0,10,10,0,0,TRUE,FALSE,TRUE,54,1,32,1,0,0,"10 * 10-byte message [deq extern]"
+27,"L",1,1,0,1,0,10,10,0,0,TRUE,TRUE,TRUE,54,1,32,1,0,0,"1 * 10-byte message [deq transient extern]"
+28,"L",1,10,0,10,0,10,10,0,0,TRUE,TRUE,TRUE,54,1,32,1,0,0,"10 * 10-byte message [deq transient extern]"
+29,"L",1,1,0,1,0,10,10,10,10,TRUE,FALSE,TRUE,64,1,54,1,46,1,"1 * 10-byte message [deq txn extern]"
+30,"L",1,10,0,10,0,10,10,10,10,TRUE,FALSE,TRUE,64,1,54,1,46,1,"10 * 10-byte message [deq txn extern]"
+31,"L",1,1,0,1,0,10,10,10,10,TRUE,TRUE,TRUE,64,1,54,1,46,1,"1 * 10-byte message [txn deq transient extern]"
+32,"L",1,10,0,10,0,10,10,10,10,TRUE,TRUE,TRUE,64,1,54,1,46,1,"10 * 10-byte message [txn deq transient extern]"
+,,,,,,,,,,,,,,,,,,,,
+"Transition from one d-block to two per message",,,,,,,,,,,,,,,,,,,,
+33,"L",1,10,0,10,0,84,84,0,0,FALSE,FALSE,FALSE,128,1,0,0,0,0,"1 dblk exact fit"
+34,"L",1,10,0,10,1,85,85,0,0,FALSE,FALSE,FALSE,129,2,0,0,0,0,"1 dblk + 1 byte"
+35,"L",1,10,0,10,0,58,58,26,26,FALSE,FALSE,FALSE,128,1,0,0,0,0,"1 dblk exact fit [txn]"
+36,"L",1,10,0,10,1,59,59,26,26,FALSE,FALSE,FALSE,129,2,0,0,0,0,"1 dblk + 1 byte [txn]"
+,,,,,,,,,,,,,,,,,,,,
+"Transition from one s-block to two per message",,,,,,,,,,,,,,,,,,,,
+37,"L",1,10,0,10,0,468,468,0,0,FALSE,FALSE,FALSE,512,4,0,0,0,0,"1 sblk exact fit"
+38,"L",1,10,0,10,1,469,469,0,0,FALSE,FALSE,FALSE,513,5,0,0,0,0,"1 sblk + 1 byte"
+39,"L",1,10,0,10,0,442,442,26,26,FALSE,FALSE,FALSE,512,4,0,0,0,0,"1 sblk exact fit [txn]"
+40,"L",1,10,0,10,1,443,443,26,26,FALSE,FALSE,FALSE,513,5,0,0,0,0,"1 sblk + 1 byte [txn]"
+,,,,,,,,,,,,,,,,,,,,
+"Transition from first page to second",,,,,,,,,,,,,,,,,,,,
+41,"L",1,8,0,8,0,4052,4052,0,0,FALSE,FALSE,FALSE,4096,32,0,0,0,0,"1/8 page"
+42,"L",1,8,1,9,0,4052,4052,0,0,FALSE,FALSE,FALSE,4096,32,0,0,0,0,"1/8 page"
+43,"L",1,8,0,8,1,4053,4053,0,0,FALSE,FALSE,FALSE,4097,33,0,0,0,0,"1/8 page + 1 byte"
+44,"L",1,8,0,8,0,3796,3796,256,256,FALSE,FALSE,FALSE,4096,32,0,0,0,0,"1/8 page [txn]"
+45,"L",1,8,1,9,0,3796,3796,256,256,FALSE,FALSE,FALSE,4096,32,0,0,0,0,"1/8 page [txn]"
+46,"L",1,8,0,8,1,3797,3797,256,256,FALSE,FALSE,FALSE,4097,33,0,0,0,0,"1/8 page + 1 byte [txn]"
+47,"L",1,8,0,8,0,3924,3924,0,0,TRUE,FALSE,FALSE,3968,31,32,1,0,0,"1/8 page incl deq [deq]"
+48,"L",1,8,1,9,0,3924,3924,0,0,TRUE,FALSE,FALSE,3968,31,32,1,0,0,"1/8 page incl deq [deq]"
+49,"L",1,8,0,8,1,3925,3925,0,0,TRUE,FALSE,FALSE,3969,32,32,1,0,0,"1/8 page incl deq + 1 byte [deq]"
+50,"L",1,8,0,8,0,3028,3028,256,256,TRUE,FALSE,FALSE,3328,26,300,3,292,3,"1/8 page incl deq & txn [deq txn]"
+51,"L",1,8,1,9,0,3028,3028,256,256,TRUE,FALSE,FALSE,3328,26,300,3,292,3,"1/8 page incl deq & txn [deq txn]"
+52,"L",1,8,0,8,1,3029,3029,256,256,TRUE,FALSE,FALSE,3329,27,300,3,292,3,"1/8 page incl deq & txn + 1 byte [deq txn]"
+,,,,,,,,,,,,,,,,,,,,
+"Page cache rollover (from page 32 back to page 0)",,,,,,,,,,,,,,,,,,,,
+53,"L",1,32,0,32,0,32724,32724,0,0,FALSE,FALSE,FALSE,32768,256,0,0,0,0,"1 page"
+54,"L",1,32,1,33,0,32724,32724,0,0,FALSE,FALSE,FALSE,32768,256,0,0,0,0,"1 page"
+55,"L",1,32,0,32,1,32725,32725,0,0,FALSE,FALSE,FALSE,32769,257,0,0,0,0,"1 page + 1 byte"
+56,"L",1.5,22,0,22,0,49108,49108,0,0,FALSE,FALSE,FALSE,49152,384,0,0,0,0,"1.5 pages"
+57,"L",1,32,0,32,0,32468,32468,256,256,FALSE,FALSE,FALSE,32768,256,0,0,0,0,"1 page [txn]"
+58,"L",1,32,1,33,0,32468,32468,256,256,FALSE,FALSE,FALSE,32768,256,0,0,0,0,"1 page [txn]"
+59,"L",1,32,0,32,1,32469,32469,256,256,FALSE,FALSE,FALSE,32769,257,0,0,0,0,"1 page + 1 byte [txn]"
+60,"L",1.5,22,0,22,0,48852,48852,256,256,FALSE,FALSE,FALSE,49152,384,0,0,0,0,"1.5 pages [txn]"
+61,"L",1,32,0,32,0,32596,32596,0,0,TRUE,FALSE,FALSE,32640,255,32,1,0,0,"1 page incl deq [deq]"
+62,"L",1,32,1,33,0,32596,32596,0,0,TRUE,FALSE,FALSE,32640,255,32,1,0,0,"1 page incl deq [deq]"
+63,"L",1,32,0,32,1,32597,32597,0,0,TRUE,FALSE,FALSE,32641,256,32,1,0,0,"1 page incl deq + 1 byte [deq]"
+64,"L",1.5,22,0,22,0,48980,48980,0,0,TRUE,FALSE,FALSE,49024,383,32,1,0,0,"1.5 pages incl deq [deq]"
+65,"L",1,32,0,32,0,31700,31700,256,256,TRUE,FALSE,FALSE,32000,250,300,3,292,3,"1 page incl deq & txn [deq txn]"
+66,"L",1,32,1,33,0,31700,31700,256,256,TRUE,FALSE,FALSE,32000,250,300,3,292,3,"1 page incl deq & txn [deq txn]"
+67,"L",1,32,0,32,1,31701,31701,256,256,TRUE,FALSE,FALSE,32001,251,300,3,292,3,"1 page incl deq & txn + 1 byte [deq txn]"
+68,"L",1.5,22,0,22,0,48084,48084,256,256,TRUE,FALSE,FALSE,48384,378,300,3,292,3,"1.5 pages incl deq & txn [deq txn]"
+,,,,,,,,,,,,,,,,,,,,
+"File transition (from file 0000 to 0001)",,,,,,,,,,,,,,,,,,,,
+69,"L",1,48,0,48,0,32724,32724,0,0,FALSE,FALSE,FALSE,32768,256,0,0,0,0,"1 page"
+70,"L",1,48,1,49,0,32724,32724,0,0,FALSE,FALSE,FALSE,32768,256,0,0,0,0,"1 page"
+71,"L",1,48,0,48,1,32725,32725,0,0,FALSE,FALSE,FALSE,32769,257,0,0,0,0,"1 page + 1 byte"
+72,"L",2.5,20,0,20,0,81876,81876,0,0,FALSE,FALSE,FALSE,81920,640,0,0,0,0,"2.5 pages"
+73,"L",1,48,0,48,0,32468,32468,256,256,FALSE,FALSE,FALSE,32768,256,0,0,0,0,"1 page [txn]"
+74,"L",1,48,1,49,0,32468,32468,256,256,FALSE,FALSE,FALSE,32768,256,0,0,0,0,"1 page [txn]"
+75,"L",1,48,0,48,1,32469,32469,256,256,FALSE,FALSE,FALSE,32769,257,0,0,0,0,"1 page + 1 byte [txn]"
+76,"L",2.5,20,0,20,0,81620,81620,256,256,FALSE,FALSE,FALSE,81920,640,0,0,0,0,"2.5 pages [txn]"
+77,"L",1,48,0,48,0,32596,32596,0,0,TRUE,FALSE,FALSE,32640,255,32,1,0,0,"1 page incl deq [deq]"
+78,"L",1,48,1,49,0,32596,32596,0,0,TRUE,FALSE,FALSE,32640,255,32,1,0,0,"1 page incl deq [deq]"
+79,"L",1,48,0,48,1,32597,32597,0,0,TRUE,FALSE,FALSE,32641,256,32,1,0,0,"1 page incl deq + 1 byte [deq]"
+80,"L",2.5,20,0,20,0,81748,81748,0,0,TRUE,FALSE,FALSE,81792,639,32,1,0,0,"2.5 pages incl deq [deq]"
+81,"L",1,48,0,48,0,31700,31700,256,256,TRUE,FALSE,FALSE,32000,250,300,3,292,3,"1 page incl deq & txn [deq txn]"
+82,"L",1,48,1,49,0,31700,31700,256,256,TRUE,FALSE,FALSE,32000,250,300,3,292,3,"1 page incl deq & txn [deq txn]"
+83,"L",1,48,0,48,1,31701,31701,256,256,TRUE,FALSE,FALSE,32001,251,300,3,292,3,"1 page incl deq & txn + 1 byte [deq txn]"
+84,"L",2.5,20,0,20,0,80852,80852,256,256,TRUE,FALSE,FALSE,81152,634,300,3,292,3,"2.5 pages incl deq & txn [deq txn]"
+,,,,,,,,,,,,,,,,,,,,
+"File rollover (from file 0007 to 0000) - RHM_WRONLY req'd for auto-dequeue == FALSE",,,,,,,,,,,,,,,,,,,,
+85,"L",0.5,16,0,16,0,786260,786260,0,0,TRUE,FALSE,FALSE,786304,6143,32,1,0,0,"24 pages incl deq = ½ file [deq]"
+86,"L",0.5,16,1,17,0,786260,786260,0,0,TRUE,FALSE,FALSE,786304,6143,32,1,0,0,"24 pages incl deq = ½ file [deq]"
+87,"L",0.5,16,0,16,1,786261,786261,0,0,TRUE,FALSE,FALSE,786305,6144,32,1,0,0,"24 pages incl deq + 1 byte [deq]"
+88,"L",0.5,16,0,16,0,785364,785364,256,256,TRUE,FALSE,FALSE,785664,6138,300,3,292,3,"24 pages incl deq & txn = ½ file [deq txn]"
+89,"L",0.5,16,1,17,0,785364,785364,256,256,TRUE,FALSE,FALSE,785664,6138,300,3,292,3,"24 pages incl deq & txn = ½ file [deq txn]"
+90,"L",0.5,16,0,16,1,785365,785365,256,256,TRUE,FALSE,FALSE,785665,6139,300,3,292,3,"24 pages incl deq & txn + 1 byte [deq txn]"
+91,"L",0.25,32,0,32,0,786260,786260,0,0,TRUE,FALSE,FALSE,786304,6143,32,1,0,0,"24 pages incl deq = ½ file [deq]"
+92,"L",0.25,32,1,33,0,786260,786260,0,0,TRUE,FALSE,FALSE,786304,6143,32,1,0,0,"24 pages incl deq = ½ file [deq]"
+93,"L",0.25,32,0,32,1,786261,786261,0,0,TRUE,FALSE,FALSE,786305,6144,32,1,0,0,"24 pages incl deq + 1 byte [deq]"
+94,"L",0.25,32,0,32,0,785364,785364,256,256,TRUE,FALSE,FALSE,785664,6138,300,3,292,3,"24 pages incl deq & txn = ½ file [deq txn]"
+95,"L",0.25,32,1,33,0,785364,785364,256,256,TRUE,FALSE,FALSE,785664,6138,300,3,292,3,"24 pages incl deq & txn = ½ file [deq txn]"
+96,"L",0.25,32,0,32,1,785365,785365,256,256,TRUE,FALSE,FALSE,785665,6139,300,3,292,3,"24 pages incl deq & txn + 1 byte [deq txn]"
+,,,,,,,,,,,,,,,,,,,,
+"Multi-page messages (large messages) - tests various paths in encoder.",,,,,,,,,,,,,,,,,,,,
+97,"L",1,16,0,16,0,32724,32724,0,0,FALSE,FALSE,FALSE,32768,256,0,0,0,0,"data 1 page"
+98,"L",1,16,0,16,1,32725,32725,0,0,FALSE,FALSE,FALSE,32769,257,0,0,0,0,"data 1 page + 1 byte (tail split; 1 byte over page boundary)"
+99,"L",1,16,0,16,11,32735,32735,0,0,FALSE,FALSE,FALSE,32779,257,0,0,0,0,"data 1 page + 11 bytes (tail split; 11 bytes over page boundary)"
+100,"L",1,16,0,16,12,32736,32736,0,0,FALSE,FALSE,FALSE,32780,257,0,0,0,0,"data 1 page + 12 bytes (tail separated exactly onto next page)"
+101,"L",1,16,0,16,13,32737,32737,0,0,FALSE,FALSE,FALSE,32781,257,0,0,0,0,"data 1 page + 13 bytes (data split; 1 byte over page boundary)"
+102,"L",1,16,0,16,0,32468,32468,256,256,FALSE,FALSE,FALSE,32768,256,0,0,0,0,"data 1 page [txn]"
+103,"L",1,16,0,16,1,32469,32469,256,256,FALSE,FALSE,FALSE,32769,257,0,0,0,0,"data 1 page + 1 byte (tail split; 1 byte over page boundary) [txn]"
+104,"L",1,16,0,16,11,32479,32479,256,256,FALSE,FALSE,FALSE,32779,257,0,0,0,0,"data 1 page + 11 bytes (tail split; 11 bytes over page boundary) [txn]"
+105,"L",1,16,0,16,12,32480,32480,256,256,FALSE,FALSE,FALSE,32780,257,0,0,0,0,"data 1 page + 12 bytes (tail separated exactly onto next page) [txn]"
+106,"L",1,16,0,16,13,32481,32481,256,256,FALSE,FALSE,FALSE,32781,257,0,0,0,0,"data 1 page + 13 bytes (data split; 1 byte over page boundary) [txn]"
+107,"L",2,16,0,16,0,65492,65492,0,0,FALSE,FALSE,FALSE,65536,512,0,0,0,0,"data 2 pages"
+108,"L",2,16,0,16,1,65493,65493,0,0,FALSE,FALSE,FALSE,65537,513,0,0,0,0,"data 2 pages + 1 byte (tail split; 1 byte over page boundary)"
+109,"L",2,16,0,16,11,65503,65503,0,0,FALSE,FALSE,FALSE,65547,513,0,0,0,0,"data 2 pages + 11 bytes (tail split; 11 bytes over page boundary)"
+110,"L",2,16,0,16,12,65504,65504,0,0,FALSE,FALSE,FALSE,65548,513,0,0,0,0,"data 2 pages + 12 bytes (tail separated exactly onto next page)"
+111,"L",2,16,0,16,13,65505,65505,0,0,FALSE,FALSE,FALSE,65549,513,0,0,0,0,"data 2 pages + 13 bytes (data split; 1 byte over page boundary)"
+112,"L",2,16,0,16,0,65236,65236,256,256,FALSE,FALSE,FALSE,65536,512,0,0,0,0,"data 2 pages [txn]"
+113,"L",2,16,0,16,1,65237,65237,256,256,FALSE,FALSE,FALSE,65537,513,0,0,0,0,"data 2 pages + 1 byte (tail split; 1 byte over page boundary) [txn]"
+114,"L",2,16,0,16,11,65247,65247,256,256,FALSE,FALSE,FALSE,65547,513,0,0,0,0,"data 2 pages + 11 bytes (tail split; 11 bytes over page boundary) [txn]"
+115,"L",2,16,0,16,12,65248,65248,256,256,FALSE,FALSE,FALSE,65548,513,0,0,0,0,"data 2 pages + 12 bytes (tail separated exactly onto next page) [txn]"
+116,"L",2,16,0,16,13,65249,65249,256,256,FALSE,FALSE,FALSE,65549,513,0,0,0,0,"data 2 pages + 13 bytes (data split; 1 byte over page boundary) [txn]"
+117,"L",4,16,0,16,0,131028,131028,0,0,FALSE,FALSE,FALSE,131072,1024,0,0,0,0,"data 4 pages"
+118,"L",4,16,0,16,1,131029,131029,0,0,FALSE,FALSE,FALSE,131073,1025,0,0,0,0,"data 4 pages + 1 byte (tail split; 1 byte over page boundary)"
+119,"L",4,16,0,16,11,131039,131039,0,0,FALSE,FALSE,FALSE,131083,1025,0,0,0,0,"data 4 pages + 11 bytes (tail split; 11 bytes over page boundary)"
+120,"L",4,16,0,16,12,131040,131040,0,0,FALSE,FALSE,FALSE,131084,1025,0,0,0,0,"data 4 pages + 12 bytes (tail separated exactly onto next page)"
+121,"L",4,16,0,16,13,131041,131041,0,0,FALSE,FALSE,FALSE,131085,1025,0,0,0,0,"data 4 pages + 13 bytes (data split; 1 byte over page boundary)"
+122,"L",4,16,0,16,0,130772,130772,256,256,FALSE,FALSE,FALSE,131072,1024,0,0,0,0,"data 4 pages [txn]"
+123,"L",4,16,0,16,1,130773,130773,256,256,FALSE,FALSE,FALSE,131073,1025,0,0,0,0,"data 4 pages + 1 byte (tail split; 1 byte over page boundary) [txn]"
+124,"L",4,16,0,16,11,130783,130783,256,256,FALSE,FALSE,FALSE,131083,1025,0,0,0,0,"data 4 pages + 11 bytes (tail split; 11 bytes over page boundary) [txn]"
+125,"L",4,16,0,16,12,130784,130784,256,256,FALSE,FALSE,FALSE,131084,1025,0,0,0,0,"data 4 pages + 12 bytes (tail separated exactly onto next page) [txn]"
+126,"L",4,16,0,16,13,130785,130785,256,256,FALSE,FALSE,FALSE,131085,1025,0,0,0,0,"data 4 pages + 13 bytes (data split; 1 byte over page boundary) [txn]"
+127,"L",3.5,16,0,16,0,114644,114644,0,0,FALSE,FALSE,FALSE,114688,896,0,0,0,0,"data 3.5 pages"
+128,"L",3.5,16,0,16,1,114645,114645,0,0,FALSE,FALSE,FALSE,114689,897,0,0,0,0,"data 3.5 pages + 1 byte"
+129,"L",3.5,16,0,16,0,114388,114388,256,256,FALSE,FALSE,FALSE,114688,896,0,0,0,0,"data 3.5 pages [txn]"
+130,"L",3.5,16,0,16,1,114389,114389,256,256,FALSE,FALSE,FALSE,114689,897,0,0,0,0,"data 3.5 pages + 1 byte [txn]"
+131,"L",1,16,0,16,-1,10,10,32735,32735,FALSE,FALSE,FALSE,32789,257,0,0,0,0,"xid 1 page – 1 byte; data 10 bytes (exact fit) [txn]"
+132,"L",1,16,0,16,0,10,10,32736,32736,FALSE,FALSE,FALSE,32790,257,0,0,0,0,"xid 1 page; data 10 bytes (exact fit) [txn]"
+133,"L",1,16,0,16,1,10,10,32737,32737,FALSE,FALSE,FALSE,32791,257,0,0,0,0,"xid 1 page + 1 byte; data 10 bytes (exact fit) [txn]"
+134,"L",2,16,0,16,-1,10,10,65503,65503,FALSE,FALSE,FALSE,65557,513,0,0,0,0,"xid 2 pages – 1 byte; data 10 bytes (exact fit) [txn]"
+135,"L",2,16,0,16,0,10,10,65504,65504,FALSE,FALSE,FALSE,65558,513,0,0,0,0,"xid 2 pages; data 10 bytes (exact fit) [txn]"
+136,"L",2,16,0,16,1,10,10,65505,65505,FALSE,FALSE,FALSE,65559,513,0,0,0,0,"xid 2 pages + 1 byte; data 10 bytes (exact fit) [txn]"
+137,"L",4,16,0,16,-1,10,10,131039,131039,FALSE,FALSE,FALSE,131093,1025,0,0,0,0,"xid 4 pages – 1 byte; data 10 bytes (exact fit) [txn]"
+138,"L",4,16,0,16,0,10,10,131040,131040,FALSE,FALSE,FALSE,131094,1025,0,0,0,0,"xid 4 pages; data 10 bytes (exact fit) [txn]"
+139,"L",4,16,0,16,1,10,10,131041,131041,FALSE,FALSE,FALSE,131095,1025,0,0,0,0,"xid 4 pages + 1 byte; data 10 bytes (exact fit) [txn]"
+140,"L",3.5,16,0,16,0,10,10,114656,114656,FALSE,FALSE,FALSE,114710,897,0,0,0,0,"xid 3.5 pages; data 10 bytes (exact fit) [txn]"
+141,"L",3.5,16,0,16,1,10,10,114657,114657,FALSE,FALSE,FALSE,114711,897,0,0,0,0,"xid 3.5 pages + 1 byte; data 10 bytes (exact fit) [txn]"
+142,"L",1,16,0,16,-1,10,10,32735,32735,TRUE,FALSE,FALSE,32789,257,32779,257,32771,257,"xid 1 page – 1 byte for enq rec; data 10 bytes (exact fit) [deq, txn]"
+143,"L",1,16,0,16,0,10,10,32736,32736,TRUE,FALSE,FALSE,32790,257,32780,257,32772,257,"xid 1 page for enq rec; data 10 bytes (exact fit) [deq, txn]"
+144,"L",1,16,0,16,1,10,10,32737,32737,TRUE,FALSE,FALSE,32791,257,32781,257,32773,257,"xid 1 page + 1 byte for enq rec; data 10 bytes (exact fit) [deq, txn]"
+145,"L",2,16,0,16,-1,10,10,65503,65503,TRUE,FALSE,FALSE,65557,513,65547,513,65539,513,"xid 2 pages – 1 byte for enq rec; data 10 bytes (exact fit) [deq, txn]"
+146,"L",2,16,0,16,0,10,10,65504,65504,TRUE,FALSE,FALSE,65558,513,65548,513,65540,513,"xid 2 pages for enq rec; data 10 bytes (exact fit) [deq, txn]"
+147,"L",2,16,0,16,1,10,10,65505,65505,TRUE,FALSE,FALSE,65559,513,65549,513,65541,513,"xid 2 pages + 1 byte for enq rec; data 10 bytes (exact fit) [deq, txn]"
+148,"L",4,16,0,16,-1,10,10,131039,131039,TRUE,FALSE,FALSE,131093,1025,131083,1025,131075,1025,"xid 4 pages – 1 byte for enq rec; data 10 bytes (exact fit) [deq, txn]"
+149,"L",4,16,0,16,0,10,10,131040,131040,TRUE,FALSE,FALSE,131094,1025,131084,1025,131076,1025,"xid 4 pages for enq rec; data 10 bytes (exact fit) [deq, txn]"
+150,"L",4,16,0,16,1,10,10,131041,131041,TRUE,FALSE,FALSE,131095,1025,131085,1025,131077,1025,"xid 4 pages + 1 byte for enq rec; data 10 bytes (exact fit) [deq, txn]"
+151,"L",3.5,16,0,16,0,10,10,114656,114656,TRUE,FALSE,FALSE,114710,897,114700,897,114692,897,"xid 3.5 pages for enq rec; data 10 bytes (exact fit) [deq, txn]"
+152,"L",3.5,16,0,16,1,10,10,114657,114657,TRUE,FALSE,FALSE,114711,897,114701,897,114693,897,"xid 3.5 pages + 1 byte for enq rec; data 10 bytes (exact fit) [deq, txn]"
+153,"L",1,16,0,16,-1,10,10,32735,32735,TRUE,FALSE,FALSE,32789,257,32779,257,32771,257,"xid 1 page – 1 byte for deq rec; data 10 bytes (exact fit) [deq, txn]"
+154,"L",1,16,0,16,0,10,10,32736,32736,TRUE,FALSE,FALSE,32790,257,32780,257,32772,257,"xid 1 page for deq rec; data 10 bytes (exact fit) [deq, txn]"
+155,"L",1,16,0,16,1,10,10,32737,32737,TRUE,FALSE,FALSE,32791,257,32781,257,32773,257,"xid 1 page + 1 byte for deq rec; data 10 bytes (exact fit) [deq, txn]"
+156,"L",2,16,0,16,-1,10,10,65503,65503,TRUE,FALSE,FALSE,65557,513,65547,513,65539,513,"xid 2 pages – 1 byte for deq rec; data 10 bytes (exact fit) [deq, txn]"
+157,"L",2,16,0,16,0,10,10,65504,65504,TRUE,FALSE,FALSE,65558,513,65548,513,65540,513,"xid 2 pages for deq rec; data 10 bytes (exact fit) [deq, txn]"
+158,"L",2,16,0,16,1,10,10,65505,65505,TRUE,FALSE,FALSE,65559,513,65549,513,65541,513,"xid 2 pages + 1 byte for deq rec; data 10 bytes (exact fit) [deq, txn]"
+159,"L",4,16,0,16,-1,10,10,131039,131039,TRUE,FALSE,FALSE,131093,1025,131083,1025,131075,1025,"xid 4 pages – 1 byte for deq rec; data 10 bytes (exact fit) [deq, txn]"
+160,"L",4,16,0,16,0,10,10,131040,131040,TRUE,FALSE,FALSE,131094,1025,131084,1025,131076,1025,"xid 4 pages for deq rec; data 10 bytes (exact fit) [deq, txn]"
+161,"L",4,16,0,16,1,10,10,131041,131041,TRUE,FALSE,FALSE,131095,1025,131085,1025,131077,1025,"xid 4 pages + 1 byte for deq rec; data 10 bytes (exact fit) [deq, txn]"
+162,"L",3.5,16,0,16,0,10,10,114656,114656,TRUE,FALSE,FALSE,114710,897,114700,897,114692,897,"xid 3.5 pages for deq rec; data 10 bytes (exact fit) [deq, txn]"
+163,"L",3.5,16,0,16,1,10,10,114657,114657,TRUE,FALSE,FALSE,114711,897,114701,897,114693,897,"xid 3.5 pages + 1 byte for deq rec; data 10 bytes (exact fit) [deq, txn]"
+164,"L",1,16,0,16,-1,10,10,32743,32743,TRUE,FALSE,FALSE,32797,257,32787,257,32779,257,"xid 1 page – 1 byte for txn rec; data 10 bytes (exact fit) [deq, txn]"
+165,"L",1,16,0,16,0,10,10,32744,32744,TRUE,FALSE,FALSE,32798,257,32788,257,32780,257,"xid 1 page for txn rec; data 10 bytes (exact fit) [deq, txn]"
+166,"L",1,16,0,16,1,10,10,32745,32745,TRUE,FALSE,FALSE,32799,257,32789,257,32781,257,"xid 1 page + 1 byte for txn rec; data 10 bytes (exact fit) [deq, txn]"
+167,"L",2,16,0,16,-1,10,10,65511,65511,TRUE,FALSE,FALSE,65565,513,65555,513,65547,513,"xid 2 pages – 1 byte for txn rec; data 10 bytes (exact fit) [deq, txn]"
+168,"L",2,16,0,16,0,10,10,65512,65512,TRUE,FALSE,FALSE,65566,513,65556,513,65548,513,"xid 2 pages for txn rec; data 10 bytes (exact fit) [deq, txn]"
+169,"L",2,16,0,16,1,10,10,65513,65513,TRUE,FALSE,FALSE,65567,513,65557,513,65549,513,"xid 2 pages + 1 byte for txn rec; data 10 bytes (exact fit) [deq, txn]"
+170,"L",4,16,0,16,-1,10,10,131047,131047,TRUE,FALSE,FALSE,131101,1025,131091,1025,131083,1025,"xid 4 pages – 1 byte for txn rec; data 10 bytes (exact fit) [deq, txn]"
+171,"L",4,16,0,16,0,10,10,131048,131048,TRUE,FALSE,FALSE,131102,1025,131092,1025,131084,1025,"xid 4 pages for txn rec; data 10 bytes (exact fit) [deq, txn]"
+172,"L",4,16,0,16,1,10,10,131049,131049,TRUE,FALSE,FALSE,131103,1025,131093,1025,131085,1025,"xid 4 pages + 1 byte for txn rec; data 10 bytes (exact fit) [deq, txn]"
+173,"L",3.5,16,0,16,0,10,10,114664,114664,TRUE,FALSE,FALSE,114718,897,114708,897,114700,897,"xid 3.5 pages for txn rec; data 10 bytes (exact fit) [deq, txn]"
+174,"L",3.5,16,0,16,1,10,10,114665,114665,TRUE,FALSE,FALSE,114719,897,114709,897,114701,897,"xid 3.5 pages + 1 byte for txn rec; data 10 bytes (exact fit) [deq, txn]"
+,,,,,,,,,,,,,,,,,,,,
+"High volume tests of random message lengths - RHM_WRONLY req'd for auto-dequeue == FALSE",,,,,,,,,,,,,,,,,,,,
+#175,"M",1,5000000,0,5000000,0,0,84,0,0,TRUE,FALSE,FALSE,128,1,32,1,0,0,"1 dblk max [deq]"
+#176,"M",3,3000000,0,3000000,0,0,340,0,0,TRUE,FALSE,FALSE,384,3,32,1,0,0,"3 dblks max [deq]"
+#177,"M",10,1600000,0,1600000,0,0,1236,0,0,TRUE,FALSE,FALSE,1280,10,32,1,0,0,"10 dblks max [deq]"
+#178,"M",30,600000,0,600000,0,0,3796,0,0,TRUE,FALSE,FALSE,3840,30,32,1,0,0,"30 dblks max [deq]"
+#179,"M",100,200000,0,200000,0,0,12756,0,0,TRUE,FALSE,FALSE,12800,100,32,1,0,0,"100 dblks max [deq]"
+#180,"M",300,60000,0,60000,0,0,38356,0,0,TRUE,FALSE,FALSE,38400,300,32,1,0,0,"300 dblks max [deq]"
+#181,"M",1000,20000,0,20000,0,0,127956,0,0,TRUE,FALSE,FALSE,128000,1000,32,1,0,0,"1000 dblks max [deq]"
+#182,"M",1,5000000,0,5000000,0,0,100,1,100,TRUE,FALSE,FALSE,244,2,144,2,136,2,"100 bytes xid max + 100 bytes data max [deq txn]"
+#183,"M",3,3000000,0,3000000,0,0,300,1,300,TRUE,FALSE,FALSE,644,6,344,3,336,3,"300 bytes xid max + 300 bytes data max [deq txn]"
+#184,"M",10,1600000,0,1600000,0,0,1000,1,1000,TRUE,FALSE,FALSE,2044,16,1044,9,1036,9,"1000 bytes xid max + 1000 bytes data max [deq txn]"
+#185,"M",30,600000,0,600000,0,0,3000,1,3000,TRUE,FALSE,FALSE,6044,48,3044,24,3036,24,"3000 bytes xid max + 3000 bytes data max [deq txn]"
+#186,"M",100,200000,0,200000,0,0,10000,1,10000,TRUE,FALSE,FALSE,20044,157,10044,79,10036,79,"10000 bytes xid max + 10000 bytes data max [deq txn]"
+#187,"M",300,60000,0,60000,0,0,30000,1,30000,TRUE,FALSE,FALSE,60044,470,30044,235,30036,235,"30000 bytes xid max + 30000 bytes data max [deq txn]"
+#188,"M",1000,20000,0,20000,0,0,100000,1,100000,TRUE,FALSE,FALSE,200044,1563,100044,782,100036,782,"100000 bytes xid max + 100000 bytes data max [deq txn]"
+,,,,,,,,,,,,,,,,,,,,
+"STANDARD PERFORMANCE BENCHMARK: 10,000,000 writes, data=212b (2 dblks)",,,,,,,,,,,,,,,,,,,,
+#189,"M",1,10000000,0,10000000,0,212,212,0,0,TRUE,FALSE,FALSE,256,2,32,1,0,0,"212 bytes data (2 dblks enq + 1 dblk deq)"
+#190,"M",1,10000000,0,10000000,0,148,148,64,64,TRUE,FALSE,FALSE,256,2,108,1,100,1,"148 bytes data + 64 bytes xid (2 dblks enq + 1 dblks deq + 1 dblks txn)"
Added: store/trunk/cpp/tests/jrnl/jtt/main.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/main.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/main.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,121 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "config.hpp"
+#include "test_mgr.hpp"
+
+#include <boost/program_options.hpp>
+#include <iostream>
+#include <signal.h>
+
+namespace po = boost::program_options;
+
+int main(int argc, char** argv)
+{
+ ::signal(SIGINT, rhm::jtt::test_mgr::signal_handler);
+ ::signal(SIGTERM, rhm::jtt::test_mgr::signal_handler);
+
+ unsigned num_jrnls;
+ std::string test_case_csv_file_name;
+ bool jrnl_format_chk = false;
+ bool reuse_instance = false;
+ bool recover_mode = false;
+ bool random_test_order = false;
+ bool repeat_flag = false;
+ bool keep_jrnls = false;
+
+ std::cout << PACKAGE_NAME << " v." << VERSION << std::endl;
+
+ std::ostringstream oss;
+ oss << PACKAGE_NAME << " options";
+ po::options_description od(oss.str());
+ od.add_options()
+ ("help", "This help message")
+ ("num_jrnls", po::value<unsigned>(&num_jrnls)->default_value(1),
+ "Number of simultaneous journal instances to test")
+ ("test_case_csv", po::value<std::string>(&test_case_csv_file_name)->default_value("jtt.csv"),
+ "CSV file containing test cases")
+ ("jrnl_format_chk", po::value<bool>(&jrnl_format_chk)->zero_tokens(),
+ "If true, will check the format of each journal file")
+ ("reuse_instance", po::value<bool>(&reuse_instance)->zero_tokens(),
+ "If true, will cause first journal instance to be reused for all test cases")
+ ("recover_mode", po::value<bool>(&recover_mode)->zero_tokens(),
+ "If true, will cause the journal from the previous test to be recovered")
+ ("random_test_order", po::value<bool>(&random_test_order)->zero_tokens(),
+ "If true, will randomize the order of the tests in the csv file")
+ ("repeat", po::value<bool>(&repeat_flag)->zero_tokens(),
+ "If true, will repeat tests in csv file indefinitely")
+ ("keep_jrnls", po::value<bool>(&keep_jrnls)->zero_tokens(),
+ "If true, will keep all test journals in backup dirs");
+ po::variables_map vmap;
+ try
+ {
+ po::store(po::parse_command_line(argc, argv, od), vmap);
+ po::notify(vmap);
+ }
+ catch (const std::exception& e)
+ {
+ std::cout << "ERROR: " << e.what() << std::endl;
+ std::cout << od << std::endl;
+ return 1;
+ }
+ if (vmap.count("help"))
+ {
+ std::cout << od << std::endl;
+ return 0;
+ }
+ if (num_jrnls == 0)
+ {
+ std::cout << "ERROR: num_jrnls must be 1 or more." << std::endl;
+ std::cout << od << std::endl;
+ return 1;
+ }
+ if (repeat_flag && keep_jrnls)
+ {
+ std::string resp;
+ std::cout << "WARNING: repeat and keep_jrnls: Monitor disk usage as test journals will accumulate." << std::endl;
+ std::cout << "Continue? <y/n> ";
+ std::cin >> resp;
+ if (resp.size() == 1)
+ {
+ if (resp[0] != 'y' && resp[0] != 'Y')
+ return 0;
+ }
+ else if (resp.size() == 3) // any combo of lower- and upper-case
+ {
+ if (resp[0] != 'y' && resp[0] != 'Y')
+ return 0;
+ if (resp[1] != 'e' && resp[1] != 'E')
+ return 0;
+ if (resp[2] != 's' && resp[2] != 'S')
+ return 0;
+ }
+ else
+ return 0;
+ }
+
+ rhm::jtt::test_mgr tm(num_jrnls);
+ tm.run(test_case_csv_file_name, jrnl_format_chk, reuse_instance, recover_mode,
+ random_test_order, repeat_flag, keep_jrnls);
+ return 0;
+}
Added: store/trunk/cpp/tests/jrnl/jtt/test_case.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_case.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/test_case.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,171 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "test_case.hpp"
+
+#include <iomanip>
+#include <sstream>
+
+namespace rhm
+{
+namespace jtt
+{
+
+test_case::test_case(const unsigned test_case_num, const u_int32_t num_msgs,
+ const size_t min_data_size, const size_t max_data_size, const bool auto_deq,
+ const size_t min_xid_size, const size_t max_xid_size, const transient_t transient,
+ const external_t external, const std::string& comment):
+ _test_case_num(test_case_num),
+ _num_msgs(num_msgs),
+ _min_data_size(min_data_size),
+ _max_data_size(max_data_size),
+ _auto_dequeue(auto_deq),
+ _min_xid_size(min_xid_size),
+ _max_xid_size(max_xid_size),
+ _transient(transient),
+ _external(external),
+ _comment(comment),
+ _result_average(),
+ _result_jmap()
+{}
+
+test_case::~test_case()
+{}
+
+const size_t
+test_case::this_data_size() const
+{
+ if (_min_data_size == _max_data_size)
+ return _max_data_size;
+ size_t size_diff = _max_data_size - _min_data_size;
+ return _min_data_size + size_t(1.0 * rand() * size_diff/(RAND_MAX + 1.0));
+}
+
+const size_t
+test_case::this_xid_size() const
+{
+ // TODO: rework when probabilities are introduced. Assume 50% if _min_xid_size = 0
+ if (_max_xid_size == 0)
+ return size_t(0);
+ if (_min_xid_size == 0)
+ {
+ if (1.0 * rand() / RAND_MAX < 0.5)
+ return size_t(0);
+ }
+ size_t size_diff = _max_xid_size - _min_xid_size;
+ return _min_xid_size + size_t(1.0 * rand() * size_diff/(RAND_MAX + 1.0));
+}
+
+const bool
+test_case::this_transience() const
+{
+ // TODO: rework when probabilities are introduced. Assume 50% if JTT_RANDOM
+ if (_transient == JTT_TRANSIENT)
+ return false;
+ if (_transient == JTT_PERSISTNET)
+ return true;
+ return 1.0 * rand() / RAND_MAX < 0.5;
+}
+
+const bool
+test_case::this_external() const
+{
+ // TODO: rework when probabilities are introduced. Assume 50% if JDL_RANDOM
+ if (_external == JDL_INTERNAL)
+ return false;
+ if (_external == JDL_EXTERNAL)
+ return true;
+ return 1.0 * rand() / RAND_MAX < 0.5;
+}
+
+void
+test_case::add_result(test_case_result::shared_ptr& tcrp)
+{
+ _result_average.add_test_result(tcrp);
+ res_map_citr ari = _result_jmap.find(tcrp->jid());
+ if (ari == _result_jmap.end())
+ {
+ test_case_result_agregation::shared_ptr p(new test_case_result_agregation(tcrp->jid()));
+ p->add_test_result(tcrp);
+ _result_jmap.insert(res_map_pair(tcrp->jid(), p));
+ }
+ else
+ ari->second->add_test_result(tcrp);
+}
+
+const test_case_result::shared_ptr
+test_case::jmap_last(std::string& jid) const
+{
+ res_map_citr i = _result_jmap.find(jid);
+ if (i == _result_jmap.end())
+ return test_case_result::shared_ptr();
+ u_int32_t num_res = (*i).second->num_results();
+ if (num_res)
+ return (*(*i).second)[num_res - 1];
+ return test_case_result::shared_ptr();
+}
+
+void
+test_case::clear()
+{
+ _result_average.clear();
+ _result_jmap.clear();
+}
+
+const std::string
+test_case::str() const
+{
+ std::ostringstream oss;
+ oss << "Test Parameters: Test case no. " << _test_case_num << ":" << std::endl;
+ oss << " Comment: " << _comment << std::endl;
+ oss << " Number of messages: " << _num_msgs << std::endl;
+ oss << " Data size: " << _min_data_size;
+ if (_min_data_size == _max_data_size)
+ oss << " bytes (fixed)" << std::endl;
+ else
+ oss << " - " << _max_data_size << " bytes" << std::endl;
+ oss << " XID size: " << _min_xid_size;
+ if (_min_xid_size == _max_xid_size)
+ oss << " bytes (fixed)" << std::endl;
+ else
+ oss << " - " << _max_xid_size << " bytes" << std::endl;
+ oss << " Auto-dequeue: " << (_auto_dequeue ? "true" : "false") << std::endl;
+ oss << " Persistence: ";
+ switch (_transient)
+ {
+ case JTT_TRANSIENT: oss << "TRANSIENT" << std::endl; break;
+ case JTT_PERSISTNET: oss << "PERSISTNET" << std::endl; break;
+ case JTT_RANDOM: oss << "RANDOM" << std::endl; break;
+ }
+ oss << " Message Data: ";
+ switch (_external)
+ {
+ case JDL_INTERNAL: oss << "INTERNAL"; break;
+ case JDL_EXTERNAL: oss << "EXTERNAL"; break;
+ case JDL_RANDOM: oss << "RANDOM"; break;
+ }
+ return oss.str();
+}
+
+} // namespace jtt
+} // namespace rhm
Added: store/trunk/cpp/tests/jrnl/jtt/test_case.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_case.hpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/test_case.hpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,109 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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.
+*/
+
+#ifndef rhm_jtt_test_case_hpp
+#define rhm_jtt_test_case_hpp
+
+#include "test_case_result.hpp"
+#include "test_case_result_agregation.hpp"
+#include <boost/shared_ptr.hpp>
+#include <map>
+#include <vector>
+
+namespace rhm
+{
+namespace jtt
+{
+
+ class test_case
+ {
+ public:
+ enum transient_type { JTT_TRANSIENT = 0, JTT_PERSISTNET, JTT_RANDOM };
+ typedef transient_type transient_t;
+
+ enum data_location { JDL_INTERNAL = 0, JDL_EXTERNAL, JDL_RANDOM };
+ typedef data_location external_t;
+
+ typedef boost::shared_ptr<test_case> shared_ptr;
+
+ typedef std::map<std::string, test_case_result_agregation::shared_ptr> res_map;
+ typedef std::pair<std::string, test_case_result_agregation::shared_ptr> res_map_pair;
+ typedef res_map::const_iterator res_map_citr;
+
+ private:
+ unsigned _test_case_num;
+ u_int32_t _num_msgs;
+ size_t _min_data_size;
+ size_t _max_data_size;
+ bool _auto_dequeue;
+ // TODO: add probability of transaction to these params
+ size_t _min_xid_size;
+ size_t _max_xid_size;
+ // TODO: change these enums (transient_t & external_t) to probabilities
+ transient_t _transient;
+ external_t _external;
+ std::string _comment;
+
+ test_case_result_agregation _result_average; // overall average result
+ res_map _result_jmap; // map of per-journal averages
+
+ public:
+ test_case(const unsigned test_case_num, const u_int32_t num_msgs,
+ const size_t min_data_size, const size_t max_data_size, const bool auto_deq,
+ const size_t min_xid_size, const size_t max_xid_size, const transient_t transient,
+ const external_t external, const std::string& comment);
+ ~test_case();
+
+ inline const unsigned test_case_num() const { return _test_case_num; }
+ inline const u_int32_t num_msgs() const { return _num_msgs; }
+ inline const size_t min_data_size() const { return _min_data_size; }
+ inline const size_t max_data_size() const { return _max_data_size; }
+ const size_t this_data_size() const;
+ inline const bool auto_deq() const { return _auto_dequeue; }
+ inline const size_t min_xid_size() const { return _min_xid_size; }
+ inline const size_t max_xid_size() const { return _max_xid_size; }
+ const size_t this_xid_size() const;
+ inline const transient_t transient() const { return _transient; }
+ const bool this_transience() const;
+ inline const external_t external() const { return _external; }
+ const bool this_external() const;
+ inline const std::string& comment() const { return _comment; }
+
+ void add_result(test_case_result::shared_ptr& p);
+
+ inline const test_case_result_agregation& average() const { return _result_average; }
+ inline const u_int32_t num_results() const { return _result_average.num_results(); }
+ inline unsigned num_jrnls() const { return _result_jmap.size(); }
+ inline res_map_citr jrnl_average(std::string& jid) const { return _result_jmap.find(jid); }
+ inline res_map_citr jmap_begin() const { return _result_jmap.begin(); }
+ inline res_map_citr jmap_end() const { return _result_jmap.end(); }
+ const test_case_result::shared_ptr jmap_last(std::string& jid) const;
+
+ void clear();
+ const std::string str() const;
+ };
+
+} // namespace jtt
+} // namespace rhm
+
+#endif // ifndef rhm_jtt_test_case_hpp
Added: store/trunk/cpp/tests/jrnl/jtt/test_case_result.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_case_result.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/test_case_result.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,208 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "test_case_result.hpp"
+
+#include <iomanip>
+#include <sstream>
+
+namespace rhm
+{
+namespace jtt
+{
+
+test_case_result::test_case_result(const std::string& jid):
+ _jid(jid),
+ _num_enq(0),
+ _num_deq(0),
+ _num_read(0),
+ _exception_flag(false),
+ _err_code(0)
+{
+ _start_time.tv_sec = 0;
+ _start_time.tv_nsec = 0;
+ _stop_time.tv_sec = 0;
+ _stop_time.tv_nsec = 0;
+ _test_time.tv_sec = 0;
+ _test_time.tv_nsec = 0;
+}
+
+test_case_result::~test_case_result()
+{}
+
+const std::string
+test_case_result::test_time_str() const
+{
+ if (_test_time.tv_nsec == 0)
+ return "0.0";
+ std::ostringstream oss;
+ oss << _test_time.tv_sec << ".";
+ oss << std::setfill('0') << std::setw(9) << _test_time.tv_nsec;
+ return oss.str();
+}
+
+void
+test_case_result::set_exception(const journal::jexception& e, const bool set_stop_time_flag)
+{
+ if (set_stop_time_flag)
+ set_stop_time();
+ _exception_flag = true;
+ _err_code = e.err_code();
+ _exception_str = e.what();
+}
+
+void
+test_case_result::set_exception(const std::string& err_str, const bool set_stop_time_flag)
+{
+ if (set_stop_time_flag)
+ set_stop_time();
+ _exception_flag = true;
+ _exception_str = err_str;
+}
+
+void
+test_case_result::clear()
+{
+ _num_enq = 0;
+ _num_deq = 0;
+ _num_read = 0;
+ _start_time.tv_sec = 0;
+ _start_time.tv_nsec = 0;
+ _stop_time.tv_sec = 0;
+ _stop_time.tv_nsec = 0;
+ _test_time.tv_sec = 0;
+ _test_time.tv_nsec = 0;
+ _exception_flag = false;
+ _err_code = 0;
+ _exception_str = "";
+}
+
+const std::string
+test_case_result::str(const bool summary) const
+{
+ std::ostringstream oss;
+ if (summary)
+ {
+ oss << _jid << ":";
+ oss << str_summary();
+ if (_exception_flag)
+ oss << "; fail: " << _exception_str << std::endl;
+ else
+ oss << "; ok" << std::endl;
+ }
+ else
+ {
+ oss << "--- Journal instance: jid=\"" << _jid << "\" ---" << std::endl;
+ oss << str_full();
+ if (_exception_flag)
+ oss << " exception/error:" << _exception_str << std::endl;
+ }
+ return oss.str();
+}
+
+const std::string
+test_case_result::str_full() const
+{
+ double t = _test_time.tv_sec + (_test_time.tv_nsec/1e9);
+ std::ostringstream oss;
+ oss.setf(std::ios::fixed, std::ios::floatfield);
+ oss.precision(2);
+ if (!_exception_flag)
+ {
+ oss.precision(6);
+ oss << " total test time: " << t << "s" << std::endl;
+ }
+ oss.precision(3);
+ oss << " total number enqueues: " << _num_enq;
+ if (!_exception_flag)
+ oss << " (" << (_num_enq / t) << " enq/sec)";
+ oss << std::endl;
+ oss << " total number dequeues: " << _num_deq;
+ if (!_exception_flag)
+ oss << " (" << (_num_deq / t) << " deq/sec)";
+ oss << std::endl;
+ oss << "total write operations: " << (_num_enq + _num_deq);
+ if (!_exception_flag)
+ oss << " (" << ((_num_enq + _num_deq) / t) << " wrops/sec)";
+ oss << std::endl;
+ oss << " total number reads: " << _num_read;
+ if (!_exception_flag)
+ oss << " (" << (_num_read / t) << " rd/sec)";
+ oss << std::endl;
+ oss << " total operations: " << (_num_enq + _num_deq + _num_read);
+ if (!_exception_flag)
+ oss << " (" << ((_num_enq + _num_deq + _num_read) / t) << " ops/sec)";
+ oss << std::endl;
+ oss << " overall result: " << (_exception_flag ? "*** FAIL ***" : "PASS") << std::endl;
+ return oss.str();
+}
+
+const std::string
+test_case_result::str_summary() const
+{
+ double t = _test_time.tv_sec + (_test_time.tv_nsec/1e9);
+ std::ostringstream oss;
+ oss.setf(std::ios::fixed, std::ios::floatfield);
+ if (_exception_flag)
+ oss << " exception";
+ else
+ {
+ oss.precision(6);
+ oss << " t=" << t << "s;";
+ }
+ oss.precision(3);
+ oss << " enq=" << _num_enq;
+ if (!_exception_flag)
+ oss << " (" << (_num_enq / t) << ")";
+ oss << "; deq=" << _num_deq;
+ if (!_exception_flag)
+ oss << " (" << (_num_deq / t) << ")";
+ oss << "; wr=" << (_num_enq + _num_deq);
+ if (!_exception_flag)
+ oss << " (" << ((_num_enq + _num_deq) / t) << ")";
+ oss << "; rd=" << _num_read;
+ if (!_exception_flag)
+ oss << " (" << (_num_read / t) << ")";
+ oss << "; tot=" << (_num_enq + _num_deq + _num_read);
+ if (!_exception_flag)
+ oss << " (" << ((_num_enq + _num_deq + _num_read) / t) << ")";
+ return oss.str();
+}
+
+void
+test_case_result::calc_test_time()
+{
+ if (_start_time.tv_sec > 0 && _stop_time.tv_sec >= _start_time.tv_sec)
+ {
+ _test_time.tv_sec = _stop_time.tv_sec - _start_time.tv_sec;
+ _test_time.tv_nsec = _stop_time.tv_nsec - _start_time.tv_nsec;
+ if (_test_time.tv_nsec < 0)
+ {
+ _test_time.tv_nsec += 1000000000;
+ _test_time.tv_sec--;
+ }
+ }
+}
+
+} // namespace jtt
+} // namespace rhm
Added: store/trunk/cpp/tests/jrnl/jtt/test_case_result.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_case_result.hpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/test_case_result.hpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,94 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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.
+*/
+
+#ifndef rhm_jtt_test_case_result_hpp
+#define rhm_jtt_test_case_result_hpp
+
+#include <boost/shared_ptr.hpp>
+#include <jrnl/jexception.hpp>
+#include <string>
+
+namespace rhm
+{
+namespace jtt
+{
+
+ class test_case_result
+ {
+ public:
+ typedef boost::shared_ptr<test_case_result> shared_ptr;
+
+ protected:
+ std::string _jid;
+ u_int32_t _num_enq;
+ u_int32_t _num_deq;
+ u_int32_t _num_read;
+ timespec _start_time;
+ timespec _stop_time;
+ timespec _test_time;
+
+ bool _exception_flag;
+ u_int32_t _err_code;
+ std::string _exception_str;
+
+ public:
+ test_case_result(const std::string& jid);
+ virtual ~test_case_result();
+
+ inline const std::string& jid() const { return _jid; }
+ inline const u_int32_t num_enq() const { return _num_enq; }
+ inline const u_int32_t incr_num_enq() { return ++_num_enq; }
+ inline const u_int32_t num_deq() const { return _num_deq; }
+ inline const u_int32_t incr_num_deq() { return ++_num_deq; }
+ inline const u_int32_t num_read() const { return _num_read; }
+ inline const u_int32_t incr_num_read() { return ++_num_read; }
+
+ inline const timespec& start_time() const { return _start_time; }
+ inline void set_start_time() { ::clock_gettime(CLOCK_REALTIME, &_start_time); }
+ inline const timespec& stop_time() const { return _stop_time; }
+ inline void set_stop_time()
+ { ::clock_gettime(CLOCK_REALTIME, &_stop_time); calc_test_time(); }
+ inline void set_test_time(const timespec& ts)
+ { _test_time.tv_sec = ts.tv_sec; _test_time.tv_nsec = ts.tv_nsec; }
+ inline const timespec& test_time() const { return _test_time; }
+ const std::string test_time_str() const;
+
+ inline const bool exception() const { return _exception_flag; }
+ inline const u_int32_t err_code() const { return _err_code; }
+ inline const std::string& what() const { return _exception_str; }
+ void set_exception(const journal::jexception& e, const bool set_stop_time_flag = true);
+ void set_exception(const std::string& err_str, const bool set_stop_time_flag = true);
+
+ void clear();
+ const std::string str(const bool summary) const;
+
+ protected:
+ const std::string str_full() const;
+ const std::string str_summary() const;
+ void calc_test_time();
+ };
+
+} // namespace jtt
+} // namespace rhm
+
+#endif // ifndef rhm_jtt_test_case_result_hpp
Added: store/trunk/cpp/tests/jrnl/jtt/test_case_result_agregation.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_case_result_agregation.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/test_case_result_agregation.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,176 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "test_case_result_agregation.hpp"
+
+#include <iomanip>
+#include <sstream>
+
+namespace rhm
+{
+namespace jtt
+{
+
+test_case_result_agregation::test_case_result_agregation():
+ test_case_result("Average"),
+ _tc_average(true),
+ _rlist(),
+ _elist()
+{
+}
+
+test_case_result_agregation::test_case_result_agregation(const std::string& jid):
+ test_case_result(jid),
+ _tc_average(false),
+ _rlist(),
+ _elist()
+{}
+
+test_case_result_agregation::~test_case_result_agregation()
+{}
+
+void
+test_case_result_agregation::add_test_result(const test_case_result::shared_ptr& tcrp)
+{
+ if (_tc_average || _jid.compare(tcrp->jid()) == 0)
+ {
+ _num_enq += tcrp->num_enq();
+ _num_deq += tcrp->num_deq();
+ _num_read += tcrp->num_read();
+ add_test_time(tcrp->test_time());
+ if (tcrp->exception())
+ {
+ _exception_flag = true;
+ _elist.push_back(tcrp->what());
+ }
+ _rlist.push_back(tcrp);
+ }
+}
+
+void
+test_case_result_agregation::clear()
+{
+ test_case_result::clear();
+ _rlist.clear();
+ _elist.clear();
+}
+
+const std::string
+test_case_result_agregation::str(const bool last_only, const bool summary) const
+{
+ std::ostringstream oss;
+ if (last_only)
+ oss << " " << _rlist.at(_rlist.size()-1)->str(summary);
+ else
+ {
+ for (tcrp_list_citr i=_rlist.begin(); i!=_rlist.end(); i++)
+ oss << " " << (*i)->str(summary);
+ }
+ if (_rlist.size() > 1)
+ oss << " " << (summary ? str_summary(last_only) : str_full(last_only));
+ return oss.str();
+}
+
+const std::string
+test_case_result_agregation::str_full(const bool /*last_only*/) const
+{
+ std::ostringstream oss;
+ oss.precision(2);
+ if (_tc_average)
+ oss << "Average across all journal instances:" << std::endl;
+ else
+ oss << "Average for jid=\"" << _jid << "\":" << std::endl;
+ oss << " total number results: " << _rlist.size() << std::endl;
+ oss << " number exceptions: " << _elist.size() << " (" <<
+ (100.0 * _rlist.size() / _elist.size()) << "%)" << std::endl;
+
+ oss << test_case_result::str_full();
+
+ if (_exception_flag && _elist.size())
+ {
+ unsigned n = 0;
+ oss << "List of exceptions/errors:" << std::endl;
+ for (err_list_citr i = _elist.begin(); i != _elist.end(); i++, n++)
+ oss << " " << n << ". " << (*i) << std::endl;
+ }
+
+ if (!_tc_average && _rlist.size() > 1)
+ {
+ oss << "Individual results:" << std::endl;
+ for (tcrp_list_citr i=_rlist.begin(); i!=_rlist.end(); i++)
+ oss << " " << (*i)->str(false) << std::endl;
+ oss << std::endl;
+ }
+
+ return oss.str();
+}
+
+const std::string
+test_case_result_agregation::str_summary(const bool /*last_only*/) const
+{
+ std::ostringstream oss;
+ if (_tc_average)
+ oss << "overall average [" << _rlist.size() << "]:";
+ else
+ oss << "average (" << _rlist.size() << "):";
+
+ oss << test_case_result::str_summary();
+
+ if (_exception_flag && _elist.size())
+ {
+ if (_tc_average)
+ oss << " fail: " << _elist.size() << " exception" << (_elist.size()>1?"s":"") <<
+ std::endl;
+ else
+ {
+ if (_elist.size() == 1)
+ oss << " fail: " << *_elist.begin() << std::endl;
+ else
+ {
+ oss << std::endl;
+ unsigned n = 0;
+ for (err_list_citr i = _elist.begin(); i != _elist.end(); i++, n++)
+ oss << " " << n << ". " << (*i) << std::endl;
+ }
+ }
+ }
+ else
+ oss << " ok" << std::endl;
+ return oss.str();
+}
+
+const timespec&
+test_case_result_agregation::add_test_time(const timespec& t)
+{
+ _test_time.tv_sec += t.tv_sec;
+ _test_time.tv_nsec += t.tv_nsec;
+ if (_test_time.tv_nsec > 999999999)
+ {
+ _test_time.tv_nsec -= 1000000000;
+ _test_time.tv_sec++;
+ }
+ return _test_time;
+}
+
+} // namespace jtt
+} // namespace rhm
Added: store/trunk/cpp/tests/jrnl/jtt/test_case_result_agregation.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_case_result_agregation.hpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/test_case_result_agregation.hpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,81 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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.
+*/
+
+#ifndef rhm_jtt_test_case_result_agregation_hpp
+#define rhm_jtt_test_case_result_agregation_hpp
+
+#include "test_case_result.hpp"
+
+#include <vector>
+
+namespace rhm
+{
+namespace jtt
+{
+
+ class test_case_result_agregation : public test_case_result
+ {
+ public:
+ typedef boost::shared_ptr<test_case_result_agregation> shared_ptr;
+
+ typedef std::vector<test_case_result::shared_ptr> tcrp_list;
+ typedef tcrp_list::const_iterator tcrp_list_citr;
+
+ typedef std::vector<std::string> err_list;
+ typedef err_list::const_iterator err_list_citr;
+
+ private:
+ bool _tc_average;
+ tcrp_list _rlist;
+ err_list _elist;
+
+ public:
+ test_case_result_agregation(); // used for average across jrnl instances
+ test_case_result_agregation(const std::string& jid);
+ virtual ~test_case_result_agregation();
+
+ void add_test_result(const test_case_result::shared_ptr& tcrp);
+
+ inline const bool tc_average_mode() const { return _tc_average; }
+ inline const u_int32_t num_results() const { return _rlist.size(); }
+ inline tcrp_list_citr rlist_begin() const { return _rlist.begin(); }
+ inline tcrp_list_citr rlist_end() const { return _rlist.end(); }
+ inline const test_case_result::shared_ptr& operator[](unsigned i) const
+ { return _rlist[i]; }
+ inline const u_int32_t num_exceptions() const { return _elist.size(); }
+ inline err_list_citr elist_begin() const { return _elist.begin(); }
+ inline err_list_citr elist_end() const { return _elist.end(); }
+
+ void clear();
+ const std::string str(const bool last_only, const bool summary) const;
+
+ private:
+ const std::string str_full(const bool last_only) const;
+ const std::string str_summary(const bool last_only) const;
+ const timespec& add_test_time(const timespec& t);
+ };
+
+} // namespace jtt
+} // namespace rhm
+
+#endif // ifndef rhm_jtt_test_case_result_agregation_hpp
Added: store/trunk/cpp/tests/jrnl/jtt/test_case_set.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_case_set.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/test_case_set.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,165 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "test_case_set.hpp"
+
+#include <fstream>
+
+namespace rhm
+{
+namespace jtt
+{
+
+test_case_set::test_case_set():
+ _tc_list()
+{}
+
+test_case_set::test_case_set(const std::string& csv_filename, const csv_map& cols):
+ _tc_list()
+{
+ append_from_csv(csv_filename, cols);
+}
+
+test_case_set::~test_case_set()
+{}
+
+void
+test_case_set::append(const unsigned test_case_num, const u_int32_t num_msgs,
+ const size_t min_data_size, const size_t max_data_size, const bool auto_deq,
+ const size_t min_xid_size, const size_t max_xid_size,
+ const test_case::transient_t transient, const test_case::external_t external,
+ const std::string& comment)
+{
+ test_case::shared_ptr tcp(new test_case(test_case_num, num_msgs, min_data_size,
+ max_data_size, auto_deq, min_xid_size, max_xid_size, transient, external, comment));
+ append(tcp);
+}
+
+
+#define CSV_BUFF_SIZE 2048
+unsigned
+test_case_set::append_from_csv(const std::string& csv_filename, const csv_map& cols)
+{
+ unsigned num_tc = 0;
+ char buff[CSV_BUFF_SIZE];
+ std::ifstream ifs(csv_filename.c_str());
+ while (ifs.good())
+ {
+ ifs.getline(buff, (std::streamsize)CSV_BUFF_SIZE);
+ if (ifs.gcount())
+ {
+ test_case::shared_ptr tcp = get_tc_from_csv(buff, cols);
+ if (tcp.get())
+ {
+ append(tcp);
+ num_tc++;
+ }
+ }
+ }
+ return num_tc;
+}
+
+test_case::shared_ptr
+test_case_set::get_tc_from_csv(const std::string& csv_line, const csv_map& cols)
+{
+ unsigned test_case_num = 0;
+ u_int32_t num_msgs = 0;
+ size_t min_data_size = 0;
+ size_t max_data_size = 0;
+ bool auto_deq = false;
+ size_t min_xid_size = 0;
+ size_t max_xid_size = 0;
+ test_case::transient_t transient = test_case::JTT_TRANSIENT;
+ test_case::external_t external = test_case::JDL_INTERNAL;
+ std::string comment;
+
+ csv_tok t(csv_line);
+ unsigned col_num = 0;
+ for (csv_tok_citr t_itr = t.begin(); t_itr != t.end(); ++t_itr, ++col_num)
+ {
+ const std::string& tok = *t_itr;
+ csv_map_citr m_citr = cols.find(col_num);
+ if (m_citr != cols.end())
+ {
+ switch (m_citr->second)
+ {
+ case CSV_TC_NUM:
+ if (!tok.size() || tok[0] < '0' || tok[0] > '9')
+ return test_case::shared_ptr();
+ test_case_num = unsigned(::atol(tok.c_str()));
+ break;
+ case CSV_TC_NUM_MSGS: num_msgs = u_int32_t(::atol(tok.c_str())); break;
+ case CSV_TC_MIN_DATA_SIZE: min_data_size = size_t(::atol(tok.c_str())); break;
+ case CSV_TC_MAX_DATA_SIZE: max_data_size = size_t(::atol(tok.c_str())); break;
+ case CSV_TC_AUTO_DEQ:
+ if (tok == "TRUE" || tok == "1")
+ auto_deq = true;
+ break;
+ case CSV_TC_MIN_XID_SIZE: min_xid_size = size_t(::atol(tok.c_str())); break;
+ case CSV_TC_MAX_XID_SIZE: max_xid_size = size_t(::atol(tok.c_str())); break;
+ case CSV_TC_TRANSIENT:
+ if (tok == "TRUE" || tok == "1")
+ transient = test_case::JTT_PERSISTNET;
+ else if (tok == "RANDOM" || tok == "-1")
+ transient = test_case::JTT_RANDOM;
+ break;
+ case CSV_TC_EXTERNAL:
+ if (tok == "TRUE" || tok == "1")
+ external = test_case::JDL_EXTERNAL;
+ else if (tok == "RANDOM" || tok == "-1")
+ external = test_case::JDL_RANDOM;
+ break;
+ case CSV_TC_COMMENT: comment = *t_itr; break;
+ }
+ }
+ }
+ if (col_num)
+ return test_case::shared_ptr(new test_case(test_case_num, num_msgs, min_data_size,
+ max_data_size, auto_deq, min_xid_size, max_xid_size, transient, external, comment));
+ else
+ return test_case::shared_ptr();
+}
+
+// Static member initializations
+// This csv_map is for use on the standard spreadsheet-derived test case csv files.
+test_case_set::csv_map test_case_set::std_csv_map;
+bool test_case_set::_map_init = __init();
+
+const bool
+test_case_set::__init()
+{
+ std_csv_map.insert(test_case_set::csv_pair(0, test_case_set::CSV_TC_NUM));
+ std_csv_map.insert(test_case_set::csv_pair(5, test_case_set::CSV_TC_NUM_MSGS));
+ std_csv_map.insert(test_case_set::csv_pair(7, test_case_set::CSV_TC_MIN_DATA_SIZE));
+ std_csv_map.insert(test_case_set::csv_pair(8, test_case_set::CSV_TC_MAX_DATA_SIZE));
+ std_csv_map.insert(test_case_set::csv_pair(11, test_case_set::CSV_TC_AUTO_DEQ));
+ std_csv_map.insert(test_case_set::csv_pair(9, test_case_set::CSV_TC_MIN_XID_SIZE));
+ std_csv_map.insert(test_case_set::csv_pair(10, test_case_set::CSV_TC_MAX_XID_SIZE));
+ std_csv_map.insert(test_case_set::csv_pair(12, test_case_set::CSV_TC_TRANSIENT));
+ std_csv_map.insert(test_case_set::csv_pair(13, test_case_set::CSV_TC_EXTERNAL));
+ std_csv_map.insert(test_case_set::csv_pair(20, test_case_set::CSV_TC_COMMENT));
+ return true;
+}
+
+} // namespace jtt
+} // namespace rhm
Added: store/trunk/cpp/tests/jrnl/jtt/test_case_set.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_case_set.hpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/test_case_set.hpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,95 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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.
+*/
+
+#ifndef rhm_jtt_test_case_set_hpp
+#define rhm_jtt_test_case_set_hpp
+
+#include "test_case.hpp"
+
+#include <boost/tokenizer.hpp>
+#include <map>
+#include <vector>
+
+namespace rhm
+{
+namespace jtt
+{
+
+ class test_case_set
+ {
+ public:
+ enum csv_col_enum {
+ CSV_TC_NUM = 0,
+ CSV_TC_NUM_MSGS,
+ CSV_TC_MIN_DATA_SIZE,
+ CSV_TC_MAX_DATA_SIZE,
+ CSV_TC_AUTO_DEQ,
+ CSV_TC_MIN_XID_SIZE,
+ CSV_TC_MAX_XID_SIZE,
+ CSV_TC_TRANSIENT,
+ CSV_TC_EXTERNAL,
+ CSV_TC_COMMENT };
+ typedef std::pair<unsigned, csv_col_enum> csv_pair;
+ typedef std::map<unsigned, csv_col_enum> csv_map;
+ typedef csv_map::const_iterator csv_map_citr;
+ static csv_map std_csv_map;
+
+ typedef std::vector<test_case::shared_ptr> tcl;
+ typedef tcl::iterator tcl_itr;
+ typedef tcl::const_iterator tcl_citr;
+
+ typedef boost::tokenizer<boost::escaped_list_separator<char> > csv_tok;
+ typedef csv_tok::const_iterator csv_tok_citr;
+
+ private:
+ tcl _tc_list;
+ static bool _map_init;
+
+ public:
+ test_case_set();
+ test_case_set(const std::string& csv_filename, const csv_map& cols = std_csv_map);
+ virtual ~test_case_set();
+
+ inline const unsigned size() const { return _tc_list.size(); }
+ inline const bool empty() const { return _tc_list.empty(); }
+
+ inline void append(const test_case::shared_ptr& tc) { _tc_list.push_back(tc); }
+ void append(const unsigned test_case_num, const u_int32_t num_msgs,
+ const size_t min_data_size, const size_t max_data_size, const bool auto_deq,
+ const size_t min_xid_size, const size_t max_xid_size,
+ const test_case::transient_t transient,
+ const test_case::external_t external, const std::string& comment);
+ unsigned append_from_csv(const std::string& csv_filename, const csv_map& cols = std_csv_map);
+ inline tcl_itr begin() { return _tc_list.begin(); }
+ inline tcl_itr end() { return _tc_list.end(); }
+ inline const test_case::shared_ptr& operator[](unsigned i) { return _tc_list[i]; }
+
+ private:
+ test_case::shared_ptr get_tc_from_csv(const std::string& csv_line, const csv_map& cols);
+ static const bool __init();
+ };
+
+} // namespace jtt
+} // namespace rhm
+
+#endif // ifndef rhm_jtt_test_case_set_hpp
Added: store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/test_mgr.cpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,183 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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 "test_mgr.hpp"
+
+#include <iostream>
+#include "test_case_set.hpp"
+
+namespace rhm
+{
+namespace jtt
+{
+
+test_mgr::test_mgr(const unsigned num_jrnls):
+ _ji_list(),
+ _num_jrnls(num_jrnls)
+{
+ std::cout << "Number of journals: " << _num_jrnls << std::endl;
+}
+
+test_mgr::~test_mgr()
+{}
+
+void
+test_mgr::run(const std::string& tc_csv_file_name, const bool jrnl_format_chk,
+ const bool reuse_instance, const bool recover_mode, const bool random_test_order,
+ const bool repeat_flag, const bool keep_jrnls)
+{
+ // TODO: complete tidy-up of non-summary (verbose) results, then pull through
+ // a command-line summary to control this.
+ // Idea: --summary: prints short results afterwards
+ // --verbose: prints long version as test progresses
+ // defualt: none of these, similar to current summary = true version.
+ const bool summary = true;
+
+ std::cout << "CSV file: \"" << tc_csv_file_name << "\"";
+ test_case_set tcs(tc_csv_file_name);
+ const unsigned num_test_cases = tcs.size();
+ if (num_test_cases)
+ std::cout << " (containing " << tcs.size() << " test cases)" << std::endl;
+ else
+ std::cout << " (WARNING: This CSV file is empty or does not exist.)" << std::endl;
+ if (jrnl_format_chk || reuse_instance || recover_mode || random_test_order || repeat_flag ||
+ keep_jrnls)
+ {
+ std::cout << "Options:";
+ if (jrnl_format_chk)
+ std::cout << " jrnl_format_chk";
+ if (reuse_instance)
+ std::cout << " reuse_instance";
+ if (recover_mode)
+ std::cout << " recover_mode";
+ if (random_test_order)
+ std::cout << " random_test_order";
+ if (repeat_flag)
+ std::cout << " repeat_flag";
+ if (keep_jrnls)
+ std::cout << " keep_jrnls";
+ std::cout << std::endl;
+ }
+ std::cout << std::endl;
+
+ do
+ {
+ unsigned u = 0;
+ for (test_case_set::tcl_itr tci = tcs.begin(); tci != tcs.end(); tci++, u++)
+ {
+ if (summary)
+ std::cout << "Test case " << (*tci)->test_case_num() << ": \"" <<
+ (*tci)->comment() << "\"" << std::endl;
+ else
+ std::cout << (*tci)->str() << std::endl;
+ if (!reuse_instance || _ji_list.empty())
+ initialize_jrnls();
+ for (ji_list_citr jii=_ji_list.begin(); jii!=_ji_list.end(); jii++)
+ (*jii)->init_tc(*tci, reuse_instance, recover_mode, keep_jrnls);
+ for (ji_list_citr jii=_ji_list.begin(); jii!=_ji_list.end(); jii++)
+ (*jii)->run_tc();
+ for (ji_list_citr jii=_ji_list.begin(); jii!=_ji_list.end(); jii++)
+ (*jii)->tc_wait_compl();
+ if (jrnl_format_chk)
+ {
+ for (ji_list_citr jii=_ji_list.begin(); jii!=_ji_list.end(); jii++)
+ {
+ jrnl_init_params::shared_ptr jpp = (*jii)->params();
+ std::ostringstream oss;
+ oss << "jfile_chk.py -q";
+ oss << " -d " << jpp->jdir();
+ oss << " -b " << jpp->base_filename();
+ oss << " -c" << tc_csv_file_name;
+ oss << " -t" << (*tci)->test_case_num();
+ if (system(oss.str().c_str()))
+ {
+ std::cout << " Format check of journal in \"" << jpp->jdir() <<
+ "\" failed." << std::endl;
+ std::cout << (*tci)->str() << std::endl;
+ }
+ }
+ }
+ print_results(*tci, summary);
+ if (_abort || (!repeat_flag && _signal))
+ break;
+ }
+ }
+ while (repeat_flag && !_signal);
+}
+
+// static fn:
+void
+test_mgr::signal_handler(int sig)
+{
+ if (_signal)
+ _abort = true;
+ _signal = sig;
+ std::cout << std::endl;
+ std::cout << "********************************" << std::endl;
+ std::cout << "Caught signal " << sig << std::endl;
+ if (_abort)
+ std::cout << "Aborting..." << std::endl;
+ else
+ std::cout << "Completing current test cycle..." << std::endl;
+ std::cout << "********************************" << std::endl << std::endl;
+}
+
+void
+test_mgr::initialize_jrnls()
+{
+ _ji_list.clear();
+ for (unsigned i=0; i<_num_jrnls; i++)
+ {
+ std::ostringstream jid;
+ jid << std::hex << std::setfill('0');
+ jid << "test_" << std::setw(2) << std::hex << i;
+ std::ostringstream jdir;
+ jdir << "/tmp/" << 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);
+ }
+}
+
+void
+test_mgr::print_results(test_case::shared_ptr tcp, const bool summary)
+{
+ if (!summary)
+ std::cout << " === Results ===" << std::endl;
+
+ for (test_case::res_map_citr i=tcp->jmap_begin(); i!=tcp->jmap_end(); i++)
+ std::cout << (*i).second->str(summary, summary);
+ if (tcp->num_jrnls() > 1)
+ std::cout << tcp->average().str(summary, summary);
+
+ if (!summary)
+ std::cout << std::endl;
+}
+
+// static instances
+volatile sig_atomic_t test_mgr::_signal = 0;
+volatile bool test_mgr::_abort = false;
+
+} // namespace jtt
+} // namespace rhm
Added: store/trunk/cpp/tests/jrnl/jtt/test_mgr.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/test_mgr.hpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/jtt/test_mgr.hpp 2008-01-18 15:40:45 UTC (rev 1572)
@@ -0,0 +1,65 @@
+/**
+* Copyright 2008 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging 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.
+*/
+
+#ifndef rhm_jtt_test_mgr_hpp
+#define rhm_jtt_test_mgr_hpp
+
+#include "jrnl_instance.hpp"
+#include <signal.h>
+//#include "test_case_result_agregation.hpp"
+
+namespace rhm
+{
+namespace jtt
+{
+ class test_mgr
+ {
+ public:
+ typedef std::vector<jrnl_instance::shared_ptr> ji_list;
+ typedef ji_list::iterator ji_list_itr;
+ typedef ji_list::const_iterator ji_list_citr;
+
+ private:
+ ji_list _ji_list;
+ unsigned _num_jrnls;
+ static volatile sig_atomic_t _signal;
+ static volatile bool _abort;
+
+ public:
+ test_mgr(const unsigned num_jrnls);
+ ~test_mgr();
+ void run(const std::string& tc_csv_file_name, const bool jrnl_format_chk,
+ const bool reuse_instance, const bool recover_mode, const bool random_test_order,
+ const bool repeat_flag, const bool keep_jrnls);
+
+ static void signal_handler(int signal);
+
+ private:
+ void initialize_jrnls();
+ void print_results(test_case::shared_ptr tcp, const bool summary);
+ };
+
+} // namespace jtt
+} // namespace rhm
+
+#endif // ifndef rhm_jtt_test_mgr_hpp
More information about the rhmessaging-commits
mailing list