Skip to content

Commit c680668

Browse files
pcloudsgitster
authored andcommitted
t/helper: merge test-genrandom into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dbceb3e commit c680668

22 files changed

+38
-35
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,13 +661,13 @@ TEST_BUILTINS_OBJS += test-drop-caches.o
661661
TEST_BUILTINS_OBJS += test-dump-cache-tree.o
662662
TEST_BUILTINS_OBJS += test-dump-split-index.o
663663
TEST_BUILTINS_OBJS += test-example-decorate.o
664+
TEST_BUILTINS_OBJS += test-genrandom.o
664665
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
665666
TEST_BUILTINS_OBJS += test-sha1.o
666667

667668
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
668669
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
669670
TEST_PROGRAMS_NEED_X += test-fake-ssh
670-
TEST_PROGRAMS_NEED_X += test-genrandom
671671
TEST_PROGRAMS_NEED_X += test-hashmap
672672
TEST_PROGRAMS_NEED_X += test-index-version
673673
TEST_PROGRAMS_NEED_X += test-line-buffer

t/helper/test-genrandom.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
* Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2.
55
*/
66

7+
#include "test-tool.h"
78
#include "git-compat-util.h"
89

9-
int cmd_main(int argc, const char **argv)
10+
int cmd__genrandom(int argc, const char **argv)
1011
{
1112
unsigned long count, next = 0;
1213
unsigned char *c;

t/helper/test-tool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ static struct test_cmd cmds[] = {
1616
{ "dump-cache-tree", cmd__dump_cache_tree },
1717
{ "dump-split-index", cmd__dump_split_index },
1818
{ "example-decorate", cmd__example_decorate },
19+
{ "genrandom", cmd__genrandom },
1920
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
2021
{ "sha1", cmd__sha1 },
2122
};

t/helper/test-tool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ int cmd__drop_caches(int argc, const char **argv);
1010
int cmd__dump_cache_tree(int argc, const char **argv);
1111
int cmd__dump_split_index(int argc, const char **argv);
1212
int cmd__example_decorate(int argc, const char **argv);
13+
int cmd__genrandom(int argc, const char **argv);
1314
int cmd__lazy_init_name_hash(int argc, const char **argv);
1415
int cmd__sha1(int argc, const char **argv);
1516

t/t0005-signals.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ large_git () {
3636
}
3737

3838
test_expect_success 'create blob' '
39-
test-genrandom foo 16384 >file &&
39+
test-tool genrandom foo 16384 >file &&
4040
git add file
4141
'
4242

t/t0021-conversion.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ write_script rot13-filter.pl "$PERL_PATH" \
1919
generate_random_characters () {
2020
LEN=$1
2121
NAME=$2
22-
test-genrandom some-seed $LEN |
22+
test-tool genrandom some-seed $LEN |
2323
perl -pe "s/./chr((ord($&) % 26) + ord('a'))/sge" >"$TEST_ROOT/$NAME"
2424
}
2525

@@ -267,7 +267,7 @@ test_expect_success 'filtering large input to small output should use little mem
267267
'
268268

269269
test_expect_success 'filter that does not read is fine' '
270-
test-genrandom foo $((128 * 1024 + 1)) >big &&
270+
test-tool genrandom foo $((128 * 1024 + 1)) >big &&
271271
echo "big filter=epipe" >.gitattributes &&
272272
test_config filter.epipe.clean "echo xyzzy" &&
273273
git add big &&

t/t1006-cat-file.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ test_expect_success "--batch-check with multiple sha1s gives correct format" '
282282
'
283283

284284
test_expect_success 'setup blobs which are likely to delta' '
285-
test-genrandom foo 10240 >foo &&
285+
test-tool genrandom foo 10240 >foo &&
286286
{ cat foo; echo plus; } >foo-plus &&
287287
git add foo foo-plus &&
288288
git commit -m foo &&

t/t1050-large.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ test_expect_success 'packsize limit' '
103103
# mid1 and mid2 will fit within 256k limit but
104104
# appending mid3 will bust the limit and will
105105
# result in a separate packfile.
106-
test-genrandom "a" $(( 66 * 1024 )) >mid1 &&
107-
test-genrandom "b" $(( 80 * 1024 )) >mid2 &&
108-
test-genrandom "c" $(( 128 * 1024 )) >mid3 &&
106+
test-tool genrandom "a" $(( 66 * 1024 )) >mid1 &&
107+
test-tool genrandom "b" $(( 80 * 1024 )) >mid2 &&
108+
test-tool genrandom "c" $(( 128 * 1024 )) >mid3 &&
109109
git add mid1 mid2 mid3 &&
110110
111111
count=0

t/t5000-tar-tree.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ test_expect_success \
101101
ten=0123456789 && hundred=$ten$ten$ten$ten$ten$ten$ten$ten$ten$ten &&
102102
echo long filename >a/four$hundred &&
103103
mkdir a/bin &&
104-
test-genrandom "frotz" 500000 >a/bin/sh &&
104+
test-tool genrandom "frotz" 500000 >a/bin/sh &&
105105
printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 &&
106106
printf "A not substituted O" >a/substfile2 &&
107107
if test_have_prereq SYMLINKS; then

t/t5300-pack-object.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ test_expect_success \
1616
perl -e "print \"a\" x 4096;" > a &&
1717
perl -e "print \"b\" x 4096;" > b &&
1818
perl -e "print \"c\" x 4096;" > c &&
19-
test-genrandom "seed a" 2097152 > a_big &&
20-
test-genrandom "seed b" 2097152 > b_big &&
19+
test-tool genrandom "seed a" 2097152 > a_big &&
20+
test-tool genrandom "seed b" 2097152 > b_big &&
2121
git update-index --add a a_big b b_big c &&
2222
cat c >d && echo foo >>d && git update-index --add d &&
2323
tree=$(git write-tree) &&

0 commit comments

Comments
 (0)