mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 14:19:59 -05:00
CTest: Remove unfinished batch test mode
This was partially implemented by commit v2.8.0~154 (Added some ctest batch capabilities, 2009-09-10) but never finished.
This commit is contained in:
@@ -802,7 +802,6 @@ include_directories(
|
|||||||
#
|
#
|
||||||
set(CTEST_SRCS cmCTest.cxx
|
set(CTEST_SRCS cmCTest.cxx
|
||||||
CTest/cmProcess.cxx
|
CTest/cmProcess.cxx
|
||||||
CTest/cmCTestBatchTestHandler.cxx
|
|
||||||
CTest/cmCTestBuildAndTestHandler.cxx
|
CTest/cmCTestBuildAndTestHandler.cxx
|
||||||
CTest/cmCTestBuildCommand.cxx
|
CTest/cmCTestBuildCommand.cxx
|
||||||
CTest/cmCTestBuildHandler.cxx
|
CTest/cmCTestBuildHandler.cxx
|
||||||
|
|||||||
@@ -1,123 +0,0 @@
|
|||||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
||||||
#include "cmCTestBatchTestHandler.h"
|
|
||||||
|
|
||||||
#include "cmCTest.h"
|
|
||||||
#include "cmCTestMultiProcessHandler.h"
|
|
||||||
#include "cmCTestTestHandler.h"
|
|
||||||
#include "cmProcess.h"
|
|
||||||
#include "cmSystemTools.h"
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
cmCTestBatchTestHandler::~cmCTestBatchTestHandler()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCTestBatchTestHandler::RunTests()
|
|
||||||
{
|
|
||||||
this->WriteBatchScript();
|
|
||||||
this->SubmitBatchScript();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCTestBatchTestHandler::WriteBatchScript()
|
|
||||||
{
|
|
||||||
this->Script = this->CTest->GetBinaryDir() + "/Testing/CTestBatch.txt";
|
|
||||||
cmsys::ofstream fout;
|
|
||||||
fout.open(this->Script.c_str());
|
|
||||||
fout << "#!/bin/sh\n";
|
|
||||||
|
|
||||||
for (auto const& t : this->Tests) {
|
|
||||||
this->WriteSrunArgs(t.first, fout);
|
|
||||||
this->WriteTestCommand(t.first, fout);
|
|
||||||
fout << "\n";
|
|
||||||
}
|
|
||||||
fout.flush();
|
|
||||||
fout.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCTestBatchTestHandler::WriteSrunArgs(int test, std::ostream& fout)
|
|
||||||
{
|
|
||||||
cmCTestTestHandler::cmCTestTestProperties* properties =
|
|
||||||
this->Properties[test];
|
|
||||||
|
|
||||||
fout << "srun ";
|
|
||||||
// fout << "--jobid=" << test << " ";
|
|
||||||
fout << "-J=" << properties->Name << " ";
|
|
||||||
|
|
||||||
// Write dependency information
|
|
||||||
/*if(!this->Tests[test].empty())
|
|
||||||
{
|
|
||||||
fout << "-P=afterany";
|
|
||||||
for(TestSet::iterator i = this->Tests[test].begin();
|
|
||||||
i != this->Tests[test].end(); ++i)
|
|
||||||
{
|
|
||||||
fout << ":" << *i;
|
|
||||||
}
|
|
||||||
fout << " ";
|
|
||||||
}*/
|
|
||||||
if (properties->RunSerial) {
|
|
||||||
fout << "--exclusive ";
|
|
||||||
}
|
|
||||||
if (properties->Processors > 1) {
|
|
||||||
fout << "-n" << properties->Processors << " ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCTestBatchTestHandler::WriteTestCommand(int test, std::ostream& fout)
|
|
||||||
{
|
|
||||||
std::vector<std::string> args = this->Properties[test]->Args;
|
|
||||||
std::vector<std::string> processArgs;
|
|
||||||
std::string command;
|
|
||||||
|
|
||||||
command = this->TestHandler->FindTheExecutable(args[1].c_str());
|
|
||||||
command = cmSystemTools::ConvertToOutputPath(command.c_str());
|
|
||||||
|
|
||||||
// Prepends memcheck args to our command string if this is a memcheck
|
|
||||||
this->TestHandler->GenerateTestCommand(processArgs, test);
|
|
||||||
processArgs.push_back(command);
|
|
||||||
|
|
||||||
for (std::string const& arg : processArgs) {
|
|
||||||
fout << arg << " ";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string>::iterator i = args.begin();
|
|
||||||
++i; // the test name
|
|
||||||
++i; // the executable (command)
|
|
||||||
if (args.size() > 2) {
|
|
||||||
fout << "'";
|
|
||||||
}
|
|
||||||
while (i != args.end()) {
|
|
||||||
fout << "\"" << *i << "\""; // args to the test executable
|
|
||||||
++i;
|
|
||||||
|
|
||||||
if (i == args.end() && args.size() > 2) {
|
|
||||||
fout << "'";
|
|
||||||
}
|
|
||||||
fout << " ";
|
|
||||||
}
|
|
||||||
// TODO ZACH build TestResult.FullCommandLine
|
|
||||||
// this->TestResult.FullCommandLine = this->TestCommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCTestBatchTestHandler::SubmitBatchScript()
|
|
||||||
{
|
|
||||||
cmProcess sbatch;
|
|
||||||
std::vector<std::string> args;
|
|
||||||
args.push_back(this->Script);
|
|
||||||
args.push_back("-o");
|
|
||||||
args.push_back(this->CTest->GetBinaryDir() + "/Testing/CTestBatch.txt");
|
|
||||||
|
|
||||||
sbatch.SetCommand("sbatch");
|
|
||||||
sbatch.SetCommandArguments(args);
|
|
||||||
/*if(sbatch.StartProcess())
|
|
||||||
{
|
|
||||||
//success condition
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//fail condition
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
||||||
#ifndef cmCTestBatchTestHandler_h
|
|
||||||
#define cmCTestBatchTestHandler_h
|
|
||||||
|
|
||||||
#include "cmConfigure.h" // IWYU pragma: keep
|
|
||||||
|
|
||||||
#include "cmCTestMultiProcessHandler.h"
|
|
||||||
#include "cmsys/FStream.hxx"
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
/** \class cmCTestBatchTestHandler
|
|
||||||
* \brief run parallel ctest
|
|
||||||
*
|
|
||||||
* cmCTestBatchTestHandler
|
|
||||||
*/
|
|
||||||
class cmCTestBatchTestHandler : public cmCTestMultiProcessHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
~cmCTestBatchTestHandler() override;
|
|
||||||
void RunTests() override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void WriteBatchScript();
|
|
||||||
void WriteSrunArgs(int test, std::ostream& fout);
|
|
||||||
void WriteTestCommand(int test, std::ostream& fout);
|
|
||||||
|
|
||||||
void SubmitBatchScript();
|
|
||||||
|
|
||||||
std::string Script;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "cmAlgorithms.h"
|
#include "cmAlgorithms.h"
|
||||||
#include "cmCTest.h"
|
#include "cmCTest.h"
|
||||||
#include "cmCTestBatchTestHandler.h"
|
|
||||||
#include "cmCTestMultiProcessHandler.h"
|
#include "cmCTestMultiProcessHandler.h"
|
||||||
#include "cmCommand.h"
|
#include "cmCommand.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
@@ -1210,9 +1209,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
|
|||||||
this->StartTestTime = std::chrono::system_clock::now();
|
this->StartTestTime = std::chrono::system_clock::now();
|
||||||
auto elapsed_time_start = std::chrono::steady_clock::now();
|
auto elapsed_time_start = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
cmCTestMultiProcessHandler* parallel = this->CTest->GetBatchJobs()
|
cmCTestMultiProcessHandler* parallel = new cmCTestMultiProcessHandler;
|
||||||
? new cmCTestBatchTestHandler
|
|
||||||
: new cmCTestMultiProcessHandler;
|
|
||||||
parallel->SetCTest(this->CTest);
|
parallel->SetCTest(this->CTest);
|
||||||
parallel->SetParallelLevel(this->CTest->GetParallelLevel());
|
parallel->SetParallelLevel(this->CTest->GetParallelLevel());
|
||||||
parallel->SetTestHandler(this);
|
parallel->SetTestHandler(this);
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ class cmCTestTestHandler : public cmCTestGenericHandler
|
|||||||
{
|
{
|
||||||
friend class cmCTestRunTest;
|
friend class cmCTestRunTest;
|
||||||
friend class cmCTestMultiProcessHandler;
|
friend class cmCTestMultiProcessHandler;
|
||||||
friend class cmCTestBatchTestHandler;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef cmCTestGenericHandler Superclass;
|
typedef cmCTestGenericHandler Superclass;
|
||||||
|
|||||||
@@ -267,7 +267,6 @@ cmCTest::cmCTest()
|
|||||||
this->TestLoad = 0;
|
this->TestLoad = 0;
|
||||||
this->SubmitIndex = 0;
|
this->SubmitIndex = 0;
|
||||||
this->Failover = false;
|
this->Failover = false;
|
||||||
this->BatchJobs = false;
|
|
||||||
this->ForceNewCTestProcess = false;
|
this->ForceNewCTestProcess = false;
|
||||||
this->TomorrowTag = false;
|
this->TomorrowTag = false;
|
||||||
this->Verbose = false;
|
this->Verbose = false;
|
||||||
@@ -1819,9 +1818,6 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
|
|||||||
if (this->CheckArgument(arg, "-V", "--verbose")) {
|
if (this->CheckArgument(arg, "-V", "--verbose")) {
|
||||||
this->Verbose = true;
|
this->Verbose = true;
|
||||||
}
|
}
|
||||||
if (this->CheckArgument(arg, "-B")) {
|
|
||||||
this->BatchJobs = true;
|
|
||||||
}
|
|
||||||
if (this->CheckArgument(arg, "-VV", "--extra-verbose")) {
|
if (this->CheckArgument(arg, "-VV", "--extra-verbose")) {
|
||||||
this->ExtraVerbose = true;
|
this->ExtraVerbose = true;
|
||||||
this->Verbose = true;
|
this->Verbose = true;
|
||||||
|
|||||||
@@ -427,9 +427,6 @@ public:
|
|||||||
void SetFailover(bool failover) { this->Failover = failover; }
|
void SetFailover(bool failover) { this->Failover = failover; }
|
||||||
bool GetFailover() { return this->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 GetVerbose() { return this->Verbose; }
|
||||||
bool GetExtraVerbose() { return this->ExtraVerbose; }
|
bool GetExtraVerbose() { return this->ExtraVerbose; }
|
||||||
|
|
||||||
@@ -475,7 +472,6 @@ private:
|
|||||||
bool UseHTTP10;
|
bool UseHTTP10;
|
||||||
bool PrintLabels;
|
bool PrintLabels;
|
||||||
bool Failover;
|
bool Failover;
|
||||||
bool BatchJobs;
|
|
||||||
|
|
||||||
bool ForceNewCTestProcess;
|
bool ForceNewCTestProcess;
|
||||||
|
|
||||||
|
|||||||
@@ -3069,8 +3069,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
|||||||
|
|
||||||
add_test(CTestTestShowOnly ${CMAKE_CTEST_COMMAND} -N)
|
add_test(CTestTestShowOnly ${CMAKE_CTEST_COMMAND} -N)
|
||||||
|
|
||||||
add_test(CTestBatchTest ${CMAKE_CTEST_COMMAND} -B)
|
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMake_SOURCE_DIR}/Tests/CTestTestFdSetSize/test.cmake.in"
|
"${CMake_SOURCE_DIR}/Tests/CTestTestFdSetSize/test.cmake.in"
|
||||||
"${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake"
|
"${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake"
|
||||||
|
|||||||
Reference in New Issue
Block a user