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>
This commit is contained in:
Jonathan Tan
2021-02-05 12:09:08 -08:00
committed by Junio C Hamano
parent 773e25afc4
commit 0a9dde4a04
3 changed files with 39 additions and 0 deletions

View File

@ -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 */