RandomAccessFileDeviceTest Class Reference

Inheritance diagram for RandomAccessFileDeviceTest:

TestBase TraceTarget List of all members.

Public Member Functions

 RandomAccessFileDeviceTest ()
void testPermanentNoDirect ()
void testTemporary ()
void testPermanentDirect ()
void runModeTests ()
virtual void testCaseTearDown ()
 Equivalent to JUnit TestCase.tearDown; this is called after each test case method is invoked.
TestSuitereleaseTestSuite ()
void beforeTestCase (std::string testCaseName)
void afterTestCase (std::string testCaseName)
virtual void testCaseSetUp ()
 Equivalent to JUnit TestCase.setUp; this is called before each test case method is invoked.
virtual void notifyTrace (std::string source, TraceLevel level, std::string message)
 Receives notification when a trace event occurs.
virtual TraceLevel getSourceTraceLevel (std::string source)
 Gets the level at which a particular source should be traced.

Static Public Member Functions

static void readParams (int argc, char **argv)
 Parses the command line.

Static Public Attributes

static ParamName paramTestSuiteName
static ParamName paramTraceFileName
static ParamName paramDictionaryFileName
static ParamName paramTraceLevel
static ParamName paramStatsFileName
static ParamName paramTraceStdout
static ParamName paramDegreeOfParallelism
static ConfigMap configMap
 Configuration parameters.

Protected Member Functions

void snooze (uint nSeconds)

Protected Attributes

TestSuitepTestSuite
 Boost test suite.
boost::shared_ptr< TestBasepTestObj
std::ofstream traceStream
 Output file stream for tracing.
StrictMutex traceMutex
 Protects traceStream.
std::string testName
 Name of test.
TraceLevel traceLevel
 Level at which to trace test execution.
FileStatsTarget statsTarget
 Output for stats.
StatsTimer statsTimer
 Timer for stats collection.
bool traceStdout
 Copy trace output to stdout.
bool traceFile
 Copy trace output to file.
TestCaseGroup defaultTests
TestCaseGroup extraTests

Static Protected Attributes

static bool runAll
 Run all test cases, including the extra tests.
static std::string runSingle
 Run only the test case of this name.

Private Member Functions

void openDevice (DeviceMode openMode, std::string devName)
void closeDevice ()
void testDeviceCreation ()
void testGrow ()
void testShrink ()
void testLargeFile ()
void testAsyncIO ()
void testRetryAsyncIO ()
void testAsyncIO (FileSize cbOffset, int n=5)
void testAsyncIOImpl (int n, uint cbSector, PBuffer pBuf, PBuffer pBuf2, FileSize cbOffset=0)

Private Attributes

DeviceAccessSchedulerParams schedParams
SharedRandomAccessDevice pRandomAccessDevice
DeviceMode baseMode

Static Private Attributes

static const uint ZERO_SIZE
static const uint HALF_SIZE
static const uint FULL_SIZE

Classes

class  Binding
class  Listener

Detailed Description

Definition at line 40 of file RandomAccessFileDeviceTest.cpp.


Constructor & Destructor Documentation

RandomAccessFileDeviceTest::RandomAccessFileDeviceTest (  )  [inline, explicit]

Definition at line 347 of file RandomAccessFileDeviceTest.cpp.

References TestBase::configMap, DeviceAccessSchedulerParams::readConfig(), schedParams, testLargeFile(), testPermanentDirect(), testPermanentNoDirect(), testRetryAsyncIO(), and testTemporary().

00348     {
00349         schedParams.readConfig(configMap);
00350         FENNEL_UNIT_TEST_CASE(RandomAccessFileDeviceTest,testPermanentNoDirect);
00351         FENNEL_UNIT_TEST_CASE(RandomAccessFileDeviceTest,testTemporary);
00352         FENNEL_UNIT_TEST_CASE(RandomAccessFileDeviceTest,testPermanentDirect);
00353         FENNEL_UNIT_TEST_CASE(RandomAccessFileDeviceTest,testRetryAsyncIO);
00354 
00355         // NOTE jvs 11-Feb-2006:  This is optional since it creates
00356         // a 5G file.  On operating systems with sparse-file support, it
00357         // doesn't actually take up that much disk space.
00358         FENNEL_EXTRA_UNIT_TEST_CASE(
00359             RandomAccessFileDeviceTest,testLargeFile);
00360     }


