[cmake-commits] alex committed cmCTestTestHandler.cxx 1.53.2.1 1.53.2.2 cmCTestTestHandler.h 1.22 1.22.2.1

cmake-commits at cmake.org cmake-commits at cmake.org
Mon May 14 09:47:01 EDT 2007


Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv31138/Source/CTest

Modified Files:
      Tag: CMake-CrossCompileBasic
	cmCTestTestHandler.cxx cmCTestTestHandler.h 
Log Message:

ENH: use GetCTestConfiguration("ExecutableSuffix") instead instead of
cmSystemTools::GetExecutableExtension() 
-rmove the unused TryExecutable()

Alex


Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.53.2.1
retrieving revision 1.53.2.2
diff -u -d -r1.53.2.1 -r1.53.2.2
--- cmCTestTestHandler.cxx	11 May 2007 17:46:02 -0000	1.53.2.1
+++ cmCTestTestHandler.cxx	14 May 2007 13:46:59 -0000	1.53.2.2
@@ -214,51 +214,6 @@
 }
 
 //----------------------------------------------------------------------
-// Try to find an executable, if found fullPath will be set to the full path
-// of where it was found. The directory and filename to search for are passed
-// in as well an a subdir (typically used for configuraitons such as
-// Release/Debug/etc)
-bool cmCTestTestHandler::TryExecutable(const char *dir, 
-                                       const char *file,
-                                       std::string *fullPath, 
-                                       const char *subdir)
-{
-  // try current directory
-  std::string tryPath;
-  if (dir && strcmp(dir,""))
-    {
-    tryPath = dir;
-    tryPath += "/";
-    }
-
-  if (subdir && strcmp(subdir,""))
-    {
-    tryPath += subdir;
-    tryPath += "/";
-    }
-
-  tryPath += file;
-
-  // find the file without an executable extension
-  if(cmSystemTools::FileExists(tryPath.c_str()))
-    {
-    *fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
-    return true;
-    }
-
-  // if not found try it with the executable extension
-  tryPath += cmSystemTools::GetExecutableExtension(); // TODO: probably needs CMAKE_EXECUTABLE_SUFFIX, but will probably not run at all
-  if(cmSystemTools::FileExists(tryPath.c_str()))
-    {
-    *fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
-    return true;
-    }
-
-  // not found at all, return false
-  return false;
-}
-
-//----------------------------------------------------------------------
 // get the next number in a string with numbers separated by ,
 // pos is the start of the search and pos2 is the end of the search
 // pos becomes pos2 after a call to GetNextNumber.
@@ -1209,29 +1164,17 @@
   for(unsigned int ai=0;
       ai < attempted.size() && fullPath.size() == 0; ++ai)
     {
-    // first check without exe extension
-    if(cmSystemTools::FileExists(attempted[ai].c_str())
-       && !cmSystemTools::FileIsDirectory(attempted[ai].c_str()))
+      tempPath = cmSystemTools::CollapseFullPath(attempted[ai].c_str());
+      tempPath += ctest->GetCTestConfiguration("ExecutableSuffix");
+      if(cmSystemTools::FileExists(tempPath.c_str())
+       && !cmSystemTools::FileIsDirectory(tempPath.c_str()))
       {
-      fullPath = cmSystemTools::CollapseFullPath(attempted[ai].c_str());
+      fullPath = tempPath;
       resultingConfig = attemptedConfigs[ai];
       }
-    // then try with the exe extension
     else
       {
-      failed.push_back(attempted[ai].c_str());
-      tempPath = attempted[ai];
-      tempPath += cmSystemTools::GetExecutableExtension(); // TODO: probably needs CMAKE_EXECUTABLE_SUFFIX, but will probably not run at all
-      if(cmSystemTools::FileExists(tempPath.c_str())
-         && !cmSystemTools::FileIsDirectory(tempPath.c_str()))
-        {
-        fullPath = cmSystemTools::CollapseFullPath(tempPath.c_str());
-        resultingConfig = attemptedConfigs[ai];
-        }
-      else
-        {
-        failed.push_back(tempPath.c_str());
-        }
+      failed.push_back(tempPath.c_str());
       }
     }
   
@@ -1246,7 +1189,7 @@
       return path;
       }
     }
-  
+
   return fullPath;
 }
 

Index: cmCTestTestHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.h,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -u -d -r1.22 -r1.22.2.1
--- cmCTestTestHandler.h	19 Mar 2007 17:04:10 -0000	1.22
+++ cmCTestTestHandler.h	14 May 2007 13:46:59 -0000	1.22.2.1
@@ -103,11 +103,6 @@
     cmCTestTestProperties* Properties;
   };
 
-  // useful function for looking for a test
-  static bool TryExecutable(const char *dir, const char *file,
-                            std::string *fullPath, 
-                            const char *subdir);
-
   // add configuraitons to a search path for an executable
   static void AddConfigurations(cmCTest *ctest, 
                                 std::vector<std::string> &attempted,



More information about the Cmake-commits mailing list