2018-03-24 10:44:30 +03:00
|
|
|
#include "git-compat-util.h"
|
|
|
|
#include "test-tool.h"
|
|
|
|
|
|
|
|
struct test_cmd {
|
|
|
|
const char *name;
|
|
|
|
int (*fn)(int argc, const char **argv);
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct test_cmd cmds[] = {
|
2018-03-24 10:44:31 +03:00
|
|
|
{ "chmtime", cmd__chmtime },
|
2018-03-24 10:44:34 +03:00
|
|
|
{ "config", cmd__config },
|
2018-03-24 10:44:35 +03:00
|
|
|
{ "ctype", cmd__ctype },
|
2018-03-24 10:44:36 +03:00
|
|
|
{ "date", cmd__date },
|
2018-03-24 10:44:37 +03:00
|
|
|
{ "delta", cmd__delta },
|
2018-03-24 10:44:38 +03:00
|
|
|
{ "drop-caches", cmd__drop_caches },
|
2018-03-24 10:44:39 +03:00
|
|
|
{ "dump-cache-tree", cmd__dump_cache_tree },
|
2018-03-24 10:44:40 +03:00
|
|
|
{ "dump-split-index", cmd__dump_split_index },
|
2018-03-24 10:44:41 +03:00
|
|
|
{ "example-decorate", cmd__example_decorate },
|
2018-03-24 10:44:42 +03:00
|
|
|
{ "genrandom", cmd__genrandom },
|
2018-03-24 10:44:43 +03:00
|
|
|
{ "hashmap", cmd__hashmap },
|
2018-03-24 10:44:44 +03:00
|
|
|
{ "index-version", cmd__index_version },
|
2018-03-24 10:44:33 +03:00
|
|
|
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
|
2018-03-24 10:44:45 +03:00
|
|
|
{ "match-trees", cmd__match_trees },
|
2018-03-24 10:44:46 +03:00
|
|
|
{ "mergesort", cmd__mergesort },
|
2018-03-24 10:44:47 +03:00
|
|
|
{ "mktemp", cmd__mktemp },
|
2018-03-24 10:44:48 +03:00
|
|
|
{ "online-cpus", cmd__online_cpus },
|
2018-03-24 10:44:32 +03:00
|
|
|
{ "sha1", cmd__sha1 },
|
2018-03-24 10:44:30 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
int cmd_main(int argc, const char **argv)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (argc < 2)
|
|
|
|
die("I need a test name!");
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
|
|
|
if (!strcmp(cmds[i].name, argv[1])) {
|
|
|
|
argv++;
|
|
|
|
argc--;
|
|
|
|
return cmds[i].fn(argc, argv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
die("There is no test named '%s'", argv[1]);
|
|
|
|
}
|