There is no single way, every test can be flaky in different ways.
Using gdb generally only helps when a test fails. With flaky tests
often timing matters and putting a breakpoint somewhere completely
changes that.
It helps a lot if you can make the test nearly always fail. For example
by using valgrind, which makes everything slower.
Another way is to add logging calls. In script start with ch_logfile()
at the top of the test function that fails and then put ch_log() calls
in various places. The log includes a timestamp which can indicate slow
operations. You can also add calls in the code. This requires
recompiling, but it's required to pinpoint the part in the command that
matters. Call ch_log(NULL, "text").
It can also help to add some ":sleep 10m" commands or ":redraw" in some
places. This requires guessing what is happening.
--
Did Adam and Eve have navels?
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///