Member Function Documentation

void RandomAccessFileDeviceTest::openDevice ( DeviceMode  openMode,
std::string  devName 
) [inline, private]

Definition at line 50 of file RandomAccessFileDeviceTest.cpp.

References DeviceMode::create, pRandomAccessDevice, and FileSystem::remove().

Referenced by testAsyncIOImpl(), testDeviceCreation(), testGrow(), and testShrink().

00051     {
00052         if (openMode.create) {
00053             FileSystem::remove(devName.c_str());
00054         }
00055         pRandomAccessDevice.reset(
00056             new RandomAccessFileDevice(devName,openMode));
00057     }

void RandomAccessFileDeviceTest::closeDevice (  )  [inline, private]

Definition at line 59 of file RandomAccessFileDeviceTest.cpp.

References pRandomAccessDevice.

Referenced by testAsyncIOImpl(), testCaseTearDown(), testDeviceCreation(), testGrow(), and testShrink().

00060     {
00061         pRandomAccessDevice.reset();
00062     }

void RandomAccessFileDeviceTest::testDeviceCreation (  )  [inline, private]

Definition at line 64 of file RandomAccessFileDeviceTest.cpp.

References baseMode, closeDevice(), DeviceMode::create, FileSystem::doesFileExist(), openDevice(), and DeviceMode::temporary.

Referenced by runModeTests().

00065     {
00066         const char *devName = "test.dat";
00067         DeviceMode openMode = baseMode;
00068         openMode.create = 1;
00069         openDevice(openMode,devName);
00070         closeDevice();
00071         if (openMode.temporary) {
00072             if (FileSystem::doesFileExist(devName)) {
00073                 std::cerr << "temporary test.dat not deleted" << std::endl;
00074             }
00075         } else {
00076             openMode.create = 0;
00077             openDevice(openMode,devName);
00078             closeDevice();
00079         }
00080     }

void RandomAccessFileDeviceTest::testGrow (  )  [inline, private]

Definition at line 82 of file RandomAccessFileDeviceTest.cpp.

References baseMode, closeDevice(), DeviceMode::create, FULL_SIZE, openDevice(), pRandomAccessDevice, DeviceMode::temporary, and ZERO_SIZE.

Referenced by runModeTests().

00083     {
00084         const char *devName = "grow.dat";
00085         DeviceMode openMode = baseMode;
00086         openMode.create = 1;
00087         openDevice(openMode,devName);
00088         BOOST_CHECK_EQUAL(ZERO_SIZE, pRandomAccessDevice->getSizeInBytes());
00089         pRandomAccessDevice->setSizeInBytes(FULL_SIZE);
00090         BOOST_CHECK_EQUAL(FULL_SIZE, pRandomAccessDevice->getSizeInBytes());
00091         closeDevice();
00092         if (openMode.temporary) {
00093             return;
00094         }
00095         openMode.create = 0;
00096         openDevice(openMode,devName);
00097         BOOST_CHECK_EQUAL(FULL_SIZE, pRandomAccessDevice->getSizeInBytes());
00098         closeDevice();
00099     }

void RandomAccessFileDeviceTest::testShrink (  )  [inline, private]

Definition at line 101 of file RandomAccessFileDeviceTest.cpp.

References baseMode, closeDevice(), DeviceMode::create, FULL_SIZE, HALF_SIZE, openDevice(), pRandomAccessDevice, DeviceMode::temporary, and ZERO_SIZE.

Referenced by runModeTests().

00102     {
00103         const char *devName = "shrink.dat";
00104         DeviceMode openMode = baseMode;
00105         openMode.create = 1;
00106         openDevice(openMode,devName);
00107         BOOST_CHECK_EQUAL(ZERO_SIZE, pRandomAccessDevice->getSizeInBytes());
00108         pRandomAccessDevice->setSizeInBytes(FULL_SIZE);
00109         BOOST_CHECK_EQUAL(FULL_SIZE, pRandomAccessDevice->getSizeInBytes());
00110         closeDevice();
00111         if (openMode.temporary) {
00112             return;
00113         }
00114         openMode.create = 0;
00115         openDevice(openMode,devName);
00116         BOOST_CHECK_EQUAL(FULL_SIZE, pRandomAccessDevice->getSizeInBytes());
00117         pRandomAccessDevice->setSizeInBytes(HALF_SIZE);
00118         closeDevice();
00119         openDevice(openMode,devName);
00120         BOOST_CHECK_EQUAL(HALF_SIZE, pRandomAccessDevice->getSizeInBytes());
00121         closeDevice();
00122     }

