|
|
@ -559,60 +559,11 @@ int cmCTestTestHandler::ProcessHandler() |
|
|
|
} |
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, |
|
|
|
std::vector<cmStdString> &failed) |
|
|
|
void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it, |
|
|
|
std::vector<cmStdString> &passed, |
|
|
|
std::vector<cmStdString> &failed, |
|
|
|
int cnt, int tmsize) |
|
|
|
{ |
|
|
|
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); |
|
|
|
this->TestList.clear(); |
|
|
|
|
|
|
|
this->GetListOfTests(); |
|
|
|
cmCTestTestHandler::ListOfTests::size_type tmsize = this->TestList.size(); |
|
|
|
|
|
|
|
this->StartTest = this->CTest->CurrentTime(); |
|
|
|
double elapsed_time_start = cmSystemTools::GetTime(); |
|
|
|
|
|
|
|
*this->LogFile << "Start testing: " << this->StartTest << std::endl |
|
|
|
<< "----------------------------------------------------------" |
|
|
|
<< std::endl; |
|
|
|
|
|
|
|
// how many tests are in based on RegExp?
|
|
|
|
int inREcnt = 0; |
|
|
|
cmCTestTestHandler::ListOfTests::iterator it; |
|
|
|
for ( it = this->TestList.begin(); it != this->TestList.end(); it ++ ) |
|
|
|
{ |
|
|
|
if (it->IsInBasedOnREOptions) |
|
|
|
{ |
|
|
|
inREcnt ++; |
|
|
|
} |
|
|
|
} |
|
|
|
// expand the test list based on the union flag
|
|
|
|
if (this->UseUnion) |
|
|
|
{ |
|
|
|
this->ExpandTestsToRunInformation((int)tmsize); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
this->ExpandTestsToRunInformation(inREcnt); |
|
|
|
} |
|
|
|
|
|
|
|
int cnt = 0; |
|
|
|
inREcnt = 0; |
|
|
|
std::string last_directory = ""; |
|
|
|
for ( it = this->TestList.begin(); it != this->TestList.end(); it ++ ) |
|
|
|
{ |
|
|
|
cnt ++; |
|
|
|
if (it->IsInBasedOnREOptions) |
|
|
|
{ |
|
|
|
inREcnt++; |
|
|
|
} |
|
|
|
|
|
|
|
// if we are out of time then skip this test, we leave two minutes
|
|
|
|
// to submit results
|
|
|
|
if (this->CTest->GetRemainingTimeAllowed() - 120 <= 0) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
const std::string& testname = it->Name; |
|
|
|
std::vector<std::string>& args = it->Args; |
|
|
|
cmCTestTestResult cres; |
|
|
@ -621,41 +572,9 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, |
|
|
|
cres.ReturnValue = -1; |
|
|
|
cres.Status = cmCTestTestHandler::NOT_RUN; |
|
|
|
cres.TestCount = cnt; |
|
|
|
|
|
|
|
if (!(last_directory == it->Directory)) |
|
|
|
{ |
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, |
|
|
|
"Changing directory into " << it->Directory.c_str() << "\n"); |
|
|
|
*this->LogFile << "Changing directory into: " << it->Directory.c_str() |
|
|
|
<< std::endl; |
|
|
|
last_directory = it->Directory; |
|
|
|
cmSystemTools::ChangeDirectory(it->Directory.c_str()); |
|
|
|
} |
|
|
|
cres.Name = testname; |
|
|
|
cres.Path = it->Directory.c_str(); |
|
|
|
|
|
|
|
if (this->UseUnion) |
|
|
|
{ |
|
|
|
// if it is not in the list and not in the regexp then skip
|
|
|
|
if ((this->TestsToRun.size() && |
|
|
|
std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt) |
|
|
|
== this->TestsToRun.end()) && !it->IsInBasedOnREOptions) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
// is this test in the list of tests to run? If not then skip it
|
|
|
|
if ((this->TestsToRun.size() && |
|
|
|
std::find(this->TestsToRun.begin(), |
|
|
|
this->TestsToRun.end(), inREcnt) |
|
|
|
== this->TestsToRun.end()) || !it->IsInBasedOnREOptions) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3) << cnt << "/"); |
|
|
|
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3) << tmsize << " "); |
|
|
|
if ( this->MemCheck ) |
|
|
@ -700,7 +619,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, |
|
|
|
cres.FullCommandLine = actualCommand; |
|
|
|
this->TestResults.push_back( cres ); |
|
|
|
failed.push_back(testname); |
|
|
|
continue; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -727,7 +646,8 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, |
|
|
|
|
|
|
|
|
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl |
|
|
|
<< (this->MemCheck?"MemCheck":"Test") << " command: " << testCommand |
|
|
|
<< (this->MemCheck?"MemCheck":"Test") |
|
|
|
<< " command: " << testCommand |
|
|
|
<< std::endl); |
|
|
|
*this->LogFile << cnt << "/" << tmsize |
|
|
|
<< " Test: " << testname.c_str() << std::endl; |
|
|
@ -751,7 +671,8 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, |
|
|
|
|
|
|
|
if ( !this->CTest->GetShowOnly() ) |
|
|
|
{ |
|
|
|
res = this->CTest->RunTest(arguments, &output, &retVal, this->LogFile); |
|
|
|
res = this->CTest->RunTest(arguments, &output, &retVal, this->LogFile, |
|
|
|
it->Timeout); |
|
|
|
} |
|
|
|
|
|
|
|
clock_finish = cmSystemTools::GetTime(); |
|
|
@ -908,19 +829,110 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, |
|
|
|
|
|
|
|
if ( cres.Status == cmCTestTestHandler::COMPLETED ) |
|
|
|
{ |
|
|
|
this->CleanTestOutput(output, static_cast<size_t>( |
|
|
|
this->CustomMaximumPassedTestOutputSize)); |
|
|
|
this->CleanTestOutput(output, static_cast<size_t> |
|
|
|
(this->CustomMaximumPassedTestOutputSize)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
this->CleanTestOutput(output, static_cast<size_t>( |
|
|
|
this->CustomMaximumFailedTestOutputSize)); |
|
|
|
this->CleanTestOutput(output, static_cast<size_t> |
|
|
|
(this->CustomMaximumFailedTestOutputSize)); |
|
|
|
} |
|
|
|
|
|
|
|
cres.Output = output; |
|
|
|
cres.ReturnValue = retVal; |
|
|
|
cres.CompletionStatus = "Completed"; |
|
|
|
this->TestResults.push_back( cres ); |
|
|
|
} |
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, |
|
|
|
std::vector<cmStdString> &failed) |
|
|
|
{ |
|
|
|
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); |
|
|
|
this->TestList.clear(); |
|
|
|
|
|
|
|
this->GetListOfTests(); |
|
|
|
cmCTestTestHandler::ListOfTests::size_type tmsize = this->TestList.size(); |
|
|
|
|
|
|
|
this->StartTest = this->CTest->CurrentTime(); |
|
|
|
double elapsed_time_start = cmSystemTools::GetTime(); |
|
|
|
|
|
|
|
*this->LogFile << "Start testing: " << this->StartTest << std::endl |
|
|
|
<< "----------------------------------------------------------" |
|
|
|
<< std::endl; |
|
|
|
|
|
|
|
// how many tests are in based on RegExp?
|
|
|
|
int inREcnt = 0; |
|
|
|
cmCTestTestHandler::ListOfTests::iterator it; |
|
|
|
for ( it = this->TestList.begin(); it != this->TestList.end(); it ++ ) |
|
|
|
{ |
|
|
|
if (it->IsInBasedOnREOptions) |
|
|
|
{ |
|
|
|
inREcnt ++; |
|
|
|
} |
|
|
|
} |
|
|
|
// expand the test list based on the union flag
|
|
|
|
if (this->UseUnion) |
|
|
|
{ |
|
|
|
this->ExpandTestsToRunInformation((int)tmsize); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
this->ExpandTestsToRunInformation(inREcnt); |
|
|
|
} |
|
|
|
|
|
|
|
int cnt = 0; |
|
|
|
inREcnt = 0; |
|
|
|
std::string last_directory = ""; |
|
|
|
for ( it = this->TestList.begin(); it != this->TestList.end(); it ++ ) |
|
|
|
{ |
|
|
|
cnt ++; |
|
|
|
if (it->IsInBasedOnREOptions) |
|
|
|
{ |
|
|
|
inREcnt++; |
|
|
|
} |
|
|
|
|
|
|
|
// if we are out of time then skip this test, we leave two minutes
|
|
|
|
// to submit results
|
|
|
|
if (this->CTest->GetRemainingTimeAllowed() - 120 <= 0) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
if (!(last_directory == it->Directory)) |
|
|
|
{ |
|
|
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, |
|
|
|
"Changing directory into " << it->Directory.c_str() << "\n"); |
|
|
|
*this->LogFile << "Changing directory into: " << it->Directory.c_str() |
|
|
|
<< std::endl; |
|
|
|
last_directory = it->Directory; |
|
|
|
cmSystemTools::ChangeDirectory(it->Directory.c_str()); |
|
|
|
} |
|
|
|
|
|
|
|
if (this->UseUnion) |
|
|
|
{ |
|
|
|
// if it is not in the list and not in the regexp then skip
|
|
|
|
if ((this->TestsToRun.size() && |
|
|
|
std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt) |
|
|
|
== this->TestsToRun.end()) && !it->IsInBasedOnREOptions) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
// is this test in the list of tests to run? If not then skip it
|
|
|
|
if ((this->TestsToRun.size() && |
|
|
|
std::find(this->TestsToRun.begin(), |
|
|
|
this->TestsToRun.end(), inREcnt) |
|
|
|
== this->TestsToRun.end()) || !it->IsInBasedOnREOptions) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// process this one test
|
|
|
|
this->ProcessOneTest(&(*it), passed, failed, cnt, tmsize); |
|
|
|
} |
|
|
|
|
|
|
|
this->EndTest = this->CTest->CurrentTime(); |
|
|
@ -1647,6 +1659,10 @@ bool cmCTestTestHandler::SetTestsProperties( |
|
|
|
{ |
|
|
|
rtit->WillFail = cmSystemTools::IsOn(val.c_str()); |
|
|
|
} |
|
|
|
if ( key == "TIMEOUT" ) |
|
|
|
{ |
|
|
|
rtit->Timeout = atof(val.c_str()); |
|
|
|
} |
|
|
|
if ( key == "FAIL_REGULAR_EXPRESSION" ) |
|
|
|
{ |
|
|
|
std::vector<std::string> lval; |
|
|
@ -1751,6 +1767,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args) |
|
|
|
|
|
|
|
test.IsInBasedOnREOptions = true; |
|
|
|
test.WillFail = false; |
|
|
|
test.Timeout = 0; |
|
|
|
if (this->UseIncludeRegExpFlag && |
|
|
|
!this->IncludeTestsRegularExpression.find(testname.c_str())) |
|
|
|
{ |
|
|
|