Skip to content

Commit e6e7530

Browse files
pcloudsgitster
authored andcommitted
test helpers: move test-* to t/helper/ subdirectory
This keeps top dir a bit less crowded. And because these programs are for testing purposes, it makes sense that they stay somewhere in t/ Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7897d84 commit e6e7530

39 files changed

+50
-50
lines changed

.gitignore

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -179,39 +179,6 @@
179179
/gitweb/gitweb.cgi
180180
/gitweb/static/gitweb.js
181181
/gitweb/static/gitweb.min.*
182-
/test-chmtime
183-
/test-ctype
184-
/test-config
185-
/test-date
186-
/test-delta
187-
/test-dump-cache-tree
188-
/test-dump-split-index
189-
/test-dump-untracked-cache
190-
/test-fake-ssh
191-
/test-scrap-cache-tree
192-
/test-genrandom
193-
/test-hashmap
194-
/test-index-version
195-
/test-line-buffer
196-
/test-match-trees
197-
/test-mergesort
198-
/test-mktemp
199-
/test-parse-options
200-
/test-path-utils
201-
/test-prio-queue
202-
/test-read-cache
203-
/test-regex
204-
/test-revision-walking
205-
/test-run-command
206-
/test-sha1
207-
/test-sha1-array
208-
/test-sigchain
209-
/test-string-list
210-
/test-submodule-config
211-
/test-subprocess
212-
/test-svn-fe
213-
/test-urlmatch-normalization
214-
/test-wildmatch
215182
/common-cmds.h
216183
*.tar.gz
217184
*.dsc

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ TEST_PROGRAMS_NEED_X += test-svn-fe
624624
TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
625625
TEST_PROGRAMS_NEED_X += test-wildmatch
626626

627-
TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
627+
TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
628628

629629
# List built-in command $C whose implementation cmd_$C() is not in
630630
# builtin/$C.o but is linked in as part of some other command.
@@ -1904,7 +1904,7 @@ VCSSVN_OBJS += vcs-svn/fast_export.o
19041904
VCSSVN_OBJS += vcs-svn/svndiff.o
19051905
VCSSVN_OBJS += vcs-svn/svndump.o
19061906

1907-
TEST_OBJS := $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
1907+
TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS))
19081908
OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
19091909
$(XDIFF_OBJS) \
19101910
$(VCSSVN_OBJS) \
@@ -2211,7 +2211,7 @@ bin-wrappers/%: wrap-for-bin.sh
22112211
@mkdir -p bin-wrappers
22122212
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
22132213
-e 's|@@BUILD_DIR@@|$(shell pwd)|' \
2214-
-e 's|@@PROG@@|$(@F)|' < $< > $@ && \
2214+
-e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
22152215
chmod +x $@
22162216

22172217
# GNU make supports exporting all variables by "export" without parameters.
@@ -2231,25 +2231,25 @@ perf: all
22312231

22322232
.PHONY: test perf
22332233

2234-
test-ctype$X: ctype.o
2234+
t/helper/test-ctype$X: ctype.o
22352235

2236-
test-date$X: date.o ctype.o
2236+
t/helper/test-date$X: date.o ctype.o
22372237

2238-
test-delta$X: diff-delta.o patch-delta.o
2238+
t/helper/test-delta$X: diff-delta.o patch-delta.o
22392239

2240-
test-line-buffer$X: vcs-svn/lib.a
2240+
t/helper/test-line-buffer$X: vcs-svn/lib.a
22412241

2242-
test-parse-options$X: parse-options.o parse-options-cb.o
2242+
t/helper/test-parse-options$X: parse-options.o parse-options-cb.o
22432243

2244-
test-svn-fe$X: vcs-svn/lib.a
2244+
t/helper/test-svn-fe$X: vcs-svn/lib.a
22452245

22462246
.PRECIOUS: $(TEST_OBJS)
22472247

2248-
test-%$X: test-%.o GIT-LDFLAGS $(GITLIBS)
2248+
t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
22492249
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(filter %.a,$^) $(LIBS)
22502250

2251-
check-sha1:: test-sha1$X
2252-
./test-sha1.sh
2251+
check-sha1:: t/helper/test-sha1$X
2252+
t/helper/test-sha1.sh
22532253

22542254
SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
22552255

t/helper/.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/test-chmtime
2+
/test-ctype
3+
/test-config
4+
/test-date
5+
/test-delta
6+
/test-dump-cache-tree
7+
/test-dump-split-index
8+
/test-dump-untracked-cache
9+
/test-fake-ssh
10+
/test-scrap-cache-tree
11+
/test-genrandom
12+
/test-hashmap
13+
/test-index-version
14+
/test-line-buffer
15+
/test-match-trees
16+
/test-mergesort
17+
/test-mktemp
18+
/test-parse-options
19+
/test-path-utils
20+
/test-prio-queue
21+
/test-read-cache
22+
/test-regex
23+
/test-revision-walking
24+
/test-run-command
25+
/test-sha1
26+
/test-sha1-array
27+
/test-sigchain
28+
/test-string-list
29+
/test-submodule-config
30+
/test-subprocess
31+
/test-svn-fe
32+
/test-urlmatch-normalization
33+
/test-wildmatch
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test-sha1.sh renamed to t/helper/test-sha1.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
dd if=/dev/zero bs=1048576 count=100 2>/dev/null |
4-
/usr/bin/time ./test-sha1 >/dev/null
4+
/usr/bin/time t/helper/test-sha1 >/dev/null
55

66
while read expect cnt pfx
77
do
@@ -11,7 +11,7 @@ do
1111
test -z "$pfx" || echo "$pfx"
1212
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
1313
perl -pe 'y/\000/g/'
14-
} | ./test-sha1 $cnt
14+
} | ./t/helper/test-sha1 $cnt
1515
)
1616
if test "$expect" = "$actual"
1717
then
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

t/t5601-clone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ test_expect_success 'clone checking out a tag' '
308308

309309
setup_ssh_wrapper () {
310310
test_expect_success 'setup ssh wrapper' '
311-
cp "$GIT_BUILD_DIR/test-fake-ssh$X" \
311+
cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" \
312312
"$TRASH_DIRECTORY/ssh-wrapper$X" &&
313313
GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper$X" &&
314314
export GIT_SSH &&

t/test-lib.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,10 +854,10 @@ test -d "$GIT_BUILD_DIR"/templates/blt || {
854854
error "You haven't built things yet, have you?"
855855
}
856856

857-
if ! test -x "$GIT_BUILD_DIR"/test-chmtime
857+
if ! test -x "$GIT_BUILD_DIR"/t/helper/test-chmtime
858858
then
859859
echo >&2 'You need to build test-chmtime:'
860-
echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
860+
echo >&2 'Run "make t/helper/test-chmtime" in the source (toplevel) directory'
861861
exit 1
862862
fi
863863

0 commit comments

Comments
 (0)