diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2021-02-05 12:09:08 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-09 14:14:34 -0800 |
commit | 0a9dde4a04c1228025d292f44113cb8f9cebbfba (patch) | |
tree | 02ff80ac0ecd56c9f9d9a7f28e606bdef4a358f8 /t/helper | |
parent | Git 2.30.1 (diff) | |
download | tgif-0a9dde4a04c1228025d292f44113cb8f9cebbfba.tar.xz |
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/helper')
-rw-r--r-- | t/helper/test-trace2.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c index 823f33ceff..f93633f895 100644 --- a/t/helper/test-trace2.c +++ b/t/helper/test-trace2.c @@ -198,6 +198,14 @@ static int ut_006data(int argc, const char **argv) return 0; } +static int ut_007bug(int argc, const char **argv) +{ + /* + * Exercise BUG() to ensure that the message is printed to trace2. + */ + BUG("the bug message"); +} + /* * Usage: * test-tool trace2 <ut_name_1> <ut_usage_1> @@ -214,6 +222,7 @@ static struct unit_test ut_table[] = { { ut_004child, "004child", "[<child_command_line>]" }, { ut_005exec, "005exec", "<git_command_args>" }, { ut_006data, "006data", "[<category> <key> <value>]+" }, + { ut_007bug, "007bug", "" }, }; /* clang-format on */ |