summaryrefslogtreecommitdiff
path: root/t/t0210-trace2-normal.sh
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2021-02-05 12:09:08 -0800
committerJunio C Hamano <gitster@pobox.com>2021-02-09 14:14:34 -0800
commit0a9dde4a04c1228025d292f44113cb8f9cebbfba (patch)
tree02ff80ac0ecd56c9f9d9a7f28e606bdef4a358f8 /t/t0210-trace2-normal.sh
parent773e25afc41b1b6533fa9ae2cd825d0b4a697fad (diff)
downloadgit-0a9dde4a04c1228025d292f44113cb8f9cebbfba.tar.gz
usage: trace2 BUG() invocations
die() messages are traced in trace2, but BUG() messages are not. Anyone tracking die() messages would have even more reason to track BUG(). Therefore, write to trace2 when BUG() is invoked. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0210-trace2-normal.sh')
-rwxr-xr-xt/t0210-trace2-normal.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t0210-trace2-normal.sh b/t/t0210-trace2-normal.sh
index ce7574edb1..0cf3a63b75 100755
--- a/t/t0210-trace2-normal.sh
+++ b/t/t0210-trace2-normal.sh
@@ -147,6 +147,25 @@ test_expect_success 'normal stream, error event' '
test_cmp expect actual
'
+# Verb 007bug
+#
+# Check that BUG writes to trace2
+
+test_expect_success 'BUG messages are written to trace2' '
+ test_when_finished "rm trace.normal actual expect" &&
+ test_must_fail env GIT_TRACE2="$(pwd)/trace.normal" test-tool trace2 007bug &&
+ perl "$TEST_DIRECTORY/t0210/scrub_normal.perl" <trace.normal >actual &&
+ cat >expect <<-EOF &&
+ version $V
+ start _EXE_ trace2 007bug
+ cmd_name trace2 (trace2)
+ error the bug message
+ exit elapsed:_TIME_ code:99
+ atexit elapsed:_TIME_ code:99
+ EOF
+ test_cmp expect actual
+'
+
sane_unset GIT_TRACE2_BRIEF
# Now test without environment variables and get all Trace2 settings