t/helper: merge test-mktemp into test-tool

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Mar 24, 2018 at 08:44 UTC d9cc2c87805dfde54a37c0bb33fdfa19122312b4
5 files changed +7 -4
Makefile
+1 -1
@@ -667,13 +667,13 @@ TEST_BUILTINS_OBJS += test-index-version.o
667 TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
668 TEST_BUILTINS_OBJS += test-match-trees.o
669 TEST_BUILTINS_OBJS += test-mergesort.o
670 +TEST_BUILTINS_OBJS += test-mktemp.o
671 TEST_BUILTINS_OBJS += test-sha1.o
672
673 TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
674 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
675 TEST_PROGRAMS_NEED_X += test-fake-ssh
676 TEST_PROGRAMS_NEED_X += test-line-buffer
676 -TEST_PROGRAMS_NEED_X += test-mktemp
677 TEST_PROGRAMS_NEED_X += test-online-cpus
678 TEST_PROGRAMS_NEED_X += test-parse-options
679 TEST_PROGRAMS_NEED_X += test-path-utils
t/helper/test-mktemp.c
+2 -1
@@ -1,9 +1,10 @@
1 /*
2 * test-mktemp.c: code to exercise the creation of temporary files
3 */
4 +#include "test-tool.h"
5 #include "git-compat-util.h"
6
6 -int cmd_main(int argc, const char **argv)
7 +int cmd__mktemp(int argc, const char **argv)
8 {
9 if (argc != 2)
10 usage("Expected 1 parameter defining the temporary file template");
t/helper/test-tool.c
+1
@@ -22,6 +22,7 @@ static struct test_cmd cmds[] = {
22 { "lazy-init-name-hash", cmd__lazy_init_name_hash },
23 { "match-trees", cmd__match_trees },
24 { "mergesort", cmd__mergesort },
25 + { "mktemp", cmd__mktemp },
26 { "sha1", cmd__sha1 },
27 };
28
t/helper/test-tool.h
+1
@@ -16,6 +16,7 @@ int cmd__index_version(int argc, const char **argv);
16 int cmd__lazy_init_name_hash(int argc, const char **argv);
17 int cmd__match_trees(int argc, const char **argv);
18 int cmd__mergesort(int argc, const char **argv);
19 +int cmd__mktemp(int argc, const char **argv);
20 int cmd__sha1(int argc, const char **argv);
21
22 #endif
t/t0070-fundamental.sh
+2 -2
@@ -13,7 +13,7 @@ test_expect_success 'character classes (isspace, isalpha etc.)' '
13 '
14
15 test_expect_success 'mktemp to nonexistent directory prints filename' '
16 - test_must_fail test-mktemp doesnotexist/testXXXXXX 2>err &&
16 + test_must_fail test-tool mktemp doesnotexist/testXXXXXX 2>err &&
17 grep "doesnotexist/test" err
18 '
19
@@ -21,7 +21,7 @@ test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints file
21 mkdir cannotwrite &&
22 chmod -w cannotwrite &&
23 test_when_finished "chmod +w cannotwrite" &&
24 - test_must_fail test-mktemp cannotwrite/testXXXXXX 2>err &&
24 + test_must_fail test-tool mktemp cannotwrite/testXXXXXX 2>err &&
25 grep "cannotwrite/test" err
26 '
27