Fixed ctest output where max test index is not the same width as the total number of tests. Also some preliminary changes for batching ctest jobs

This commit is contained in:
Zach Mullen 2009-09-02 10:08:40 -04:00
parent 99144383cf
commit 69fd641adb
9 changed files with 78 additions and 18 deletions

View File

@ -137,6 +137,12 @@ IF(BUILD_TESTING)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
DOC "Path to the memory checking command, used for memory error detection."
)
FIND_PROGRAM(SLURM_SBATCH_COMMAND sbatch DOC
"Path to the SLURM sbatch executable"
)
FIND_PROGRAM(SLURM_SRUN_COMMAND srun DOC
"Path to the SLURM srun executable"
)
SET(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH
"File that contains suppressions for the memory checker")
FIND_PROGRAM(SCPCOMMAND scp DOC
@ -212,6 +218,8 @@ IF(BUILD_TESTING)
MEMORYCHECK_SUPPRESSIONS_FILE
PURIFYCOMMAND
SCPCOMMAND
SLURM_SBATCH_COMMAND
SLURM_SRUN_COMMAND
SITE
)
# BUILDNAME

View File

@ -54,10 +54,14 @@ MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@
MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@
CoverageCommand: @COVERAGE_COMMAND@
# Cluster commands
SlurmBatchCommand: @SLURM_SBATCH_COMMAND@
SlurmRunCommand: @SLURM_SRUN_COMMAND@
# Testing options
# TimeOut is the amount of time in seconds to wait for processes
# to complete during testing. After TimeOut seconds, the
# process will be summaily terminated.
# process will be summarily terminated.
# Currently set to 25 minutes
TimeOut: @DART_TESTING_TIMEOUT@

View File

@ -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;
}

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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,

View File

@ -211,6 +211,7 @@ cmCTest::cmCTest()
this->ParallelLevel = 1;
this->SubmitIndex = 0;
this->Failover = false;
this->BatchJobs = false;
this->ForceNewCTestProcess = false;
this->TomorrowTag = false;
this->Verbose = false;
@ -1745,6 +1746,10 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
{
this->Verbose = true;
}
if(this->CheckArgument(arg, "-B"))
{
this->BatchJobs = true;
}
if(this->CheckArgument(arg, "-VV", "--extra-verbose"))
{
this->ExtraVerbose = true;

View File

@ -50,6 +50,7 @@ class cmCTestScriptHandler;
class cmCTest
{
friend class cmCTestRunTest;
friend class cmCTestMultiProcessHandler;
public:
/** Enumerate parts of the testing and submission process. */
enum Part
@ -365,6 +366,9 @@ public:
void SetFailover(bool failover) { this->Failover = failover; }
bool GetFailover() { return this->Failover; }
void SetBatchJobs(bool batch = true) { this->BatchJobs = batch; }
bool GetBatchJobs() { return this->BatchJobs; }
bool GetVerbose() { return this->Verbose;}
bool GetExtraVerbose() { return this->ExtraVerbose;}
@ -379,6 +383,7 @@ private:
bool ProduceXML;
bool Failover;
bool BatchJobs;
bool ForceNewCTestProcess;