[Cmake-commits] [cmake-commits] king committed cmCTest.cxx 1.347 1.348 cmCTest.h 1.108 1.109
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Jan 12 10:37:27 EST 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv9942/Source
Modified Files:
cmCTest.cxx cmCTest.h
Log Message:
ENH: Refactor cmCTest test part representation
This introduces the name "part" to denote a portion of the testing and
submission process performed by ctest. We generalize the boolean
indicating whether each part is enabled into a structure to which more
information can be added later. We provide bi-directional mapping
between part id and part names.
Index: cmCTest.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.h,v
retrieving revision 1.108
retrieving revision 1.109
diff -C 2 -d -r1.108 -r1.109
*** cmCTest.h 12 Jan 2009 14:11:29 -0000 1.108
--- cmCTest.h 12 Jan 2009 15:37:25 -0000 1.109
***************
*** 51,54 ****
--- 51,88 ----
{
public:
+ /** Enumerate parts of the testing and submission process. */
+ enum Part
+ {
+ PartStart,
+ PartUpdate,
+ PartConfigure,
+ PartBuild,
+ PartTest,
+ PartCoverage,
+ PartMemCheck,
+ PartSubmit,
+ PartNotes,
+ PartCount // Update names in constructor when adding a part
+ };
+
+ /** Representation of one part. */
+ struct PartInfo
+ {
+ PartInfo(): Enabled(false) {}
+
+ void SetName(const char* name) { this->Name = name; }
+ const char* GetName() const { return this->Name.c_str(); }
+
+ void Enable() { this->Enabled = true; }
+ operator bool() const { return this->Enabled; }
+ private:
+ bool Enabled;
+ std::string Name;
+ };
+
+ /** Get a testing part id from its string name. Returns PartCount
+ if the string does not name a valid part. */
+ Part GetPartFromName(const char* name);
+
typedef std::vector<cmStdString> VectorOfStrings;
typedef std::set<cmStdString> SetOfStrings;
***************
*** 357,375 ****
bool ShowOnly;
- enum {
- FIRST_TEST = 0,
- UPDATE_TEST = 1,
- START_TEST = 2,
- CONFIGURE_TEST = 3,
- BUILD_TEST = 4,
- TEST_TEST = 5,
- COVERAGE_TEST = 6,
- MEMCHECK_TEST = 7,
- SUBMIT_TEST = 8,
- NOTES_TEST = 9,
- ALL_TEST = 10,
- LAST_TEST = 11
- };
-
//! Map of configuration properties
typedef std::map<cmStdString, cmStdString> CTestConfigurationMap;
--- 391,394 ----
***************
*** 378,382 ****
CTestConfigurationMap CTestConfiguration;
CTestConfigurationMap CTestConfigurationOverwrites;
! int Tests[LAST_TEST];
std::string CurrentTag;
--- 397,403 ----
CTestConfigurationMap CTestConfiguration;
CTestConfigurationMap CTestConfigurationOverwrites;
! PartInfo Parts[PartCount];
! typedef std::map<cmStdString, Part> PartMapType;
! PartMapType PartMap;
std::string CurrentTag;
Index: cmCTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.cxx,v
retrieving revision 1.347
retrieving revision 1.348
diff -C 2 -d -r1.347 -r1.348
*** cmCTest.cxx 12 Jan 2009 14:11:29 -0000 1.347
--- cmCTest.cxx 12 Jan 2009 15:37:25 -0000 1.348
***************
*** 261,269 ****
this->InitStreams();
! int cc;
! for ( cc=0; cc < cmCTest::LAST_TEST; cc ++ )
{
! this->Tests[cc] = 0;
}
this->ShortDateFormat = true;
--- 261,280 ----
this->InitStreams();
! this->Parts[PartStart].SetName("Start");
! this->Parts[PartUpdate].SetName("Update");
! this->Parts[PartConfigure].SetName("Configure");
! this->Parts[PartBuild].SetName("Build");
! this->Parts[PartTest].SetName("Test");
! this->Parts[PartCoverage].SetName("Coverage");
! this->Parts[PartMemCheck].SetName("MemCheck");
! this->Parts[PartSubmit].SetName("Submit");
! this->Parts[PartNotes].SetName("Notes");
!
! // Fill the part name-to-id map.
! for(Part p = PartStart; p != PartCount; p = Part(p+1))
{
! this->PartMap[cmSystemTools::LowerCase(this->Parts[p].GetName())] = p;
}
+
this->ShortDateFormat = true;
***************
*** 302,305 ****
--- 313,331 ----
}
+ //----------------------------------------------------------------------------
+ cmCTest::Part cmCTest::GetPartFromName(const char* name)
+ {
+ // Look up by lower-case to make names case-insensitive.
+ std::string lower_name = cmSystemTools::LowerCase(name);
+ PartMapType::const_iterator i = this->PartMap.find(lower_name);
+ if(i != this->PartMap.end())
+ {
+ return i->second;
+ }
+
+ // The string does not name a valid part.
+ return PartCount;
+ }
+
//----------------------------------------------------------------------
int cmCTest::Initialize(const char* binary_dir, bool new_tag,
***************
*** 402,407 ****
if ( cmSystemTools::GetLineFromStream(tfin, tagmode) )
{
! if ( tagmode.size() > 4 && !( this->Tests[cmCTest::START_TEST] ||
! this->Tests[ALL_TEST] ))
{
this->TestModel = cmCTest::GetTestModelFromString(tagmode.c_str());
--- 428,432 ----
if ( cmSystemTools::GetLineFromStream(tfin, tagmode) )
{
! if (tagmode.size() > 4 && !this->Parts[PartStart])
{
this->TestModel = cmCTest::GetTestModelFromString(tagmode.c_str());
***************
*** 410,415 ****
tfin.close();
}
! if ( tag.size() == 0 || new_tag || this->Tests[cmCTest::START_TEST] ||
! this->Tests[ALL_TEST])
{
cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString()
--- 435,439 ----
tfin.close();
}
! if (tag.size() == 0 || new_tag || this->Parts[PartStart])
{
cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString()
***************
*** 635,675 ****
if ( cmSystemTools::LowerCase(ttype) == "all" )
{
! this->Tests[cmCTest::ALL_TEST] = 1;
! }
! else if ( cmSystemTools::LowerCase(ttype) == "start" )
! {
! this->Tests[cmCTest::START_TEST] = 1;
! }
! else if ( cmSystemTools::LowerCase(ttype) == "update" )
! {
! this->Tests[cmCTest::UPDATE_TEST] = 1;
! }
! else if ( cmSystemTools::LowerCase(ttype) == "configure" )
! {
! this->Tests[cmCTest::CONFIGURE_TEST] = 1;
! }
! else if ( cmSystemTools::LowerCase(ttype) == "build" )
! {
! this->Tests[cmCTest::BUILD_TEST] = 1;
! }
! else if ( cmSystemTools::LowerCase(ttype) == "test" )
! {
! this->Tests[cmCTest::TEST_TEST] = 1;
! }
! else if ( cmSystemTools::LowerCase(ttype) == "coverage" )
! {
! this->Tests[cmCTest::COVERAGE_TEST] = 1;
! }
! else if ( cmSystemTools::LowerCase(ttype) == "memcheck" )
! {
! this->Tests[cmCTest::MEMCHECK_TEST] = 1;
! }
! else if ( cmSystemTools::LowerCase(ttype) == "notes" )
! {
! this->Tests[cmCTest::NOTES_TEST] = 1;
}
! else if ( cmSystemTools::LowerCase(ttype) == "submit" )
{
! this->Tests[cmCTest::SUBMIT_TEST] = 1;
}
else
--- 659,673 ----
if ( cmSystemTools::LowerCase(ttype) == "all" )
{
! for(Part p = PartStart; p != PartCount; p = Part(p+1))
! {
! this->Parts[p].Enable();
! }
! return true;
}
! Part p = this->GetPartFromName(ttype);
! if(p != PartCount)
{
! this->Parts[p].Enable();
! return true;
}
else
***************
*** 682,686 ****
return false;
}
- return true;
}
--- 680,683 ----
***************
*** 819,831 ****
}
! for ( cc = 0; cc < LAST_TEST; cc ++ )
{
! if ( this->Tests[cc] )
! {
! notest = false;
! break;
! }
}
! if (( this->Tests[UPDATE_TEST] || this->Tests[ALL_TEST] ) &&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
--- 816,824 ----
}
! for(Part p = PartStart; notest && p != PartCount; p = Part(p+1))
{
! notest = !this->Parts[p];
}
! if (this->Parts[PartUpdate] &&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
***************
*** 843,847 ****
return 0;
}
! if (( this->Tests[CONFIGURE_TEST] || this->Tests[ALL_TEST] )&&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
--- 836,840 ----
return 0;
}
! if (this->Parts[PartConfigure] &&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
***************
*** 851,855 ****
}
}
! if (( this->Tests[BUILD_TEST] || this->Tests[ALL_TEST] )&&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
--- 844,848 ----
}
}
! if (this->Parts[PartBuild] &&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
***************
*** 860,864 ****
}
}
! if (( this->Tests[TEST_TEST] || this->Tests[ALL_TEST] || notest ) &&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
--- 853,857 ----
}
}
! if ((this->Parts[PartTest] || notest) &&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
***************
*** 869,873 ****
}
}
! if (( this->Tests[COVERAGE_TEST] || this->Tests[ALL_TEST] ) &&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
--- 862,866 ----
}
}
! if (this->Parts[PartCoverage] &&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
***************
*** 878,882 ****
}
}
! if (( this->Tests[MEMCHECK_TEST] || this->Tests[ALL_TEST] )&&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
--- 871,875 ----
}
}
! if (this->Parts[PartMemCheck] &&
(this->GetRemainingTimeAllowed() - 120 > 0))
{
***************
*** 907,916 ****
}
this->NotesFiles += fullname;
! this->Tests[NOTES_TEST] = 1;
}
}
}
}
! if ( this->Tests[NOTES_TEST] || this->Tests[ALL_TEST] )
{
this->UpdateCTestConfiguration();
--- 900,909 ----
}
this->NotesFiles += fullname;
! this->Parts[PartNotes].Enable();
}
}
}
}
! if (this->Parts[PartNotes])
{
this->UpdateCTestConfiguration();
***************
*** 920,924 ****
}
}
! if ( this->Tests[SUBMIT_TEST] || this->Tests[ALL_TEST] )
{
this->UpdateCTestConfiguration();
--- 913,917 ----
}
}
! if (this->Parts[PartSubmit])
{
this->UpdateCTestConfiguration();
More information about the Cmake-commits
mailing list