void RandomAccessFileDeviceTest::testLargeFile (  )  [inline, private]

Definition at line 124 of file RandomAccessFileDeviceTest.cpp.

References testAsyncIO().

Referenced by RandomAccessFileDeviceTest().

00125     {
00126         // Create a 5G file in order to test beyond 32-bit unsigned.
00127         FileSize cbOffset = 0x40000000; // 1G
00128         cbOffset *= 5;
00129         testAsyncIO(cbOffset);
00130     }

void RandomAccessFileDeviceTest::testAsyncIO (  )  [inline, private]

Definition at line 210 of file RandomAccessFileDeviceTest.cpp.

Referenced by runModeTests(), testLargeFile(), and testRetryAsyncIO().

00211     {
00212         testAsyncIO(0);
00213     }

void RandomAccessFileDeviceTest::testRetryAsyncIO (  )  [inline, private]

Definition at line 215 of file RandomAccessFileDeviceTest.cpp.

References testAsyncIO().

Referenced by RandomAccessFileDeviceTest().

00216     {
00217         testAsyncIO(0, 5000);
00218     }

void RandomAccessFileDeviceTest::testAsyncIO ( FileSize  cbOffset,
int  n = 5 
) [inline, private]

Definition at line 220 of file RandomAccessFileDeviceTest.cpp.

References VMAllocator::allocate(), VMAllocator::deallocate(), HALF_SIZE, and testAsyncIOImpl().

00221     {
00222         uint cbSector = HALF_SIZE;
00223         VMAllocator allocator(cbSector*n);
00224         void *pBuf = allocator.allocate();
00225         void *pBuf2 = allocator.allocate();
00226         BOOST_REQUIRE(pBuf != NULL);
00227         try {
00228             testAsyncIOImpl(
00229                 n, cbSector,
00230                 reinterpret_cast<PBuffer>(pBuf),
00231                 reinterpret_cast<PBuffer>(pBuf2),
00232                 cbOffset);
00233         } catch (...) {
00234             allocator.deallocate(pBuf);
00235             allocator.deallocate(pBuf2);
00236             throw;
00237         }
00238         allocator.deallocate(pBuf);
00239         allocator.deallocate(pBuf2);
00240     }

void RandomAccessFileDeviceTest::testAsyncIOImpl ( int  n,
uint  cbSector,
PBuffer  pBuf,
PBuffer  pBuf2,
FileSize  cbOffset = 0 
) [inline, private]

Definition at line 242 of file RandomAccessFileDeviceTest.cpp.

References baseMode, RandomAccessRequest::bindingList, RandomAccessRequest::cbOffset, RandomAccessRequest::cbTransfer, closeDevice(), DeviceMode::create, RandomAccessFileDeviceTest::Listener::getMutex(), DeviceAccessScheduler::newScheduler(), RandomAccessFileDeviceTest::Listener::nSuccess, openDevice(), RandomAccessRequest::pDevice, pRandomAccessDevice, RandomAccessRequest::READ, DeviceAccessScheduler::registerDevice(), schedParams, DeviceAccessScheduler::schedule(), DeviceAccessScheduler::stop(), DeviceMode::temporary, RandomAccessRequest::type, DeviceAccessScheduler::unregisterDevice(), RandomAccessFileDeviceTest::Listener::waitForAll(), and RandomAccessRequest::WRITE.

Referenced by testAsyncIO().

