mirror of
https://github.com/git/git.git
synced 2024-11-18 22:23:55 +01:00
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>
This commit is contained in:
parent
0e496492d2
commit
dae2ff9bb6
@ -80,7 +80,7 @@ valid pack like:
|
||||
# now add our object data
|
||||
cat object >>tmp.pack
|
||||
# and then append the pack trailer
|
||||
/path/to/git.git/test-sha1 -b <tmp.pack >trailer
|
||||
/path/to/git.git/t/helper/test-tool sha1 -b <tmp.pack >trailer
|
||||
cat trailer >>tmp.pack
|
||||
------------
|
||||
|
||||
|
4
Makefile
4
Makefile
@ -653,6 +653,7 @@ X =
|
||||
PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
|
||||
|
||||
TEST_BUILTINS_OBJS += test-chmtime.o
|
||||
TEST_BUILTINS_OBJS += test-sha1.o
|
||||
|
||||
TEST_PROGRAMS_NEED_X += test-ctype
|
||||
TEST_PROGRAMS_NEED_X += test-config
|
||||
@ -684,7 +685,6 @@ TEST_PROGRAMS_NEED_X += test-regex
|
||||
TEST_PROGRAMS_NEED_X += test-revision-walking
|
||||
TEST_PROGRAMS_NEED_X += test-run-command
|
||||
TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
|
||||
TEST_PROGRAMS_NEED_X += test-sha1
|
||||
TEST_PROGRAMS_NEED_X += test-sha1-array
|
||||
TEST_PROGRAMS_NEED_X += test-sigchain
|
||||
TEST_PROGRAMS_NEED_X += test-strcmp-offset
|
||||
@ -2502,7 +2502,7 @@ t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
|
||||
t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
|
||||
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
|
||||
|
||||
check-sha1:: t/helper/test-sha1$X
|
||||
check-sha1:: t/helper/test-tool$X
|
||||
t/helper/test-sha1.sh
|
||||
|
||||
SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
'
|
||||
|
Loading…
Reference in New Issue
Block a user