summaryrefslogtreecommitdiff
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2015-10-30 19:02:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-10-30 21:02:38 (GMT)
commit6a94088cc3d539bdc15b824befc083f7ff8d0288 (patch)
tree8f0cfd83cf10d042726e0b706c5fd5636dfc6388 /t/test-lib-functions.sh
parent80980a1d5c2678ab9031d7c60faf38b9631eb1ce (diff)
downloadgit-6a94088cc3d539bdc15b824befc083f7ff8d0288.zip
git-6a94088cc3d539bdc15b824befc083f7ff8d0288.tar.gz
git-6a94088cc3d539bdc15b824befc083f7ff8d0288.tar.bz2
test: facilitate debugging Git executables in tests with gdb
When prefixing a Git call in the test suite with 'debug ', it will now be run with GDB, allowing the developer to debug test failures more conveniently. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 6dffb8b..73e37a1 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -145,6 +145,14 @@ test_pause () {
fi
}
+# 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 "$@"
+}
+
# Call test_commit with the arguments "<message> [<file> [<contents> [<tag>]]]"
#
# This will commit a file with the given contents and the given commit