diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2021-02-05 23:09:08 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-10 01:14:34 +0300 |
commit | 0a9dde4a04c1228025d292f44113cb8f9cebbfba (patch) | |
tree | 02ff80ac0ecd56c9f9d9a7f28e606bdef4a358f8 /t/helper | |
parent | 773e25afc41b1b6533fa9ae2cd825d0b4a697fad (diff) |
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 */ |