00245     {
00246         DeviceAccessScheduler *pScheduler =
00247             DeviceAccessScheduler::newScheduler(schedParams);
00248 
00249         const char *devName = "async.dat";
00250         DeviceMode openMode = baseMode;
00251         openMode.create = 1;
00252         openDevice(openMode,devName);
00253         FileSize cbFile = cbOffset;
00254         cbFile += n*cbSector;
00255         pRandomAccessDevice->setSizeInBytes(cbFile);
00256 
00257         // close and re-open to get the actual file size
00258         if (!openMode.temporary) {
00259             closeDevice();
00260             openMode.create = 0;
00261             openDevice(openMode,devName);
00262             FileSize cbFileActual = pRandomAccessDevice->getSizeInBytes();
00263             BOOST_CHECK_EQUAL(cbFile, cbFileActual);
00264         }
00265 
00266         pScheduler->registerDevice(pRandomAccessDevice);
00267         std::string s = "Four score and seven years ago.";
00268         char const *writeBuf = s.c_str();
00269         uint cb = s.size();
00270 
00271         Listener writeListener(n);
00272         RandomAccessRequest writeRequest;
00273         writeRequest.pDevice = pRandomAccessDevice.get();
00274         writeRequest.cbOffset = cbOffset;
00275         writeRequest.cbTransfer=n*cbSector;
00276         writeRequest.type = RandomAccessRequest::WRITE;
00277         memcpy(pBuf, writeBuf, cb);
00278         for (int i = 0; i < n; i++) {
00279             Binding *pBinding = new Binding(
00280                 writeListener,cbSector,PBuffer(pBuf));
00281             writeRequest.bindingList.push_back(*pBinding);
00282         }
00283 
00284         // LER-7110: take a redundant mutex on the listener around the request
00285         // to confirm that attempts to notify the listener don't deadlock in
00286         // the case where the async I/O queue is full
00287         StrictMutexGuard mutexGuard(writeListener.getMutex());
00288         pScheduler->schedule(writeRequest);
00289         mutexGuard.unlock();
00290 
00291         writeListener.waitForAll();
00292         BOOST_CHECK_EQUAL(n, writeListener.nSuccess);
00293         pRandomAccessDevice->flush();
00294 
00295         if (!openMode.temporary) {
00296             pScheduler->unregisterDevice(pRandomAccessDevice);
00297             closeDevice();
00298             openMode.create = 0;
00299             openDevice(openMode,devName);
00300             pScheduler->registerDevice(pRandomAccessDevice);
00301         }
00302 
00303         Listener readListener(n + 1);
00304         RandomAccessRequest readRequest;
00305         readRequest.pDevice = pRandomAccessDevice.get();
00306         readRequest.cbOffset = cbOffset;
00307         readRequest.cbTransfer = n*cbSector;
00308         readRequest.type = RandomAccessRequest::READ;
00309         for (int i = 0; i < n; i++) {
00310             Binding *pBinding = new Binding(
00311                 readListener,cbSector,
00312                 pBuf + i*cbSector);
00313             readRequest.bindingList.push_back(*pBinding);
00314         }
00315 
00316         // Test a simultaneous read on the same device which intersects
00317         // with the reads above; this simulates something like an online
00318         // backup reading into private buffers, aliasing the cache.
00319         RandomAccessRequest readRequest2;
00320         readRequest2.pDevice = pRandomAccessDevice.get();
00321         readRequest2.cbOffset = cbOffset;
00322         readRequest2.cbTransfer = cbSector;
00323         readRequest2.type = RandomAccessRequest::READ;
00324         Binding *pBinding = new Binding(
00325             readListener, cbSector, pBuf2);
00326         readRequest2.bindingList.push_back(*pBinding);
00327 
00328         pScheduler->schedule(readRequest);
00329         pScheduler->schedule(readRequest2);
00330         readListener.waitForAll();
00331         BOOST_CHECK_EQUAL(n + 1, readListener.nSuccess);
00332         for (int i = 0; i < n; i++) {
00333             std::string s2(reinterpret_cast<char *>(pBuf + i*cbSector),cb);
00334             BOOST_CHECK_EQUAL(s,s2);
00335         }
00336         std::string s3(reinterpret_cast<char *>(pBuf2),cb);
00337         BOOST_CHECK_EQUAL(s,s3);
00338 
00339         pScheduler->unregisterDevice(pRandomAccessDevice);
00340         closeDevice();
00341 
00342         pScheduler->stop();
00343         delete pScheduler;
00344     }

void RandomAccessFileDeviceTest::testPermanentNoDirect (  )  [inline]

