summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-03-24 08:44:32 +0100
committerJunio C Hamano <gitster@pobox.com>2018-03-27 17:45:47 +0200
commitdae2ff9bb6112bbac0a9bee1e524ae0b3ad316fb (patch)
treefff3b2b32e69a82d1ef76f1a68da3c8ca77af2df /t
parentt/helper: merge test-chmtime into test-tool (diff)
downloadgit-dae2ff9bb6112bbac0a9bee1e524ae0b3ad316fb.tar.xz
git-dae2ff9bb6112bbac0a9bee1e524ae0b3ad316fb.zip
t/helper: merge test-sha1 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>
Diffstat (limited to 't')
-rw-r--r--t/helper/test-sha1.c3
-rwxr-xr-xt/helper/test-sha1.sh4
-rw-r--r--t/helper/test-tool.c1
-rw-r--r--t/helper/test-tool.h1
-rw-r--r--t/lib-pack.sh2
-rwxr-xr-xt/t0013-sha1dc.sh2
6 files changed, 8 insertions, 5 deletions
diff --git a/t/helper/test-sha1.c b/t/helper/test-sha1.c
index a1c13f54ec..1ba0675c75 100644
--- a/t/helper/test-sha1.c
+++ b/t/helper/test-sha1.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
#include "cache.h"
-int cmd_main(int ac, const char **av)
+int cmd__sha1(int ac, const char **av)
{
git_SHA_CTX ctx;
unsigned char sha1[20];
diff --git a/t/helper/test-sha1.sh b/t/helper/test-sha1.sh
index 750b95a0a1..84594885c7 100755
--- a/t/helper/test-sha1.sh
+++ b/t/helper/test-sha1.sh
@@ -1,7 +1,7 @@
#!/bin/sh
dd if=/dev/zero bs=1048576 count=100 2>/dev/null |
-/usr/bin/time t/helper/test-sha1 >/dev/null
+/usr/bin/time t/helper/test-tool sha1 >/dev/null
while read expect cnt pfx
do
@@ -11,7 +11,7 @@ do
test -z "$pfx" || echo "$pfx"
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
perl -pe 'y/\000/g/'
- } | ./t/helper/test-sha1 $cnt
+ } | ./t/helper/test-tool sha1 $cnt
)
if test "$expect" = "$actual"
then
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index 0b1abe1ea2..11795130a6 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -8,6 +8,7 @@ struct test_cmd {
static struct test_cmd cmds[] = {
{ "chmtime", cmd__chmtime },
+ { "sha1", cmd__sha1 },
};
int cmd_main(int argc, const char **argv)
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 3a35e70e79..a05b8bd14c 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -2,5 +2,6 @@
#define __TEST_TOOL_H__
int cmd__chmtime(int argc, const char **argv);
+int cmd__sha1(int argc, const char **argv);
#endif
diff --git a/t/lib-pack.sh b/t/lib-pack.sh
index 7509846571..501078249d 100644
--- a/t/lib-pack.sh
+++ b/t/lib-pack.sh
@@ -85,7 +85,7 @@ pack_obj () {
# Compute and append pack trailer to "$1"
pack_trailer () {
- test-sha1 -b <"$1" >trailer.tmp &&
+ test-tool sha1 -b <"$1" >trailer.tmp &&
cat trailer.tmp >>"$1" &&
rm -f trailer.tmp
}
diff --git a/t/t0013-sha1dc.sh b/t/t0013-sha1dc.sh
index 6d655cb161..419f31a8f7 100755
--- a/t/t0013-sha1dc.sh
+++ b/t/t0013-sha1dc.sh
@@ -11,7 +11,7 @@ then
fi
test_expect_success 'test-sha1 detects shattered pdf' '
- test_must_fail test-sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
+ test_must_fail test-tool sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
test_i18ngrep collision err &&
grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
'