summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx28
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h11
-rw-r--r--Source/CTest/cmCTestRunTest.cxx17
-rw-r--r--Source/CTest/cmCTestRunTest.h13
-rw-r--r--Source/CTest/cmCTestTestHandler.h3
5 files changed, 55 insertions, 17 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 157e187..b086edb 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -51,7 +51,13 @@ void cmCTestMultiProcessHandler::SetParallelLevel(size_t level)
void cmCTestMultiProcessHandler::RunTests()
{
+ if(this->CTest->GetBatchJobs())
+ {
+ this->SubmitBatchTests();
+ return;
+ }
this->CheckResume();
+ this->TestHandler->SetMaxIndex(this->FindMaxIndex());
this->StartNextTests();
while(this->Tests.size() != 0)
{
@@ -65,6 +71,14 @@ void cmCTestMultiProcessHandler::RunTests()
this->MarkFinished();
}
+void cmCTestMultiProcessHandler::SubmitBatchTests()
+{
+ for(cmCTest::CTestConfigurationMap::iterator i = this->CTest->CTestConfiguration.begin(); i != this->CTest->CTestConfiguration.end(); ++i)
+ {
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, i->first << " = " << i->second << std::endl);
+ }
+}
+
void cmCTestMultiProcessHandler::StartTestProcess(int test)
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, test << ": "
@@ -306,3 +320,17 @@ void cmCTestMultiProcessHandler::RemoveTest(int index)
this->TestFinishMap[index] = true;
this->Completed++;
}
+
+int cmCTestMultiProcessHandler::FindMaxIndex()
+{
+ int max = 0;
+ cmCTestMultiProcessHandler::TestMap::iterator i = this->Tests.begin();
+ for(; i != this->Tests.end(); ++i)
+ {
+ if(i->first > max)
+ {
+ max = i->first;
+ }
+ }
+ return max;
+}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 34df780..a7800fc 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -41,17 +41,17 @@ public:
void SetParallelLevel(size_t);
void RunTests();
void PrintTestList();
- //void SetCTestCommand(const char* c) { this->CTestCommand = c;}
- //void SetTestCacheFile(const char* c) { this->CTestCacheFile = c;}
+ void SubmitBatchTests();
+
void SetPassFailVectors(std::vector<cmStdString>* passed,
std::vector<cmStdString>* failed)
{
- this->Passed = passed;
- this->Failed = failed;
+ this->Passed = passed;
+ this->Failed = failed;
}
void SetTestResults(std::vector<cmCTestTestHandler::cmCTestTestResult>* r)
{
- this->TestResults = r;
+ this->TestResults = r;
}
void SetCTest(cmCTest* ctest) { this->CTest = ctest;}
@@ -78,6 +78,7 @@ protected:
void RemoveTest(int index);
//Check if we need to resume an interrupted test set
void CheckResume();
+ int FindMaxIndex();
// map from test number to set of depend tests
TestMap Tests;
//Total number of tests we'll be running
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index f15184d..49bce1e 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -429,18 +429,10 @@ bool cmCTestRunTest::CreateProcess(double testTimeOut,
void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total)
{
- int numWidth = 1;
- if(total >= 10)
- {
- numWidth = 2;
- }
- if(total >= 100)
- {
- numWidth = 3;
- }
- cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(numWidth)
+
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total))
<< completed << "/");
- cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(numWidth)
+ cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(getNumWidth(total))
<< total << " ");
if ( this->TestHandler->MemCheck )
@@ -454,7 +446,8 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total)
cmOStringStream indexStr;
indexStr << " #" << this->Index << ":";
- cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3 + numWidth)
+ cmCTestLog(this->CTest, HANDLER_OUTPUT,
+ std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex()))
<< indexStr.str().c_str());
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth();
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index 88a4d6b..8248b17 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -91,5 +91,18 @@ private:
std::vector<std::string> Arguments;
};
+inline int getNumWidth(int n)
+{
+ int numWidth = 1;
+ if(n >= 10)
+ {
+ numWidth = 2;
+ }
+ if(n >= 100)
+ {
+ numWidth = 3;
+ }
+ return numWidth;
+}
#endif
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 4c7cbc8..12e86a9 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -59,6 +59,8 @@ public:
void SetIncludeRegExp(const char *);
void SetExcludeRegExp(const char *);
+ void SetMaxIndex(int n) {this->MaxIndex = n;}
+ int GetMaxIndex() {return this->MaxIndex;}
///! pass the -I argument down
void SetTestsToRunInformation(const char*);
@@ -157,6 +159,7 @@ protected:
bool MemCheck;
int CustomMaximumPassedTestOutputSize;
int CustomMaximumFailedTestOutputSize;
+ int MaxIndex;
public:
enum { // Program statuses
NOT_RUN = 0,