git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/6] Facilitate debugging Git executables in tests with gdb

From
Jeff King <peff@peff.net>
Date
Oct 27, 2015, 23:58 UTC
Message-ID
<20151027235823.GD4172@sigill.intra.peff.net>
In-Reply-To
<CAGZ79karRbOTSEfFHRU6MG21T1L5GyuZW2ATqfdP4NE7wHMmHQ@mail.gmail.com>
On Tue, Oct 27, 2015 at 04:39:37PM -0700, Stefan Beller wrote:
Show 9 quoted lines
> On Tue, Oct 27, 2015 at 4:28 PM, Jeff King <peff@peff.net> wrote:
> > I agree doing so would be crazy. But would:
> >
> >   ./t1234-frotz.sh --gdb=17
> >
> > be sane to run gdb only inside test 17?
> 
> OT:
> We have two ways of addressing tests, by number and by name.

Yeah. The numbers are not stable if the script gets new test, but they are usually fine for within a debugging session. Names are annoying to type (and also not guaranteed unique).

Show 6 quoted lines
> Usually when a test fails ("Foo gobbles the bar correctly" failed),
> I want to run tests 1,17 (1 is the correct setup and 17 is the failing test)
> But coming up with that tuple is hard.
>   * How do I know we need to run 1 as the setup ? (usually we do,
>     sometimes we don't and other times we also need 2,3 to completely
> setup the tests)

I think trying to deduce that tuple is a fool's errand. It takes a lot of manual work, and even if you _think_ you have it, sometimes state left from earlier tests is accidentally important. But it's usually not that expensive to run earlier tests at all; it's just expensive to run them with extra debugging. That's why we have options like "--valgrind-only=17". We still _run_ tests 1..16, but we do it quickly, and then execute the expensive and slow valgrind git only on the suspicious one.

And I'd propose --gdb to work the same way (run all the other tests, but only kick in gdb for the suspicious one).

If you had multiple "git" invocations inside test 17, you could even do something like "--gdb=17:4" to kick in only for the 4th git invocation or something. But counting up git invocations is probably too irritating to be worth doing manually.

Show 5 quoted lines
>   * How do I know it's test 17 which is failing? My workflow up to now
>     I just searched the test title in the file, such that I'd be there anyway
>     to inspect it further. But still I found it inconvenient to
> mentally map between
>     17 and the test title.

I usually just run the test script and look at the output. Here's a failure (which I obviously induced with an extra line):

  $ ./t4103-apply-binary.sh -v -i
  [...]
  ok 5 - check binary diff -- should fail.
  
  expecting success: 
          git checkout master &&
          echo whoops, we fail here && false &&
          test_must_fail git apply --check C.diff
  
  Already on 'master'
  whoops, we fail here
  not ok 6 - check binary diff (copy) -- should fail.
  #
  #               git checkout master &&
  #               echo whoops, we fail here && false &&
  #               test_must_fail git apply --check C.diff
  #

I'd pull the test number from the "not ok" above (it's actually even easier to see if you drop the "-v", but I usually start my debugging with "-v" anyway, since error messages often make the problem obvious).

-Peff
Previous: Stefan BellerNext: Johannes Schindelin
Message 23 of 48 in “Miscellaneous platform-independent patches from Git for Windows”
  1. 0/6 Miscellaneous platform-independent patches from Git for WindowsJohannes Schindelin, Oct 26, 2015
  2. 1/6 Only use CURLOPT_LOGIN_OPTIONS if it is actually availableJohannes Schindelin, Oct 26, 2015
  3. Junio C HamanoOct 26, 2015
  4. 2/6 remote-http(s): Support SOCKS proxiesJohannes Schindelin, Oct 26, 2015
  5. Junio C HamanoOct 26, 2015
  6. James McCoyOct 27, 2015
  7. Junio C HamanoOct 27, 2015
  8. Johannes SchindelinOct 27, 2015
  9. Johannes SchindelinOct 27, 2015
  10. Junio C HamanoOct 27, 2015
  11. Junio C HamanoOct 27, 2015
  12. Junio C HamanoOct 27, 2015
  13. Johannes SchindelinOct 30, 2015
  14. Pat ThoytsNov 9, 2015
  15. Johannes SchindelinNov 16, 2015
  16. Junio C HamanoNov 18, 2015
  17. 3/6 Facilitate debugging Git executables in tests with gdbJohannes Schindelin, Oct 26, 2015
  18. Jonathan NiederOct 26, 2015
  19. Johannes SchindelinOct 27, 2015
  20. Junio C HamanoOct 27, 2015
  21. Jeff KingOct 27, 2015
  22. Stefan BellerOct 27, 2015
  23. Jeff KingOct 27, 2015
  24. Johannes SchindelinOct 30, 2015
  25. Jeff KingOct 30, 2015
  26. Johannes SchindelinOct 30, 2015
  27. Junio C HamanoOct 30, 2015
  28. Jonathan NiederOct 30, 2015
  29. Johannes SchindelinOct 30, 2015
  30. Jeff KingOct 30, 2015
  31. Jonathan NiederOct 30, 2015
  32. Junio C HamanoOct 30, 2015
  33. Johannes SchindelinOct 30, 2015
  34. Jonathan NiederOct 30, 2015
  35. Duy NguyenOct 27, 2015
  36. Junio C HamanoOct 29, 2015
  37. Victor LeschukOct 29, 2015
  38. Johannes SchindelinOct 30, 2015
  39. Victor LeschukNov 1, 2015
  40. Johannes SchindelinNov 1, 2015
  41. 4/6 Squelch warning about an integer overflowJohannes Schindelin, Oct 26, 2015
  42. Junio C HamanoOct 26, 2015
  43. Johannes SchindelinOct 30, 2015
  44. Junio C HamanoOct 30, 2015
  45. 5/6 Silence GCC's "cast of pointer to integer of a different size" warningJohannes Schindelin, Oct 26, 2015
  46. Junio C HamanoOct 26, 2015
  47. 6/6 Correct fscanf formatting string for I64u valuesJohannes Schindelin, Oct 26, 2015
  48. Junio C HamanoOct 26, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.