Merge branch 'js/vsts-ci'
[gitweb.git] / t / helper / test-tool.c
index 6b5836dc1b93b85333f2acb9cf1717a4462e209c..50c55f8b1a3baf2df88214824b01fb707966ebc7 100644 (file)
@@ -20,6 +20,7 @@ static struct test_cmd cmds[] = {
        { "example-decorate", cmd__example_decorate },
        { "genrandom", cmd__genrandom },
        { "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 +43,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 +59,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 +84,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();
 }