summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2005-08-09 17:12:03 (GMT)
committerKen Martin <ken.martin@kitware.com>2005-08-09 17:12:03 (GMT)
commit7df63f38c5318c55276ba0f8f3bb606f2139a0aa (patch)
treececbbd9ed394658e5130ff01448a731db6cccc13 /Source
parent93535a60e3d84d03370db68aa1f882e505355e38 (diff)
downloadCMake-7df63f38c5318c55276ba0f8f3bb606f2139a0aa.zip
CMake-7df63f38c5318c55276ba0f8f3bb606f2139a0aa.tar.gz
CMake-7df63f38c5318c55276ba0f8f3bb606f2139a0aa.tar.bz2
BUG: do not search the user's path for text executables when a full path is provided to the test
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 056cf95..12e2d39 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -169,6 +169,10 @@ bool cmCTestAddTestCommand::InitialPass(std::vector<std::string> const& args)
}
//----------------------------------------------------------------------
+// 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 TryExecutable(const char *dir, const char *file,
std::string *fullPath, const char *subdir)
{
@@ -187,17 +191,23 @@ bool TryExecutable(const char *dir, const char *file,
}
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();
if(cmSystemTools::FileExists(tryPath.c_str()))
{
*fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
return true;
}
+
+ // not found at all, return false
return false;
}
@@ -884,6 +894,7 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec)
//----------------------------------------------------------------------
+// Find the appropriate executable to run for a test
std::string cmCTestTestHandler::FindTheExecutable(const char *exe)
{
std::string fullPath = "";
@@ -891,6 +902,7 @@ std::string cmCTestTestHandler::FindTheExecutable(const char *exe)
std::string file;
cmSystemTools::SplitProgramPath(exe, dir, file);
+ // first try to find the executable given a config type subdir if there is one
if(m_CTest->GetConfigType() != "" &&
::TryExecutable(dir.c_str(), file.c_str(), &fullPath,
m_CTest->GetConfigType().c_str()))
@@ -898,11 +910,13 @@ std::string cmCTestTestHandler::FindTheExecutable(const char *exe)
return fullPath;
}
+ // next try the current directory as the subdir
if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,"."))
{
return fullPath;
}
+ // try without the config subdir
if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,""))
{
return fullPath;
@@ -932,8 +946,9 @@ std::string cmCTestTestHandler::FindTheExecutable(const char *exe)
}
}
- // if everything else failed, check the users path
- if (dir != "")
+ // if everything else failed, check the users path, but only if a full path
+ // wasn;t specified
+ if (dir.size() == 0)
{
std::string path = cmSystemTools::FindProgram(file.c_str());
if (path != "")