[CMake] test executable failing only when run in ctest

Brad King brad.king at kitware.com
Mon Jan 26 15:04:32 EST 2009


Matthew Leotta wrote:
> Brad,
> 
>   Thanks, but I'm not sure if I completely understand your suggestion. 
> Let me clarify.  If I run the test executable
> 
> ./bvxm_test_all
> 
> I get no errors and no segfault.  I know how to debug this, but there is
> nothing to debug.  If in the same directory I run
> 
> ctest
> 
> then the test will segfault.  Even stranger, on some platforms the test
> passes, but when I run in ctest it fails (produces the wrong values) but
> does not segfault.  On some other platforms everything seems to work
> both with and without ctest.
> 
> I'm actually running only the specific test that fails (the 5th one) with
> 
> ./bvxm_test_all test_amp_processors
> 
> or
> 
> ctest -V -I 5,5
> 
> but the results are the same.  When I try to debug ctest I never hit
> breakpoints in bvxm_test_all because ctest spawns off a separate process
> for bvxm_test_all, and gdb is attached to ctest.  I'm not much of an
> expert on using gdb from the command line, I usually debug with an IDE
> front end (XCode or KDevelop).

add_test(run_xterm xterm)

$ ctest -R run_xterm

Then run gdb and the test inside the xterm to see if it fails.  It could
be an environment difference.

-Brad



More information about the CMake mailing list