CTest: Read CTEST_PARALLEL_LEVEL from environment
If no explicit "-j <n>" option is given on the command line then read the parallel level from an environment variable.
This commit is contained in:
parent
edeabd18e6
commit
db43502326
|
@ -294,6 +294,7 @@ cmCTest::cmCTest()
|
||||||
{
|
{
|
||||||
this->LabelSummary = true;
|
this->LabelSummary = true;
|
||||||
this->ParallelLevel = 1;
|
this->ParallelLevel = 1;
|
||||||
|
this->ParallelLevelSetInCli = false;
|
||||||
this->SubmitIndex = 0;
|
this->SubmitIndex = 0;
|
||||||
this->Failover = false;
|
this->Failover = false;
|
||||||
this->BatchJobs = false;
|
this->BatchJobs = false;
|
||||||
|
@ -1999,11 +2000,13 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
|
||||||
i++;
|
i++;
|
||||||
int plevel = atoi(args[i].c_str());
|
int plevel = atoi(args[i].c_str());
|
||||||
this->SetParallelLevel(plevel);
|
this->SetParallelLevel(plevel);
|
||||||
|
this->ParallelLevelSetInCli = true;
|
||||||
}
|
}
|
||||||
else if(arg.find("-j") == 0)
|
else if(arg.find("-j") == 0)
|
||||||
{
|
{
|
||||||
int plevel = atoi(arg.substr(2).c_str());
|
int plevel = atoi(arg.substr(2).c_str());
|
||||||
this->SetParallelLevel(plevel);
|
this->SetParallelLevel(plevel);
|
||||||
|
this->ParallelLevelSetInCli = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this->CheckArgument(arg, "--no-compress-output"))
|
if(this->CheckArgument(arg, "--no-compress-output"))
|
||||||
|
@ -2398,6 +2401,14 @@ int cmCTest::Run(std::vector<std::string> &args, std::string* output)
|
||||||
}
|
}
|
||||||
} // the close of the for argument loop
|
} // the close of the for argument loop
|
||||||
|
|
||||||
|
if (!this->ParallelLevelSetInCli)
|
||||||
|
{
|
||||||
|
if (const char *parallel = cmSystemTools::GetEnv("CTEST_PARALLEL_LEVEL"))
|
||||||
|
{
|
||||||
|
int plevel = atoi(parallel);
|
||||||
|
this->SetParallelLevel(plevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// now what sould cmake do? if --build-and-test was specified then
|
// now what sould cmake do? if --build-and-test was specified then
|
||||||
// we run the build and test handler and return
|
// we run the build and test handler and return
|
||||||
|
|
|
@ -485,6 +485,7 @@ private:
|
||||||
int MaxTestNameWidth;
|
int MaxTestNameWidth;
|
||||||
|
|
||||||
int ParallelLevel;
|
int ParallelLevel;
|
||||||
|
bool ParallelLevelSetInCli;
|
||||||
|
|
||||||
int CompatibilityMode;
|
int CompatibilityMode;
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,8 @@ static const char * cmDocumentationOptions[][3] =
|
||||||
{"-j <jobs>, --parallel <jobs>", "Run the tests in parallel using the"
|
{"-j <jobs>, --parallel <jobs>", "Run the tests in parallel using the"
|
||||||
"given number of jobs.",
|
"given number of jobs.",
|
||||||
"This option tells ctest to run the tests in parallel using given "
|
"This option tells ctest to run the tests in parallel using given "
|
||||||
"number of jobs."},
|
"number of jobs. This option can also be set by setting "
|
||||||
|
"the environment variable CTEST_PARALLEL_LEVEL."},
|
||||||
{"-Q,--quiet", "Make ctest quiet.",
|
{"-Q,--quiet", "Make ctest quiet.",
|
||||||
"This option will suppress all the output. The output log file will "
|
"This option will suppress all the output. The output log file will "
|
||||||
"still be generated if the --output-log is specified. Options such "
|
"still be generated if the --output-log is specified. Options such "
|
||||||
|
|
Loading…
Reference in New Issue