]>
Commit | Line | Data |
---|---|---|
efd71f89 NTND |
1 | #include "git-compat-util.h" |
2 | #include "test-tool.h" | |
3 | ||
4 | struct test_cmd { | |
5 | const char *name; | |
6 | int (*fn)(int argc, const char **argv); | |
7 | }; | |
8 | ||
9 | static struct test_cmd cmds[] = { | |
0e496492 | 10 | { "chmtime", cmd__chmtime }, |
0e2678af | 11 | { "config", cmd__config }, |
e4998944 | 12 | { "ctype", cmd__ctype }, |
a801a7cf | 13 | { "date", cmd__date }, |
9153dde5 | 14 | { "delta", cmd__delta }, |
1c854745 | 15 | { "drop-caches", cmd__drop_caches }, |
06ccb29e | 16 | { "dump-cache-tree", cmd__dump_cache_tree }, |
8133061e | 17 | { "dump-split-index", cmd__dump_split_index }, |
cd780f0b | 18 | { "dump-untracked-cache", cmd__dump_untracked_cache }, |
dbceb3ec | 19 | { "example-decorate", cmd__example_decorate }, |
c680668d | 20 | { "genrandom", cmd__genrandom }, |
7c18cbd5 | 21 | { "hashmap", cmd__hashmap }, |
cc6f663d | 22 | { "index-version", cmd__index_version }, |
75459410 | 23 | { "json-writer", cmd__json_writer }, |
64eb82fe | 24 | { "lazy-init-name-hash", cmd__lazy_init_name_hash }, |
9080e75f | 25 | { "match-trees", cmd__match_trees }, |
34889d3c | 26 | { "mergesort", cmd__mergesort }, |
d9cc2c87 | 27 | { "mktemp", cmd__mktemp }, |
c033cc15 | 28 | { "online-cpus", cmd__online_cpus }, |
2f17c78c | 29 | { "parse-options", cmd__parse_options }, |
b8d5cf4f | 30 | { "path-utils", cmd__path_utils }, |
8ea40cc5 | 31 | { "pkt-line", cmd__pkt_line }, |
15b75817 | 32 | { "prio-queue", cmd__prio_queue }, |
5fbe600c | 33 | { "read-cache", cmd__read_cache }, |
65370d81 | 34 | { "ref-store", cmd__ref_store }, |
9038531f | 35 | { "regex", cmd__regex }, |
dade47c0 | 36 | { "repository", cmd__repository }, |
77d4b8c8 | 37 | { "revision-walking", cmd__revision_walking }, |
ae6a51f5 | 38 | { "run-command", cmd__run_command }, |
ff5fb8b0 | 39 | { "scrap-cache-tree", cmd__scrap_cache_tree }, |
dae2ff9b | 40 | { "sha1", cmd__sha1 }, |
a0fe6e6e | 41 | { "sha1-array", cmd__sha1_array }, |
e154a6f3 | 42 | { "sigchain", cmd__sigchain }, |
1a5f3d70 | 43 | { "strcmp-offset", cmd__strcmp_offset }, |
c932a5ff | 44 | { "string-list", cmd__string_list }, |
b6188213 | 45 | { "submodule-config", cmd__submodule_config }, |
112edd6a | 46 | { "subprocess", cmd__subprocess }, |
599fbd87 | 47 | { "urlmatch-normalization", cmd__urlmatch_normalization }, |
0489289d | 48 | { "wildmatch", cmd__wildmatch }, |
c81f843d | 49 | { "write-cache", cmd__write_cache }, |
efd71f89 NTND |
50 | }; |
51 | ||
52 | int cmd_main(int argc, const char **argv) | |
53 | { | |
54 | int i; | |
55 | ||
a86303cb | 56 | BUG_exit_code = 99; |
efd71f89 NTND |
57 | if (argc < 2) |
58 | die("I need a test name!"); | |
59 | ||
60 | for (i = 0; i < ARRAY_SIZE(cmds); i++) { | |
61 | if (!strcmp(cmds[i].name, argv[1])) { | |
62 | argv++; | |
63 | argc--; | |
64 | return cmds[i].fn(argc, argv); | |
65 | } | |
66 | } | |
67 | die("There is no test named '%s'", argv[1]); | |
68 | } |