diff options
author | Zach Mullen <zach.mullen@kitware.com> | 2009-09-02 14:08:40 (GMT) |
---|---|---|
committer | Zach Mullen <zach.mullen@kitware.com> | 2009-09-02 14:08:40 (GMT) |
commit | 69fd641adb32c878ded4cadee60d90596b358d1b (patch) | |
tree | cd9885d9d8a0825b4a3bc227f78780ebf1a1e95b | |
parent | 99144383cf17e188f67a5d9e3469bcf1b3a836b8 (diff) | |
download | CMake-69fd641adb32c878ded4cadee60d90596b358d1b.zip CMake-69fd641adb32c878ded4cadee60d90596b358d1b.tar.gz CMake-69fd641adb32c878ded4cadee60d90596b358d1b.tar.bz2 |
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
-rw-r--r-- | Modules/CTest.cmake | 8 | ||||
-rw-r--r-- | Modules/DartConfiguration.tcl.in | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 28 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.h | 11 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 17 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.h | 13 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 3 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 5 | ||||
-rw-r--r-- | Source/cmCTest.h | 5 |
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; |