diff options
| author | Junio C Hamano <gitster@pobox.com> | 2018-10-30 15:43:44 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-10-30 15:43:44 +0900 |
| commit | 11914675aac58770a879bff2dfd7b874adbbb4ff (patch) | |
| tree | cd3f1c6e6e8ba828a5ed536da989d7e0b33f7665 /t/helper | |
| parent | 4b73fdae975b4a0c1d70666c7a170e08a60fdfa1 (diff) | |
| parent | 4e26569d9870e61c95c6ce79c6d556358b9da433 (diff) | |
| download | git-11914675aac58770a879bff2dfd7b874adbbb4ff.tar.gz | |
Merge branch 'jk/test-tool-help'
Developer support.
* jk/test-tool-help:
test-tool: show tool list on error
Diffstat (limited to 't/helper')
| -rw-r--r-- | t/helper/test-tool.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index 6b5836dc1b..5df8b682aa 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -55,13 +55,23 @@ static struct test_cmd cmds[] = { { "write-cache", cmd__write_cache }, }; +static NORETURN void die_usage(void) +{ + size_t i; + + fprintf(stderr, "usage: test-tool <toolname> [args]\n"); + for (i = 0; i < ARRAY_SIZE(cmds); i++) + fprintf(stderr, " %s\n", cmds[i].name); + exit(128); +} + int cmd_main(int argc, const char **argv) { int i; BUG_exit_code = 99; if (argc < 2) - die("I need a test name!"); + die_usage(); for (i = 0; i < ARRAY_SIZE(cmds); i++) { if (!strcmp(cmds[i].name, argv[1])) { @@ -70,5 +80,6 @@ int cmd_main(int argc, const char **argv) return cmds[i].fn(argc, argv); } } - die("There is no test named '%s'", argv[1]); + error("there is no tool named '%s'", argv[1]); + die_usage(); } |
