[Cmake-commits] [cmake-commits] david.cole committed cmCTest.cxx 1.386 1.387 cmCTest.h 1.131 1.132
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Dec 29 14:38:33 EST 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv1368/Source
Modified Files:
cmCTest.cxx cmCTest.h
Log Message:
Fix issue #10060 - add APPEND arg to ctest_start command.
If APPEND is given to ctest_start, it will read the tag from the current existing Testing/TAG file rather than creating a new one based on the current time stamp. This allows a developer to run several dashboard scripts in a row, all of which will share the same tag/stamp/buildid when they finally get submitted to CDash. Now you can split the running of build phases and test phases for the same dashboard row into multiple scripts.
Index: cmCTest.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.h,v
retrieving revision 1.131
retrieving revision 1.132
diff -C 2 -d -r1.131 -r1.132
*** cmCTest.h 22 Dec 2009 19:37:06 -0000 1.131
--- cmCTest.h 29 Dec 2009 19:38:31 -0000 1.132
***************
*** 476,487 ****
/**
! * Initialize a dashboard run in the given build tree. The "script"
! * argument is true when running from a command-driven (ctest_start)
! * dashboard script, and false when running from the CTest command
* line. Note that a declarative dashboard script does not actually
* call this method because it sets CTEST_COMMAND to drive a build
* through the ctest command line.
*/
! int Initialize(const char* binary_dir, bool script);
//! parse the option after -D and convert it into the appropriate steps
--- 476,487 ----
/**
! * Initialize a dashboard run in the given build tree. The "command"
! * argument is non-NULL when running from a command-driven (ctest_start)
! * dashboard script, and NULL when running from the CTest command
* line. Note that a declarative dashboard script does not actually
* call this method because it sets CTEST_COMMAND to drive a build
* through the ctest command line.
*/
! int Initialize(const char* binary_dir, cmCTestStartCommand* command);
//! parse the option after -D and convert it into the appropriate steps
Index: cmCTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.cxx,v
retrieving revision 1.386
retrieving revision 1.387
diff -C 2 -d -r1.386 -r1.387
*** cmCTest.cxx 22 Dec 2009 19:37:06 -0000 1.386
--- cmCTest.cxx 29 Dec 2009 19:38:31 -0000 1.387
***************
*** 403,407 ****
//----------------------------------------------------------------------
! int cmCTest::Initialize(const char* binary_dir, bool script)
{
cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl);
--- 403,407 ----
//----------------------------------------------------------------------
! int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
{
cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl);
***************
*** 454,457 ****
--- 454,459 ----
if ( this->ProduceXML )
{
+ // Verify "Testing" directory exists:
+ //
std::string testingDir = this->BinaryDir + "/Testing";
if ( cmSystemTools::FileExists(testingDir.c_str()) )
***************
*** 473,543 ****
}
}
std::string tagfile = testingDir + "/TAG";
std::ifstream tfin(tagfile.c_str());
std::string tag;
! time_t tctime = time(0);
! if ( this->TomorrowTag )
! {
! tctime += ( 24 * 60 * 60 );
! }
! struct tm *lctime = gmtime(&tctime);
! if ( tfin && cmSystemTools::GetLineFromStream(tfin, tag) )
{
! int year = 0;
! int mon = 0;
! int day = 0;
! int hour = 0;
! int min = 0;
! sscanf(tag.c_str(), "%04d%02d%02d-%02d%02d",
! &year, &mon, &day, &hour, &min);
! if ( year != lctime->tm_year + 1900 ||
! mon != lctime->tm_mon+1 ||
! day != lctime->tm_mday )
{
! tag = "";
}
! std::string tagmode;
! if ( cmSystemTools::GetLineFromStream(tfin, tagmode) )
{
! if (tagmode.size() > 4 && !this->Parts[PartStart])
{
! this->TestModel = cmCTest::GetTestModelFromString(tagmode.c_str());
}
}
! tfin.close();
! }
! if (tag.size() == 0 || script || this->Parts[PartStart])
! {
! cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString()
! << std::endl);
! cmCTestLog(this, DEBUG, "TestModel: " << this->TestModel << std::endl);
! if ( this->TestModel == cmCTest::NIGHTLY )
{
! lctime = this->GetNightlyTime(
! this->GetCTestConfiguration("NightlyStartTime"), this->TomorrowTag);
}
! char datestring[100];
! sprintf(datestring, "%04d%02d%02d-%02d%02d",
! lctime->tm_year + 1900,
! lctime->tm_mon+1,
! lctime->tm_mday,
! lctime->tm_hour,
! lctime->tm_min);
! tag = datestring;
! std::ofstream ofs(tagfile.c_str());
! if ( ofs )
{
! ofs << tag << std::endl;
! ofs << this->GetTestModelString() << std::endl;
}
! ofs.close();
! if ( !script )
{
! cmCTestLog(this, OUTPUT, "Create new tag: " << tag << " - "
! << this->GetTestModelString() << std::endl);
}
}
this->CurrentTag = tag;
}
return 1;
}
--- 475,573 ----
}
}
+
+ // Create new "TAG" file or read existing one:
+ //
std::string tagfile = testingDir + "/TAG";
std::ifstream tfin(tagfile.c_str());
std::string tag;
!
! if (command->ShouldCreateNewTag())
{
! time_t tctime = time(0);
! if ( this->TomorrowTag )
{
! tctime += ( 24 * 60 * 60 );
}
! struct tm *lctime = gmtime(&tctime);
! if ( tfin && cmSystemTools::GetLineFromStream(tfin, tag) )
{
! int year = 0;
! int mon = 0;
! int day = 0;
! int hour = 0;
! int min = 0;
! sscanf(tag.c_str(), "%04d%02d%02d-%02d%02d",
! &year, &mon, &day, &hour, &min);
! if ( year != lctime->tm_year + 1900 ||
! mon != lctime->tm_mon+1 ||
! day != lctime->tm_mday )
{
! tag = "";
}
+ std::string tagmode;
+ if ( cmSystemTools::GetLineFromStream(tfin, tagmode) )
+ {
+ if (tagmode.size() > 4 && !this->Parts[PartStart])
+ {
+ this->TestModel = cmCTest::GetTestModelFromString(tagmode.c_str());
+ }
+ }
+ tfin.close();
}
! if (tag.size() == 0 || (0 != command) || this->Parts[PartStart])
{
! cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString()
! << std::endl);
! cmCTestLog(this, DEBUG, "TestModel: " << this->TestModel << std::endl);
! if ( this->TestModel == cmCTest::NIGHTLY )
! {
! lctime = this->GetNightlyTime(
! this->GetCTestConfiguration("NightlyStartTime"), this->TomorrowTag);
! }
! char datestring[100];
! sprintf(datestring, "%04d%02d%02d-%02d%02d",
! lctime->tm_year + 1900,
! lctime->tm_mon+1,
! lctime->tm_mday,
! lctime->tm_hour,
! lctime->tm_min);
! tag = datestring;
! std::ofstream ofs(tagfile.c_str());
! if ( ofs )
! {
! ofs << tag << std::endl;
! ofs << this->GetTestModelString() << std::endl;
! }
! ofs.close();
! if ( 0 == command )
! {
! cmCTestLog(this, OUTPUT, "Create new tag: " << tag << " - "
! << this->GetTestModelString() << std::endl);
! }
}
! }
! else
! {
! if ( tfin )
{
! cmSystemTools::GetLineFromStream(tfin, tag);
! tfin.close();
}
!
! if ( tag.empty() )
{
! cmCTestLog(this, ERROR_MESSAGE,
! "Cannot read existing TAG file in " << testingDir
! << std::endl);
! return 0;
}
+
+ cmCTestLog(this, OUTPUT, " Use existing tag: " << tag << " - "
+ << this->GetTestModelString() << std::endl);
}
+
this->CurrentTag = tag;
}
+
return 1;
}
***************
*** 597,601 ****
}
! if ( !this->Initialize(bld_dir.c_str(), true) )
{
return false;
--- 627,631 ----
}
! if ( !this->Initialize(bld_dir.c_str(), command) )
{
return false;
***************
*** 2207,2211 ****
}
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
! if(!this->Initialize(cwd.c_str(), false))
{
res = 12;
--- 2237,2241 ----
}
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
! if(!this->Initialize(cwd.c_str(), 0))
{
res = 12;
More information about the Cmake-commits
mailing list