BUG: fix bugs 5539 (progress going beyond 100% when new files are added) and 5889 (tests are not found in some cases when using add_subdirectory to .. etc)
This commit is contained in:
parent
6ad79d13dd
commit
7c473d4828
|
@ -36,7 +36,7 @@
|
||||||
#include <memory> // auto_ptr
|
#include <memory> // auto_ptr
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
class cmCTestSubdirCommand : public cmCommand
|
class cmCTestAddSubdirectoryCommand : public cmCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual cmCommand* Clone()
|
virtual cmCommand* Clone()
|
||||||
{
|
{
|
||||||
cmCTestSubdirCommand* c = new cmCTestSubdirCommand;
|
cmCTestAddSubdirectoryCommand* c = new cmCTestAddSubdirectoryCommand;
|
||||||
c->TestHandler = this->TestHandler;
|
c->TestHandler = this->TestHandler;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -58,38 +58,37 @@ public:
|
||||||
/**
|
/**
|
||||||
* The name of the command as specified in CMakeList.txt.
|
* The name of the command as specified in CMakeList.txt.
|
||||||
*/
|
*/
|
||||||
virtual const char* GetName() { return "SUBDIRS";}
|
virtual const char* GetName() { return "add_subdirectory";}
|
||||||
|
|
||||||
// Unused methods
|
// Unused methods
|
||||||
virtual const char* GetTerseDocumentation() { return ""; }
|
virtual const char* GetTerseDocumentation() { return ""; }
|
||||||
virtual const char* GetFullDocumentation() { return ""; }
|
virtual const char* GetFullDocumentation() { return ""; }
|
||||||
|
|
||||||
cmTypeMacro(cmCTestSubdirCommand, cmCommand);
|
cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand);
|
||||||
|
|
||||||
cmCTestTestHandler* TestHandler;
|
cmCTestTestHandler* TestHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args)
|
bool cmCTestAddSubdirectoryCommand
|
||||||
|
::InitialPass(std::vector<std::string> const& args)
|
||||||
{
|
{
|
||||||
if(args.size() < 1 )
|
if(args.size() < 1 )
|
||||||
{
|
{
|
||||||
this->SetError("called with incorrect number of arguments");
|
this->SetError("called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::vector<std::string>::const_iterator it;
|
|
||||||
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
|
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
|
||||||
for ( it = args.begin(); it != args.end(); ++ it )
|
|
||||||
{
|
|
||||||
cmSystemTools::ChangeDirectory(cwd.c_str());
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
||||||
std::string fname = cwd;
|
std::string fname = cwd;
|
||||||
fname += "/";
|
fname += "/";
|
||||||
fname += *it;
|
fname += args[1];
|
||||||
|
|
||||||
if ( !cmSystemTools::FileExists(fname.c_str()) )
|
if ( !cmSystemTools::FileExists(fname.c_str()) )
|
||||||
{
|
{
|
||||||
// No subdirectory? So what...
|
// No subdirectory? So what...
|
||||||
continue;
|
return true;
|
||||||
}
|
}
|
||||||
cmSystemTools::ChangeDirectory(fname.c_str());
|
cmSystemTools::ChangeDirectory(fname.c_str());
|
||||||
const char* testFilename;
|
const char* testFilename;
|
||||||
|
@ -102,7 +101,7 @@ bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
{
|
{
|
||||||
// No CTestTestfile? Who cares...
|
// No CTestTestfile? Who cares...
|
||||||
cmSystemTools::ChangeDirectory(cwd.c_str());
|
cmSystemTools::ChangeDirectory(cwd.c_str());
|
||||||
continue;
|
return true;
|
||||||
}
|
}
|
||||||
fname += "/";
|
fname += "/";
|
||||||
fname += testFilename;
|
fname += testFilename;
|
||||||
|
@ -117,7 +116,6 @@ bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args)
|
||||||
this->SetError(m.c_str());
|
this->SetError(m.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1260,8 +1258,9 @@ void cmCTestTestHandler::GetListOfTests()
|
||||||
newCom1->TestHandler = this;
|
newCom1->TestHandler = this;
|
||||||
cm.AddCommand(newCom1);
|
cm.AddCommand(newCom1);
|
||||||
|
|
||||||
// Add handler for SUBDIR
|
// Add handler for ADD_SUBDIRECTORY
|
||||||
cmCTestSubdirCommand* newCom2 = new cmCTestSubdirCommand;
|
cmCTestAddSubdirectoryCommand* newCom2 =
|
||||||
|
new cmCTestAddSubdirectoryCommand;
|
||||||
newCom2->TestHandler = this;
|
newCom2->TestHandler = this;
|
||||||
cm.AddCommand(newCom2);
|
cm.AddCommand(newCom2);
|
||||||
|
|
||||||
|
|
|
@ -272,22 +272,19 @@ void cmLocalGenerator::GenerateTestFiles()
|
||||||
}
|
}
|
||||||
if ( this->Children.size())
|
if ( this->Children.size())
|
||||||
{
|
{
|
||||||
fout << "SUBDIRS(";
|
|
||||||
size_t i;
|
size_t i;
|
||||||
std::string outDir = this->Makefile->GetStartOutputDirectory();
|
|
||||||
outDir += "/";
|
|
||||||
for(i = 0; i < this->Children.size(); ++i)
|
for(i = 0; i < this->Children.size(); ++i)
|
||||||
{
|
{
|
||||||
std::string binP =
|
fout << "ADD_SUBDIRECTORY(";
|
||||||
this->Children[i]->GetMakefile()->GetStartOutputDirectory();
|
std::string srcP =
|
||||||
cmSystemTools::ReplaceString(binP, outDir.c_str(), "");
|
this->Children[i]->GetMakefile()->GetStartDirectory();
|
||||||
if ( i > 0 )
|
fout << this->Convert(srcP.c_str(),START);
|
||||||
{
|
|
||||||
fout << " ";
|
fout << " ";
|
||||||
|
std::string outP =
|
||||||
|
this->Children[i]->GetMakefile()->GetStartOutputDirectory();
|
||||||
|
fout << this->Convert(outP.c_str(),START_OUTPUT);
|
||||||
|
fout << ")" << std::endl;
|
||||||
}
|
}
|
||||||
fout << binP.c_str();
|
|
||||||
}
|
|
||||||
fout << ")" << std::endl << std::endl;;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,8 +210,7 @@ void cmLocalUnixMakefileGenerator3::WriteAllProgressVariable()
|
||||||
cmGlobalUnixMakefileGenerator3 *gg =
|
cmGlobalUnixMakefileGenerator3 *gg =
|
||||||
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
|
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
|
||||||
|
|
||||||
ruleFileStream << "CMAKE_ALL_PROGRESS = "
|
ruleFileStream << gg->GetNumberOfProgressActionsInAll(this) << "\n";
|
||||||
<< gg->GetNumberOfProgressActionsInAll(this) << "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -1577,17 +1576,6 @@ void cmLocalUnixMakefileGenerator3
|
||||||
this->WriteSpecialTargetsTop(ruleFileStream);
|
this->WriteSpecialTargetsTop(ruleFileStream);
|
||||||
|
|
||||||
// Include the progress variables for the target.
|
// Include the progress variables for the target.
|
||||||
std::string progressFile = cmake::GetCMakeFilesDirectory();
|
|
||||||
progressFile += "/progress.make";
|
|
||||||
std::string progressFileNameFull =
|
|
||||||
this->ConvertToFullPath(progressFile.c_str());
|
|
||||||
ruleFileStream
|
|
||||||
<< "# Include the progress variables for this target.\n"
|
|
||||||
<< this->IncludeDirective << " "
|
|
||||||
<< this->Convert(progressFileNameFull.c_str(),
|
|
||||||
cmLocalGenerator::START_OUTPUT,
|
|
||||||
cmLocalGenerator::MAKEFILE) << "\n\n";
|
|
||||||
|
|
||||||
// Write all global targets
|
// Write all global targets
|
||||||
this->WriteDivider(ruleFileStream);
|
this->WriteDivider(ruleFileStream);
|
||||||
ruleFileStream
|
ruleFileStream
|
||||||
|
@ -1672,7 +1660,14 @@ void cmLocalUnixMakefileGenerator3
|
||||||
progCmd << this->Convert(progressDir.c_str(),
|
progCmd << this->Convert(progressDir.c_str(),
|
||||||
cmLocalGenerator::FULL,
|
cmLocalGenerator::FULL,
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
progCmd << " $(CMAKE_ALL_PROGRESS)";
|
|
||||||
|
std::string progressFile = cmake::GetCMakeFilesDirectory();
|
||||||
|
progressFile += "/progress.make";
|
||||||
|
std::string progressFileNameFull =
|
||||||
|
this->ConvertToFullPath(progressFile.c_str());
|
||||||
|
progCmd << " " << this->Convert(progressFileNameFull.c_str(),
|
||||||
|
cmLocalGenerator::FULL,
|
||||||
|
cmLocalGenerator::SHELL);
|
||||||
commands.push_back(progCmd.str());
|
commands.push_back(progCmd.str());
|
||||||
}
|
}
|
||||||
std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash();
|
std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash();
|
||||||
|
|
|
@ -1185,7 +1185,19 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
|
||||||
std::string dirName = args[2];
|
std::string dirName = args[2];
|
||||||
dirName += "/Progress";
|
dirName += "/Progress";
|
||||||
cmSystemTools::RemoveADirectory(dirName.c_str());
|
cmSystemTools::RemoveADirectory(dirName.c_str());
|
||||||
int count = atoi(args[3].c_str());
|
|
||||||
|
// is the last argument a filename that exists?
|
||||||
|
FILE *countFile = fopen(args[3].c_str(),"r");
|
||||||
|
int count;
|
||||||
|
if (countFile)
|
||||||
|
{
|
||||||
|
fscanf(countFile,"%i",&count);
|
||||||
|
fclose(countFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count = atoi(args[3].c_str());
|
||||||
|
}
|
||||||
if (count)
|
if (count)
|
||||||
{
|
{
|
||||||
cmSystemTools::MakeDirectory(dirName.c_str());
|
cmSystemTools::MakeDirectory(dirName.c_str());
|
||||||
|
|
Loading…
Reference in New Issue