BUG: change directory before running test and remember test number

This commit is contained in:
Andy Cedilnik 2004-03-17 11:30:47 -05:00
parent ec3a119480
commit 157b239905
2 changed files with 18 additions and 12 deletions

View File

@ -1948,9 +1948,9 @@ void cmCTest::GetListOfTests(tm_ListOfTests* testlist, bool memcheck)
}
cmCTestTestProperties test;
test.Name = testname;
test.Args = args;
test.Directory = cmSystemTools::GetCurrentWorkingDirectory();
test.m_Name = testname;
test.m_Args = args;
test.m_Directory = cmSystemTools::GetCurrentWorkingDirectory();
testlist->push_back(test);
}
}
@ -1960,6 +1960,7 @@ void cmCTest::ProcessDirectory(cmCTest::tm_VectorOfStrings &passed,
cmCTest::tm_VectorOfStrings &failed,
bool memcheck)
{
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmsys::RegularExpression dartStuff("(<DartMeasurement.*/DartMeasurement[a-zA-Z]*>)");
tm_ListOfTests testlist;
this->GetListOfTests(&testlist, memcheck);
@ -1989,19 +1990,21 @@ void cmCTest::ProcessDirectory(cmCTest::tm_VectorOfStrings &passed,
for ( it = testlist.begin(); it != testlist.end(); it ++ )
{
cnt ++;
const std::string& testname = it->Name;
tm_VectorOfListFileArgs& args = it->Args;
const std::string& testname = it->m_Name;
tm_VectorOfListFileArgs& args = it->m_Args;
cmCTestTestResult cres;
cres.m_Status = cmCTest::NOT_RUN;
cres.m_TestCount = cnt;
if (last_directory != it->Directory)
if (last_directory != it->m_Directory)
{
if ( m_Verbose )
{
std::cerr << "Changing directory into "
<< it->Directory.c_str() << "\n";
<< it->m_Directory.c_str() << "\n";
}
last_directory = it->Directory;
last_directory = it->m_Directory;
cmSystemTools::ChangeDirectory(last_directory.c_str());
}
cres.m_Name = testname;
if ( m_ShowOnly )
@ -2085,7 +2088,7 @@ void cmCTest::ProcessDirectory(cmCTest::tm_VectorOfStrings &passed,
}
*olog
<< std::endl
<< "Directory: " << it->Directory << std::endl
<< "Directory: " << it->m_Directory << std::endl
<< "\"" << testname.c_str() << "\" start time: "
<< ::CurrentTime() << std::endl
<< "Output:" << std::endl
@ -2207,6 +2210,7 @@ void cmCTest::ProcessDirectory(cmCTest::tm_VectorOfStrings &passed,
{
*olog << "End testing: " << m_EndTest << std::endl;
}
cmSystemTools::ChangeDirectory(current_dir.c_str());
}
bool cmCTest::InitializeMemoryChecking()

View File

@ -230,6 +230,7 @@ private:
std::string m_CompletionStatus;
std::string m_Output;
std::string m_RegressionImages;
int m_TestCount;
};
struct cmCTestBuildErrorWarning
@ -246,10 +247,11 @@ private:
struct cmCTestTestProperties
{
cmStdString Name;
cmStdString Directory;
tm_VectorOfListFileArgs Args;
cmStdString m_Name;
cmStdString m_Directory;
tm_VectorOfListFileArgs m_Args;
};
typedef std::vector<cmCTestTestProperties> tm_ListOfTests;
// Some structures needed for cvs update