Skip to content

Commit

Permalink
Merge branch 'sg/test-with-stdin'
Browse files Browse the repository at this point in the history
Teach the "debug" helper used in the test framework that allows a
command to run under "gdb" to make the session interactive.

* sg/test-with-stdin:
  tests: make the 'test_pause' helper work in non-verbose mode
  tests: create an interactive gdb session with the 'debug' helper
  • Loading branch information
gitster committed Mar 24, 2017
2 parents 8b47c5d + 59210dd commit fa13fd1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
11 changes: 3 additions & 8 deletions t/test-lib-functions.sh
Expand Up @@ -136,25 +136,20 @@ test_tick () {
export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
}

# Stop execution and start a shell. This is useful for debugging tests and
# only makes sense together with "-v".
# Stop execution and start a shell. This is useful for debugging tests.
#
# Be sure to remove all invocations of this command before submitting.

test_pause () {
if test "$verbose" = t; then
"$SHELL_PATH" <&6 >&3 2>&4
else
error >&5 "test_pause requires --verbose"
fi
"$SHELL_PATH" <&6 >&5 2>&7
}

# Wrap git in gdb. Adding this to a command can make it easier to
# understand what is going on in a failing test.
#
# Example: "debug git checkout master".
debug () {
GIT_TEST_GDB=1 "$@"
GIT_TEST_GDB=1 "$@" <&6 >&5 2>&7
}

# Call test_commit with the arguments
Expand Down
1 change: 1 addition & 0 deletions t/test-lib.sh
Expand Up @@ -342,6 +342,7 @@ fi

exec 5>&1
exec 6<&0
exec 7>&2
if test "$verbose_log" = "t"
then
exec 3>>"$GIT_TEST_TEE_OUTPUT_FILE" 4>&3
Expand Down

0 comments on commit fa13fd1

Please sign in to comment.