Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 Makefile                | 2 +-
 t/helper/test-hashmap.c | 5 +++--
 t/helper/test-tool.c    | 1 +
 t/helper/test-tool.h    | 1 +
 t/t0011-hashmap.sh      | 4 ++--
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index d0bc6cfecf..f6c3ddc703 100644
--- a/Makefile
+++ b/Makefile
@@ -662,13 +662,13 @@ TEST_BUILTINS_OBJS += test-dump-cache-tree.o
 TEST_BUILTINS_OBJS += test-dump-split-index.o
 TEST_BUILTINS_OBJS += test-example-decorate.o
 TEST_BUILTINS_OBJS += test-genrandom.o
+TEST_BUILTINS_OBJS += test-hashmap.o
 TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-sha1.o
 
 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
 TEST_PROGRAMS_NEED_X += test-fake-ssh
-TEST_PROGRAMS_NEED_X += test-hashmap
 TEST_PROGRAMS_NEED_X += test-index-version
 TEST_PROGRAMS_NEED_X += test-line-buffer
 TEST_PROGRAMS_NEED_X += test-match-trees
diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c
index 9ae9281c07..6fc840ff72 100644
--- a/t/helper/test-hashmap.c
+++ b/t/helper/test-hashmap.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "hashmap.h"
 #include "strbuf.h"
@@ -77,7 +78,7 @@ static unsigned int hash(unsigned int method, unsigned int i, 
const char *key)
 
 /*
  * Test performance of hashmap.[ch]
- * Usage: time echo "perfhashmap method rounds" | test-hashmap
+ * Usage: time echo "perfhashmap method rounds" | test-tool hashmap
  */
 static void perf_hashmap(unsigned int method, unsigned int rounds)
 {
@@ -144,7 +145,7 @@ static void perf_hashmap(unsigned int method, unsigned int 
rounds)
  *
  * perfhashmap method rounds -> test hashmap.[ch] performance
  */
-int cmd_main(int argc, const char **argv)
+int test_hashmap(int argc, const char **argv)
 {
        struct strbuf line = STRBUF_INIT;
        struct hashmap map;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index ce13108374..924d8c80f7 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -17,6 +17,7 @@ static struct test_cmd cmds[] = {
        { "dump-split-index", test_dump_split_index },
        { "example-decorate", test_example_decorate },
        { "genrandom", test_genrandom },
+       { "hashmap", test_hashmap },
        { "lazy-init-name-hash", test_lazy_init_name_hash },
        { "sha1", test_sha1 },
 };
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 6742558cb4..161f5becb7 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -11,6 +11,7 @@ int test_dump_cache_tree(int argc, const char **argv);
 int test_dump_split_index(int argc, const char **argv);
 int test_example_decorate(int argc, const char **argv);
 int test_genrandom(int argc, const char **argv);
+int test_hashmap(int argc, const char **argv);
 int test_lazy_init_name_hash(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
diff --git a/t/t0011-hashmap.sh b/t/t0011-hashmap.sh
index 9c217d948c..3f1f505e89 100755
--- a/t/t0011-hashmap.sh
+++ b/t/t0011-hashmap.sh
@@ -4,7 +4,7 @@ test_description='test hashmap and string hash functions'
 . ./test-lib.sh
 
 test_hashmap() {
-       echo "$1" | test-hashmap $3 > actual &&
+       echo "$1" | test-tool hashmap $3 > actual &&
        echo "$2" > expect &&
        test_cmp expect actual
 }
@@ -232,7 +232,7 @@ test_expect_success 'grow / shrink' '
        echo value40 >> expect &&
        echo size >> in &&
        echo 64 39 >> expect &&
-       cat in | test-hashmap > out &&
+       cat in | test-tool hashmap > out &&
        test_cmp expect out
 
 '
-- 
2.16.2.903.gd04caf5039

Reply via email to