Re: [PATCH 3/6] Facilitate debugging Git executables in tests with gdb
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 27, 2015, 16:34 UTC
- Message-ID
- <xmqqr3kge0d3.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <alpine.DEB.1.00.1510271036100.31610@s15462909.onlinehome-server.info>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 20 quoted lines
>> Most TEST_ environment variables that git respects are under >> GIT_TEST_* --- e.g., GIT_TEST_OPTS. Should this match that pattern >> as well, for easier debugging with commands like 'env | grep GIT_'? > > I dunno. This variable is most useful when inserted into the shell scripts > in t/ themselves, not when specified via the command line. For example, if > you have something like > > test_expect_success '123' ' > ... > # This Git call somehow fails and I have no clue why > git push remote HEAD > ... > ' > > then prefixing the `git push` command with `TEST_GDB_GIT=1` lets you use > `gdb` when running the test with the `-i` and `-v` flags. > > Please note that `TEST_GDB_GIT` is already a major step up from my initial > `DDD`.
Yeah, that was my first reaction when I saw this patch. Instead of having to munge that line to "gdb -whatever-args git", you can do a single-shot debugging in a convenient way. And quite honestly, because nobody sane will run:
$ cd t && TEST_GDB_GIT=1 sh ./t1234-frotz.sh
and can drive all the "git" running under gdb at the same time, I think what you showed would be the _only_ practical use case. I would have thought that TEST_GDB_GIT was way too long (and so is GIT_TEST_GDB) and was about to suggest using something short and sweet, even shorter than DDD, that you can easily add and remove.
It can be called GDB=1, perhaps?
I agree with all other points Jonathan made in his review, including "Neat." part ;-)
Thanks.