clone: send server options when using protocol v2
[gitweb.git] / t / helper / test-tool.c
index 6b5836dc1b93b85333f2acb9cf1717a4462e209c..99db7409b812898b461e75c8bd14e910f9e10e5c 100644 (file)
@@ -19,7 +19,9 @@ static struct test_cmd cmds[] = {
        { "dump-untracked-cache", cmd__dump_untracked_cache },
        { "example-decorate", cmd__example_decorate },
        { "genrandom", cmd__genrandom },
+       { "genzeros", cmd__genzeros },
        { "hashmap", cmd__hashmap },
+       { "hash-speed", cmd__hash_speed },
        { "index-version", cmd__index_version },
        { "json-writer", cmd__json_writer },
        { "lazy-init-name-hash", cmd__lazy_init_name_hash },
@@ -42,12 +44,15 @@ static struct test_cmd cmds[] = {
        { "scrap-cache-tree", cmd__scrap_cache_tree },
        { "sha1", cmd__sha1 },
        { "sha1-array", cmd__sha1_array },
+       { "sha256", cmd__sha256 },
        { "sigchain", cmd__sigchain },
        { "strcmp-offset", cmd__strcmp_offset },
        { "string-list", cmd__string_list },
        { "submodule-config", cmd__submodule_config },
+       { "submodule-nested-repo-config", cmd__submodule_nested_repo_config },
        { "subprocess", cmd__subprocess },
        { "urlmatch-normalization", cmd__urlmatch_normalization },
+       { "xml-encode", cmd__xml_encode },
        { "wildmatch", cmd__wildmatch },
 #ifdef GIT_WINDOWS_NATIVE
        { "windows-named-pipe", cmd__windows_named_pipe },
@@ -55,13 +60,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 +85,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();
 }