summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CTest.cmake8
-rw-r--r--Modules/DartConfiguration.tcl.in6
-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
-rw-r--r--Source/cmCTest.cxx5
-rw-r--r--Source/cmCTest.h5
9 files changed, 78 insertions, 18 deletions
diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake
index b3871db..c13b813 100644
--- a/Modules/CTest.cmake
+++ b/Modules/CTest.cmake
@@ -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
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index 2cd8437..7b79a3d 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -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@
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,
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index f1ad1a7..d06a4a7 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -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;
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 222cbe5..8ee837f 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -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;