Definition at line 362 of file RandomAccessFileDeviceTest.cpp.

References baseMode, DeviceMode::load, and runModeTests().

Referenced by RandomAccessFileDeviceTest().

00363     {
00364         baseMode = DeviceMode::load;
00365         runModeTests();
00366     }

void RandomAccessFileDeviceTest::testTemporary (  )  [inline]

Definition at line 368 of file RandomAccessFileDeviceTest.cpp.

References baseMode, DeviceMode::load, runModeTests(), and DeviceMode::temporary.

Referenced by RandomAccessFileDeviceTest().

00369     {
00370         baseMode = DeviceMode::load;
00371         baseMode.temporary = true;
00372         runModeTests();
00373     }

void RandomAccessFileDeviceTest::testPermanentDirect (  )  [inline]

Definition at line 375 of file RandomAccessFileDeviceTest.cpp.

References baseMode, DeviceMode::direct, DeviceMode::load, and runModeTests().

Referenced by RandomAccessFileDeviceTest().

00376     {
00377         baseMode = DeviceMode::load;
00378         baseMode.direct = true;
00379         runModeTests();
00380     }

void RandomAccessFileDeviceTest::runModeTests (  )  [inline]

Definition at line 382 of file RandomAccessFileDeviceTest.cpp.

References testAsyncIO(), testDeviceCreation(), testGrow(), and testShrink().

Referenced by testPermanentDirect(), testPermanentNoDirect(), and testTemporary().

00383     {
00384         testDeviceCreation();
00385         testGrow();
00386         testShrink();
00387         testAsyncIO();
00388     }

virtual void RandomAccessFileDeviceTest::testCaseTearDown (  )  [inline, virtual]

Equivalent to JUnit TestCase.tearDown; this is called after each test case method is invoked.

Default is no-op.

Reimplemented from TestBase.

Definition at line 390 of file RandomAccessFileDeviceTest.cpp.

References closeDevice().

00391     {
00392         closeDevice();
00393     }

void TestBase::snooze ( uint  nSeconds  )  [protected, inherited]

Definition at line 263 of file TestBase.cpp.

Referenced by DatabaseTest::executeForceTxn(), ThreadedTestBase::runThreadedTestCase(), PagingTestBase::testCacheResize(), BTreeTxnTest::testCheckpoint(), PagingTestBase::testCheckpointGuarded(), PagingTestBase::testPrefetch(), and PagingTestBase::testPrefetchBatch().

00264 {
00265 #ifdef __MSVC__
00266     ::_sleep(nSeconds*1000);
00267 #else
00268     ::sleep(nSeconds);
00269 #endif
00270 }

void TestBase::readParams ( int  argc,
char **  argv 
) [static, inherited]

Parses the command line.

format: [-v] [-t TEST | -all] {param=val}* [CONFIGFILE | -] Normally, the test program runs the default test cases. With the option "-all", runs the extra test cases as well. With the option "-t TEST", runs only the single test case named TEST. CONFIGFILE is read to load configuration parameters. Configuration parameters can also be set ad hoc, from the command line, as pairs name=val. These take precedence.

Definition at line 108 of file TestBase.cpp.

References TestBase::configMap, ConfigMap::dumpParams(), ConfigMap::isParamSet(), ConfigMap::mergeFrom(), TestBase::paramDictionaryFileName, ConfigMap::readParams(), TestBase::runAll, TestBase::runSingle, ConfigMap::setStringParam(), and verbose.

