Subject: [PATCH 19/36] t/helper: merge test-online-cpus into test-tool

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Sat, 17 Mar 2018 08:54:04 +0100

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 Makefile                                | 2 +-
 t/helper/test-online-cpus.c             | 3 ++-
 t/helper/test-tool.c                    | 1 +
 t/helper/test-tool.h                    | 1 +
 t/t3008-ls-files-lazy-init-name-hash.sh | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 3145a9b1b2..91af906d08 100644
--- a/Makefile
+++ b/Makefile
@@ -668,13 +668,13 @@ TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
 TEST_BUILTINS_OBJS += test-match-trees.o
 TEST_BUILTINS_OBJS += test-mergesort.o
 TEST_BUILTINS_OBJS += test-mktemp.o
+TEST_BUILTINS_OBJS += test-online-cpus.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-line-buffer
-TEST_PROGRAMS_NEED_X += test-online-cpus
 TEST_PROGRAMS_NEED_X += test-parse-options
 TEST_PROGRAMS_NEED_X += test-path-utils
 TEST_PROGRAMS_NEED_X += test-prio-queue
diff --git a/t/helper/test-online-cpus.c b/t/helper/test-online-cpus.c
index 06c09c6b88..5899e3098f 100644
--- a/t/helper/test-online-cpus.c
+++ b/t/helper/test-online-cpus.c
@@ -1,7 +1,8 @@
+#include "test-tool.h"
 #include "git-compat-util.h"
 #include "thread-utils.h"
 
-int cmd_main(int argc, const char **argv)
+int test_online_cpus(int argc, const char **argv)
 {
 	printf("%d\n", online_cpus());
 	return 0;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 4a563e08c3..29b04dd103 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -23,6 +23,7 @@ static struct test_cmd cmds[] = {
 	{ "match-trees", test_match_trees },
 	{ "mergesort", test_mergesort },
 	{ "mktemp", test_mktemp },
+	{ "online-cpus", test_online_cpus },
 	{ "sha1", test_sha1 },
 };
 
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 5bbe3e96cf..b7dafee709 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -17,6 +17,7 @@ int test_lazy_init_name_hash(int argc, const char **argv);
 int test_match_trees(int argc, const char **argv);
 int test_mergesort(int argc, const char **argv);
 int test_mktemp(int argc, const char **argv);
+int test_online_cpus(int argc, const char **argv);
 int test_sha1(int argc, const char **argv);
 
 #endif
diff --git a/t/t3008-ls-files-lazy-init-name-hash.sh b/t/t3008-ls-files-lazy-init-name-hash.sh
index 8df4aa7c99..08af596ba6 100755
--- a/t/t3008-ls-files-lazy-init-name-hash.sh
+++ b/t/t3008-ls-files-lazy-init-name-hash.sh
@@ -4,7 +4,7 @@ test_description='Test the lazy init name hash with various folder structures'
 
 . ./test-lib.sh
 
-if test 1 -eq $($GIT_BUILD_DIR/t/helper/test-online-cpus)
+if test 1 -eq $($GIT_BUILD_DIR/t/helper/test-tool online-cpus)
 then
 	skip_all='skipping lazy-init tests, single cpu'
 	test_done
-- 
2.16.2.903.gd04caf5039