summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-03-24 07:44:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-27 15:45:13 (GMT)
commitefd71f8913a876a0c333fa29382530d6abbc6164 (patch)
tree033f6092946e9ac07a056cdab50301afcac5c0c1 /t
parent90bbd502d54fe920356fa9278055dc9c9bfe9a56 (diff)
downloadgit-efd71f8913a876a0c333fa29382530d6abbc6164.zip
git-efd71f8913a876a0c333fa29382530d6abbc6164.tar.gz
git-efd71f8913a876a0c333fa29382530d6abbc6164.tar.bz2
t/helper: add an empty test-tool program
This will become an umbrella program that absorbs most [1] t/helper programs in. By having a single executable binary we reduce disk usage (libgit.a is replicated by every t/helper program) and shorten link time a bit. Running "make --jobs=1; du -sh t/helper" with ccache fully populated, it takes 27 seconds and 277MB at the beginning of this series, 17 seconds and 42MB at the end. [1] There are a couple programs that will not become part of test-tool: test-line-buffer and test-svn-fe have extra dependencies and test-fake-ssh's program name has to be a single word for some ssh tests. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rw-r--r--t/helper/test-tool.c27
-rw-r--r--t/helper/test-tool.h4
2 files changed, 31 insertions, 0 deletions
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
new file mode 100644
index 0000000..da1dd66
--- /dev/null
+++ b/t/helper/test-tool.c
@@ -0,0 +1,27 @@
+#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[] = {
+};
+
+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]);
+}
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
new file mode 100644
index 0000000..6ce57ae
--- /dev/null
+++ b/t/helper/test-tool.h
@@ -0,0 +1,4 @@
+#ifndef __TEST_TOOL_H__
+#define __TEST_TOOL_H__
+
+#endif