Skip to content

Commit

Permalink
test helpers: move test-* to t/helper/ subdirectory
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pclouds authored and gitster committed Apr 15, 2016
1 parent 7897d84 commit e6e7530
Show file tree
Hide file tree
Showing 39 changed files with 50 additions and 50 deletions.
33 changes: 0 additions & 33 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,39 +179,6 @@
/gitweb/gitweb.cgi
/gitweb/static/gitweb.js
/gitweb/static/gitweb.min.*
/test-chmtime
/test-ctype
/test-config
/test-date
/test-delta
/test-dump-cache-tree
/test-dump-split-index
/test-dump-untracked-cache
/test-fake-ssh
/test-scrap-cache-tree
/test-genrandom
/test-hashmap
/test-index-version
/test-line-buffer
/test-match-trees
/test-mergesort
/test-mktemp
/test-parse-options
/test-path-utils
/test-prio-queue
/test-read-cache
/test-regex
/test-revision-walking
/test-run-command
/test-sha1
/test-sha1-array
/test-sigchain
/test-string-list
/test-submodule-config
/test-subprocess
/test-svn-fe
/test-urlmatch-normalization
/test-wildmatch
/common-cmds.h
*.tar.gz
*.dsc
Expand Down
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ TEST_PROGRAMS_NEED_X += test-svn-fe
TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
TEST_PROGRAMS_NEED_X += test-wildmatch

TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))

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

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

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

.PHONY: test perf

test-ctype$X: ctype.o
t/helper/test-ctype$X: ctype.o

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

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

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

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

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

.PRECIOUS: $(TEST_OBJS)

test-%$X: test-%.o GIT-LDFLAGS $(GITLIBS)
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:: test-sha1$X
./test-sha1.sh
check-sha1:: t/helper/test-sha1$X
t/helper/test-sha1.sh

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

Expand Down
33 changes: 33 additions & 0 deletions t/helper/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/test-chmtime
/test-ctype
/test-config
/test-date
/test-delta
/test-dump-cache-tree
/test-dump-split-index
/test-dump-untracked-cache
/test-fake-ssh
/test-scrap-cache-tree
/test-genrandom
/test-hashmap
/test-index-version
/test-line-buffer
/test-match-trees
/test-mergesort
/test-mktemp
/test-parse-options
/test-path-utils
/test-prio-queue
/test-read-cache
/test-regex
/test-revision-walking
/test-run-command
/test-sha1
/test-sha1-array
/test-sigchain
/test-string-list
/test-submodule-config
/test-subprocess
/test-svn-fe
/test-urlmatch-normalization
/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.
4 changes: 2 additions & 2 deletions test-sha1.sh → t/helper/test-sha1.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

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

while read expect cnt pfx
do
Expand All @@ -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/'
} | ./test-sha1 $cnt
} | ./t/helper/test-sha1 $cnt
)
if test "$expect" = "$actual"
then
Expand Down
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.
2 changes: 1 addition & 1 deletion t/t5601-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ test_expect_success 'clone checking out a tag' '

setup_ssh_wrapper () {
test_expect_success 'setup ssh wrapper' '
cp "$GIT_BUILD_DIR/test-fake-ssh$X" \
cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" \
"$TRASH_DIRECTORY/ssh-wrapper$X" &&
GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper$X" &&
export GIT_SSH &&
Expand Down
4 changes: 2 additions & 2 deletions t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -854,10 +854,10 @@ test -d "$GIT_BUILD_DIR"/templates/blt || {
error "You haven't built things yet, have you?"
}

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

Expand Down

0 comments on commit e6e7530

Please sign in to comment.