00109 {
00110     bool verbose = false;
00111     ConfigMap adhocMap;
00112 
00113     for (int i = 1; i < argc; ++i) {
00114         std::string arg = argv[i];
00115         if (argv[i][0] == '-') {
00116             if (arg == "-v") {
00117                 verbose = true;
00118             } else if (arg == "-") {
00119                 configMap.readParams(std::cin);
00120             } else if (arg == "-all") {
00121                 runAll = true;
00122             } else if (arg == "-t") {   // -t TEST
00123                 permAssert(i + 1 < argc);
00124                 runSingle = argv[++i];
00125             } else if (arg[1] == 't') { // allow -tTEST
00126                 runSingle = arg.substr(2);
00127             }
00128         } else {
00129             int i = arg.find("=");
00130             if ((0 < i) && (i < arg.size())) {
00131                 // an ad hoc parameter
00132                 std::string key = arg.substr(0,i);
00133                 std::string val = arg.substr(i + 1);
00134                 adhocMap.setStringParam(key,val);
00135             } else {
00136                 // a config file name
00137                 std::ifstream configFile(arg.c_str());
00138                 assert(configFile.good());
00139                 configMap.readParams(configFile);
00140             }
00141         }
00142     }
00143     configMap.mergeFrom(adhocMap);
00144 
00145     // set a default dictionary file location for use by tests that need a
00146     // small non-random sorted data set
00147     if (!configMap.isParamSet(paramDictionaryFileName)) {
00148         std::string dictFileName = "dictWords";
00149         configMap.setStringParam(paramDictionaryFileName,dictFileName);
00150     }
00151 
00152     if (verbose) {
00153         configMap.dumpParams(std::cout);
00154     }
00155 }

TestSuite * TestBase::releaseTestSuite (  )  [inherited]

Definition at line 157 of file TestBase.cpp.

References TestBase::TestCaseGroup::addAllToTestSuite(), TestBase::defaultTests, TestBase::extraTests, TestBase::TestCaseGroup::findTest(), TestBase::pTestObj, TestBase::pTestSuite, TestBase::runAll, TestBase::runSingle, and TestBase::testName.

00158 {
00159     assert(pTestObj);
00160     assert(pTestObj.use_count() > 1);
00161 
00162     // release self-reference now that all test cases have been registered
00163     pTestObj.reset();
00164 
00165     TestSuite* pTestSuite = BOOST_TEST_SUITE(testName.c_str());
00166 
00167     if (runSingle.size()) {
00168         test_unit *p =  defaultTests.findTest(runSingle);
00169         if (!p) {
00170             p = extraTests.findTest(runSingle);
00171         }
00172         if (!p) {
00173             std::cerr << "test " << runSingle << " not found\n";
00174             exit(2);
00175         }
00176         pTestSuite->add(p);
00177     } else {
00178         defaultTests.addAllToTestSuite(pTestSuite);
00179         if (runAll) {
00180             extraTests.addAllToTestSuite(pTestSuite);
00181         }
00182     }
00183     return pTestSuite;
00184 }

void TestBase::beforeTestCase ( std::string  testCaseName  )  [inherited]

Definition at line 214 of file TestBase.cpp.

References TestBase::configMap, TraceSource::initTraceSource(), AutoBacktrace::install(), TestBase::notifyTrace(), AutoBacktrace::setOutputStream(), AutoBacktrace::setTraceTarget(), TestBase::testName, and TRACE_INFO.

00215 {
00216     notifyTrace(testName,TRACE_INFO,"ENTER:  " + testCaseName);
00217 
00218     // Install the AutoBacktrace signal handler now, after
00219     // boost::execution_monitor::catch_signals() has installed its own, so that
00220     // on SIGABRT AutoBacktrace goes first, prints the backtrace, then chains
00221     // to boost, which handles the error.
00222     AutoBacktrace::setOutputStream();
00223     AutoBacktrace::setTraceTarget(shared_from_this());
00224     AutoBacktrace::install();
00225     configMap.initTraceSource(shared_from_this(), "testConfig");
00226 }

void TestBase::afterTestCase ( std::string  testCaseName  )  [inherited]

Definition at line 228 of file TestBase.cpp.

References TestBase::configMap, TraceSource::disableTracing(), TestBase::notifyTrace(), AutoBacktrace::setTraceTarget(), TestBase::testName, and TRACE_INFO.

00229 {
00230     AutoBacktrace::setTraceTarget();
00231     configMap.disableTracing();
00232     notifyTrace(testName,TRACE_INFO,"LEAVE:  " + testCaseName);
00233 }

void TestBase::testCaseSetUp (  )  [virtual, inherited]

Equivalent to JUnit TestCase.setUp; this is called before each test case method is invoked.

Default is no-op.

