[CMake] ctest timeout: getting backtraces

David Cole david.cole at kitware.com
Wed Jun 27 14:09:27 EDT 2012


ctest uses the kwsys utilities to launch and monitor sub-processes.

Theoretically, it goes like this, with variations in implementation
from platform to platform:

After a call to a kwsysProcessCreate function (which spawns a process
asynchronously and returns control to ctest), we loop while calling
either a WaitForData or WaitForExit function, collecting stdout and
std err from the sub-process. Those wait functions may simply return a
value to us that says "hey, the timeout has expired" and ctest does
not even have to kill anything at that point.

We hand the timeout value to the ProcessCreate function, so the system
can kill it for us if it knows how to do that.

If not, we also have a kwsysProcessKill function that we can call if necessary.

So ... you can't use a sig trap reliably unless you know the
implementation details of the whole system under the hood and you know
for a fact that it's going to work on a given system.


HTH,
David


On Tue, Jun 26, 2012 at 11:25 PM, Leif Walsh <leif.walsh at gmail.com> wrote:
> I'd like to be able to get a backtrace when a test times out with ctest, so I can analyze where the test was stuck, if at all.
>
> I tried writing a fake test to tell me what signal ctest was using to kill a timing out test, but it couldn't.  I imagine this is because it uses SIGKILL and I can't trap that.
>
> Is this the case?  Is there a way to change what ctest uses (perhaps SIGALRM, SIGPROF, or SIGUSR1/SIGUSR2) so I can have my tests trap that, dump a backtrace, and then abort?  If not, could I request this feature?
>
> --
> Cheers,
> Leif
>
> --
>
> 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


More information about the CMake mailing list