summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-03-09 16:39:01 (GMT)
committerDavid Cole <david.cole@kitware.com>2012-03-09 16:39:01 (GMT)
commit05a76d53c0ff99f698760080c2fbde7f1e47cf7a (patch)
treec14165a2006f5726cfce628d711e70743ce41b0f
parentc7bdef5b48fe74f92d75f538e702257e7de1a998 (diff)
downloadCMake-05a76d53c0ff99f698760080c2fbde7f1e47cf7a.zip
CMake-05a76d53c0ff99f698760080c2fbde7f1e47cf7a.tar.gz
CMake-05a76d53c0ff99f698760080c2fbde7f1e47cf7a.tar.bz2
CPack: Fix retry logic when calls to hdiutil fail
The long-standing sporadic failures of CPack tests on the Mac dashboards are caused by an occasional problem running hdiutil. To compensate for this, a retry loop was added in the code in a previous commit: a9fa71a4 ... but the logic for breaking out of the retry loop was flawed, breaking out of the loop (and not retrying) when the hdiutil command returns an error instead of when it returns success. This commit fixes the flawed logic, bumps up the number of retries from 4 to 10, and adds a half-second delay in between retries. The delay is specifically added in case a virus checker or spotlight indexer is temporarily causing the hdiutil failure by hanging onto a newly created file longer than hdiutil expects it to. As with all sporadically occurring issues, we'll never know if this is really fixed all the way. But I'll be happy even if we can only get it to happen just a bit less often.
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx8
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx6
2 files changed, 9 insertions, 5 deletions
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index 75ad640..363ccea 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -170,23 +170,25 @@ int cmCPackOSXX11Generator::PackageFiles()
<< "\" create -ov -format UDZO -srcfolder \""
<< diskImageDirectory.c_str()
<< "\" \"" << packageFileNames[0] << "\"";
- int retVal = 1;
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Compress disk image using command: "
<< dmgCmd.str().c_str() << std::endl);
// since we get random dashboard failures with this one
// try running it more than once
- int numTries = 4;
+ int retVal = 1;
+ int numTries = 10;
bool res = false;
while(numTries > 0)
{
res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output,
&retVal, 0,
this->GeneratorVerbose, 0);
- if(res && retVal)
+ if ( res && !retVal )
{
numTries = -1;
+ break;
}
+ cmSystemTools::Delay(500);
numTries--;
}
if ( !res || retVal )
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index 0c4b1a6..327c4a6 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -319,17 +319,19 @@ int cmCPackPackageMakerGenerator::PackageFiles()
<< "\" \"" << packageFileNames[0] << "\"";
std::string output;
int retVal = 1;
- int numTries = 4;
+ int numTries = 10;
bool res = false;
while(numTries > 0)
{
res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output,
&retVal, 0, this->GeneratorVerbose,
0);
- if(res && retVal)
+ if ( res && !retVal )
{
numTries = -1;
+ break;
}
+ cmSystemTools::Delay(500);
numTries--;
}
if ( !res || retVal )