Reimplemented in LbmEntryTest, LbmExecStreamTestBase, LbmLoadBitmapTest, LbmSearchTest, LbmSplicerExecStreamTest, LcsClusterAppendExecStreamTest, LcsClusterReplaceExecStreamTest, LcsMultiClusterAppendTest, LcsRowScanExecStreamTest, BTreeReadersTest, BTreeTest, BTreeTxnTest, ExecStreamGovernorTest, ExecStreamTestBase, ExecStreamUnitTestBase, ExternalSortExecStreamTest, LhxHashTableTest, LogicalTxnTest, and SnapshotSegmentTestBase.

Definition at line 235 of file TestBase.cpp.

Referenced by ExecStreamTestBase::testCaseSetUp().

00236 {
00237 }

void TestBase::notifyTrace ( std::string  source,
TraceLevel  level,
std::string  message 
) [virtual, inherited]

Receives notification when a trace event occurs.

Parameters:
source the facility from which the message originated
level the trace event severity level
message the text of the message

Implements TraceTarget.

Definition at line 243 of file TestBase.cpp.

References TestBase::traceFile, TestBase::traceMutex, TestBase::traceStdout, and TestBase::traceStream.

Referenced by TestBase::afterTestCase(), and TestBase::beforeTestCase().

00244 {
00245     if (traceFile || traceStdout) {
00246         StrictMutexGuard traceMutexGuard(traceMutex);
00247         if (traceFile) {
00248             traceStream << "[" << source << "] " << message << std::endl;
00249             traceStream.flush();
00250         }
00251         if (traceStdout) {
00252             std::cout << "[" << source << "] " << message << std::endl;
00253             std::cout.flush();
00254         }
00255     }
00256 }

TraceLevel TestBase::getSourceTraceLevel ( std::string  source  )  [virtual, inherited]

Gets the level at which a particular source should be traced.

Parameters:
source name of source to be traced
Returns:
minimum severity level which should be traced

Implements TraceTarget.

Definition at line 258 of file TestBase.cpp.

References TestBase::traceLevel.

Referenced by LbmExecStreamTestBase::generateBitmaps().

00259 {
00260     return traceLevel;
00261 }


Member Data Documentation

const uint RandomAccessFileDeviceTest::ZERO_SIZE [static, private]

Definition at line 42 of file RandomAccessFileDeviceTest.cpp.

Referenced by testGrow(), and testShrink().

const uint RandomAccessFileDeviceTest::HALF_SIZE [static, private]

Definition at line 43 of file RandomAccessFileDeviceTest.cpp.

Referenced by testAsyncIO(), and testShrink().

const uint RandomAccessFileDeviceTest::FULL_SIZE [static, private]

Definition at line 44 of file RandomAccessFileDeviceTest.cpp.

Referenced by testGrow(), and testShrink().

DeviceAccessSchedulerParams RandomAccessFileDeviceTest::schedParams [private]

Definition at line 46 of file RandomAccessFileDeviceTest.cpp.

Referenced by RandomAccessFileDeviceTest(), and testAsyncIOImpl().

SharedRandomAccessDevice RandomAccessFileDeviceTest::pRandomAccessDevice [private]

Definition at line 47 of file RandomAccessFileDeviceTest.cpp.

Referenced by closeDevice(), openDevice(), testAsyncIOImpl(), testGrow(), and testShrink().

DeviceMode RandomAccessFileDeviceTest::baseMode [private]

Definition at line 48 of file RandomAccessFileDeviceTest.cpp.

Referenced by testAsyncIOImpl(), testDeviceCreation(), testGrow(), testPermanentDirect(), testPermanentNoDirect(), testShrink(), and testTemporary().

TestSuite* TestBase::pTestSuite [protected, inherited]

Boost test suite.

Definition at line 59 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

boost::shared_ptr<TestBase> TestBase::pTestObj [protected, inherited]

Definition at line 61 of file TestBase.h.

Referenced by TestBase::releaseTestSuite(), and TestBase::TestBase().

std::ofstream TestBase::traceStream [protected, inherited]

Output file stream for tracing.

Definition at line 66 of file TestBase.h.

Referenced by TestBase::notifyTrace(), TestBase::TestBase(), and TestBase::~TestBase().

StrictMutex TestBase::traceMutex [protected, inherited]

Protects traceStream.

Definition at line 71 of file TestBase.h.

Referenced by TestBase::notifyTrace().

std::string TestBase::testName [protected, inherited]

