<HTML>
<HEAD>
<TITLE>CTest fails to find test command : bug in use of FileExists() + suggested fix.</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12pt'><BR>
One of my test cases needs sudo to run (its listening on privileged ports).<BR>
<BR>
<BR>
If I add<BR>
<BR>
&nbsp;&nbsp;ADD_TEST( SERVER /usr/bin/sudo ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Server${SUFFIX} --daemon )<BR>
<BR>
CMake complains that it can&#8217;t find sudo.<BR>
<BR>
[ d042 ] make test<BR>
Running tests...<BR>
Test project /Users/richard/BUILD<BR>
&nbsp;&nbsp;&nbsp;&nbsp;Start 1: SERVER<BR>
Could not find executable /usr/bin/sudo<BR>
Looked in the following places:<BR>
/usr/bin/sudo<BR>
/usr/bin/sudo<BR>
/usr/bin/Release/sudo<BR>
/usr/bin/Release/sudo<BR>
/usr/bin/Debug/sudo<BR>
/usr/bin/Debug/sudo<BR>
...<BR>
<BR>
<BR>
However (on OS X and Linux) sudo is not readable (although it is executable).<BR>
<BR>
In Source/CTest/cmCTestTestHandler.cxx (line 1494) you&#8217;re using cmSystemTools::FileExists(attempted[ai].c_str() ) to test for the presence of the testcase.<BR>
<BR>
<BR>
Looking in Source/kwsys/SystemTools.cxx line 919 shows that on non-Windows systems its using access(path, R_OK), which checks to see if the path has read permissions.<BR>
<BR>
<BR>
Might I suggest replacing the call to FileExists() Source/CTest/cmCTestTestHandler.cxx &nbsp;in with a new test &nbsp;- FileIsExecutable() since the only requirement is to be able to execute the program, not read it.<BR>
<BR>
<BR>
Thanks,<BR>
<BR>
<BR>
Richard.</SPAN></FONT>
</BODY>
</HTML>