From 157b2399054d8893ad758ad04c8f7a576a358478 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Wed, 17 Mar 2004 11:30:47 -0500 Subject: [PATCH] BUG: change directory before running test and remember test number --- Source/cmCTest.cxx | 22 +++++++++++++--------- Source/cmCTest.h | 8 +++++--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index fc111d4c8..d56144dd4 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -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("()"); 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() diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 7b641a0d1..d242d6942 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -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 tm_ListOfTests; // Some structures needed for cvs update