Also tweak unit tests that dropped files in working directory to use our test data dir instead
This commit is contained in:
parent
f5e76827be
commit
d0b9b03561
|
@ -41,11 +41,11 @@ void TestBlockFile()
|
||||||
{
|
{
|
||||||
cDebug d( "TestBlockFile" );
|
cDebug d( "TestBlockFile" );
|
||||||
|
|
||||||
static const TCHAR fileName[] = _T("test.bf");
|
std::string fileName = TwTestPath("test.bf");
|
||||||
// truncate the file I am going to use...
|
// truncate the file I am going to use...
|
||||||
//
|
//
|
||||||
cFileArchive a;
|
cFileArchive a;
|
||||||
a.OpenReadWrite( fileName );
|
a.OpenReadWrite( fileName.c_str() );
|
||||||
a.Close();
|
a.Close();
|
||||||
//
|
//
|
||||||
// open up the block file...
|
// open up the block file...
|
||||||
|
|
|
@ -41,7 +41,7 @@ void TestBlockRecordArray()
|
||||||
{
|
{
|
||||||
cDebug d( "TestBlockRecordArray" );
|
cDebug d( "TestBlockRecordArray" );
|
||||||
|
|
||||||
static const TCHAR fileName[] = _T("test.bf");
|
std::string fileName = TwTestPath("test2.bf");
|
||||||
|
|
||||||
cBlockFile bf;
|
cBlockFile bf;
|
||||||
bf.Open( fileName, 2, true ); // opened up with two pages
|
bf.Open( fileName, 2, true ); // opened up with two pages
|
||||||
|
|
|
@ -128,9 +128,6 @@ void TestConfigFile2(void)
|
||||||
//Define some test values for <name, value> pairs to be
|
//Define some test values for <name, value> pairs to be
|
||||||
//stored in a test config. module. I'm going to use the
|
//stored in a test config. module. I'm going to use the
|
||||||
//values specified in the install doc. -DA
|
//values specified in the install doc. -DA
|
||||||
TSTRING currpath;
|
|
||||||
pFSServices->GetCurrentDir(currpath);
|
|
||||||
const TSTRING testTWROOT = currpath;
|
|
||||||
|
|
||||||
//TODO maybe also test read failure when mandatory config values aren't set
|
//TODO maybe also test read failure when mandatory config values aren't set
|
||||||
|
|
||||||
|
@ -145,7 +142,7 @@ void TestConfigFile2(void)
|
||||||
write_cfgmod.Insert( _T("LOCALKEYFILE"), "local.key");
|
write_cfgmod.Insert( _T("LOCALKEYFILE"), "local.key");
|
||||||
|
|
||||||
//Filename for writing/reading some value pairs:
|
//Filename for writing/reading some value pairs:
|
||||||
const TSTRING testfile = testTWROOT + _T("/tripwire.cfg");
|
const TSTRING testfile = TwTestPath("tripwire.cfg");
|
||||||
|
|
||||||
//Store these values on disk.
|
//Store these values on disk.
|
||||||
TSTRING configText;
|
TSTRING configText;
|
||||||
|
|
|
@ -173,7 +173,8 @@ static void AssertChildren(cDbDataSourceIter& iter, const TSTRING& filename, boo
|
||||||
void TestDbDataSourceBasic()
|
void TestDbDataSourceBasic()
|
||||||
{
|
{
|
||||||
cHierDatabase db;
|
cHierDatabase db;
|
||||||
db.Open( _T("test.db"), 5, true);
|
std::string dbpath = TwTestPath("test.db");
|
||||||
|
db.Open( dbpath, 5, true);
|
||||||
cDbDataSourceIter iter(&db);
|
cDbDataSourceIter iter(&db);
|
||||||
|
|
||||||
AddFile(iter, "file1", true);
|
AddFile(iter, "file1", true);
|
||||||
|
|
|
@ -130,8 +130,9 @@ void TestFCOReport()
|
||||||
d.TraceDebug("Before serializing report:\n");
|
d.TraceDebug("Before serializing report:\n");
|
||||||
TraceReport(report, d);
|
TraceReport(report, d);
|
||||||
{
|
{
|
||||||
|
std::string filepath = TwTestPath("tmp.twr");
|
||||||
cFileArchive outFile;
|
cFileArchive outFile;
|
||||||
outFile.OpenReadWrite(_T("tmp.twr"));
|
outFile.OpenReadWrite(filepath.c_str());
|
||||||
cSerializerImpl outSer(outFile, cSerializerImpl::S_WRITE);
|
cSerializerImpl outSer(outFile, cSerializerImpl::S_WRITE);
|
||||||
|
|
||||||
outSer.Init();
|
outSer.Init();
|
||||||
|
@ -141,7 +142,7 @@ void TestFCOReport()
|
||||||
outFile.Close();
|
outFile.Close();
|
||||||
|
|
||||||
cFileArchive inFile;
|
cFileArchive inFile;
|
||||||
inFile.OpenRead(_T("tmp.twr"));
|
inFile.OpenRead(filepath.c_str());
|
||||||
cSerializerImpl inSer(inFile, cSerializerImpl::S_READ);
|
cSerializerImpl inSer(inFile, cSerializerImpl::S_READ);
|
||||||
|
|
||||||
cFCOReport inReport;
|
cFCOReport inReport;
|
||||||
|
|
Loading…
Reference in New Issue