One of my test cases needs sudo to run (its listening on privileged ports).


If I add

  ADD_TEST( SERVER /usr/bin/sudo
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Server${SUFFIX} --daemon )

CMake complains that it can¹t find sudo.

[ d042 ] make test
Running tests...
Test project /Users/richard/BUILD
    Start 1: SERVER
Could not find executable /usr/bin/sudo
Looked in the following places:
/usr/bin/sudo
/usr/bin/sudo
/usr/bin/Release/sudo
/usr/bin/Release/sudo
/usr/bin/Debug/sudo
/usr/bin/Debug/sudo
...


However (on OS X and Linux) sudo is not readable (although it is
executable).

In Source/CTest/cmCTestTestHandler.cxx (line 1494) you¹re using
cmSystemTools::FileExists(attempted[ai].c_str() ) to test for the presence
of the testcase.


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.


Might I suggest replacing the call to FileExists()
Source/CTest/cmCTestTestHandler.cxx  in with a new test  -
FileIsExecutable() since the only requirement is to be able to execute the
program, not read it.


Thanks,


Richard.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to