Name of test.

Definition at line 76 of file TestBase.h.

Referenced by TestBase::afterTestCase(), TestBase::beforeTestCase(), TestBase::releaseTestSuite(), TestBase::TestBase(), LhxHashTableTest::testInsert1Ka(), and LhxHashTableTest::testInsert1Kb().

TraceLevel TestBase::traceLevel [protected, inherited]

Level at which to trace test execution.

Definition at line 81 of file TestBase.h.

Referenced by TestBase::getSourceTraceLevel(), and TestBase::TestBase().

FileStatsTarget TestBase::statsTarget [protected, inherited]

Output for stats.

Definition at line 86 of file TestBase.h.

StatsTimer TestBase::statsTimer [protected, inherited]

Timer for stats collection.

Definition at line 91 of file TestBase.h.

Referenced by CacheTestBase::closeStorage(), CacheTestBase::openStorage(), BTreeTxnTest::testCaseSetUp(), BTreeTxnTest::testCaseTearDown(), and BTreeTxnTest::testTxns().

bool TestBase::traceStdout [protected, inherited]

Copy trace output to stdout.

Definition at line 99 of file TestBase.h.

Referenced by TestBase::notifyTrace(), and TestBase::TestBase().

bool TestBase::traceFile [protected, inherited]

Copy trace output to file.

Definition at line 104 of file TestBase.h.

Referenced by TestBase::notifyTrace(), and TestBase::TestBase().

bool TestBase::runAll [static, protected, inherited]

Run all test cases, including the extra tests.

(static, since set by readParams())

Definition at line 110 of file TestBase.h.

Referenced by TestBase::readParams(), and TestBase::releaseTestSuite().

std::string TestBase::runSingle [static, protected, inherited]

Run only the test case of this name.

(static, since set by readParams())

Definition at line 116 of file TestBase.h.

Referenced by TestBase::readParams(), and TestBase::releaseTestSuite().

TestCaseGroup TestBase::defaultTests [protected, inherited]

Definition at line 139 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

TestCaseGroup TestBase::extraTests [protected, inherited]

Definition at line 140 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

ParamName TestBase::paramTestSuiteName [static, inherited]

Definition at line 143 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramTraceFileName [static, inherited]

Definition at line 144 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramDictionaryFileName [static, inherited]

Definition at line 145 of file TestBase.h.

Referenced by TestBase::readParams(), SegStreamTest::testRead(), and SegStreamTest::testWrite().

ParamName TestBase::paramTraceLevel [static, inherited]

Definition at line 146 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramStatsFileName [static, inherited]

Definition at line 147 of file TestBase.h.

ParamName TestBase::paramTraceStdout [static, inherited]

Definition at line 148 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramDegreeOfParallelism [static, inherited]

Definition at line 149 of file TestBase.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

ConfigMap TestBase::configMap [static, inherited]

Configuration parameters.

The reason this is static is so that no constructor parameters (which burden virtual bases) are needed.

Definition at line 155 of file TestBase.h.

Referenced by TestBase::afterTestCase(), TestBase::beforeTestCase(), BTreeTxnTest::BTreeTxnTest(), CacheTestBase::CacheTestBase(), BackupRestoreTest::createSnapshotData(), DatabaseTest::DatabaseTest(), TestOptionsTest::extra(), DatabaseTest::loadDatabase(), SparseBitmapTest::openStorage(), PagingTestBase::PagingTestBase(), ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest(), RandomAccessFileDeviceTest(), TestBase::readParams(), SegStorageTestBase::SegStorageTestBase(), TestOptionsTest::test1(), TestOptionsTest::test2(), BackupRestoreTest::testBackupCleanup(), TestBase::TestBase(), BTreeTxnTest::testCaseSetUp(), BTreeTxnTest::testCheckpoint(), DatabaseTest::testCreateEmpty(), DatabaseTest::testForceTxns(), BackupRestoreTest::testHeaderBackupRestore(), SegPageEntryIterTest::testIter(), SegStreamTest::testRead(), BTreeTxnTest::testTxns(), SegStreamTest::testWrite(), ThreadedTestBase::ThreadedTestBase(), and TestBase::~TestBase().


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:44 2009 for Fennel by  doxygen 1.5.1