All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Move test-* to t/helper/ subdirectory
@ 2016-04-13 13:22 Nguyễn Thái Ngọc Duy
  2016-04-15 15:09 ` Junio C Hamano
  2016-04-26 22:07 ` Junio C Hamano
  0 siblings, 2 replies; 17+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2016-04-13 13:22 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

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 <pclouds@gmail.com>
---
 This patch will break any patches that add new test programs.
 Luckily, none in 'next' or 'pu' does that. I know lmdb backend adds
 test-lmdb-backend, so a manual move and some .gitignore fixup is
 required there.

 .gitignore                                         | 33 ----------------------
 Makefile                                           | 24 ++++++++--------
 t/helper/.gitignore (new)                          | 33 ++++++++++++++++++++++
 test-chmtime.c => t/helper/test-chmtime.c          |  0
 test-config.c => t/helper/test-config.c            |  0
 test-ctype.c => t/helper/test-ctype.c              |  0
 test-date.c => t/helper/test-date.c                |  0
 test-delta.c => t/helper/test-delta.c              |  0
 .../helper/test-dump-cache-tree.c                  |  0
 .../helper/test-dump-split-index.c                 |  0
 .../helper/test-dump-untracked-cache.c             |  0
 test-fake-ssh.c => t/helper/test-fake-ssh.c        |  0
 test-genrandom.c => t/helper/test-genrandom.c      |  0
 test-hashmap.c => t/helper/test-hashmap.c          |  0
 .../helper/test-index-version.c                    |  0
 test-line-buffer.c => t/helper/test-line-buffer.c  |  0
 test-match-trees.c => t/helper/test-match-trees.c  |  0
 test-mergesort.c => t/helper/test-mergesort.c      |  0
 test-mktemp.c => t/helper/test-mktemp.c            |  0
 .../helper/test-parse-options.c                    |  0
 test-path-utils.c => t/helper/test-path-utils.c    |  0
 test-prio-queue.c => t/helper/test-prio-queue.c    |  0
 test-read-cache.c => t/helper/test-read-cache.c    |  0
 test-regex.c => t/helper/test-regex.c              |  0
 .../helper/test-revision-walking.c                 |  0
 test-run-command.c => t/helper/test-run-command.c  |  0
 .../helper/test-scrap-cache-tree.c                 |  0
 test-sha1-array.c => t/helper/test-sha1-array.c    |  0
 test-sha1.c => t/helper/test-sha1.c                |  0
 test-sha1.sh => t/helper/test-sha1.sh              |  4 +--
 test-sigchain.c => t/helper/test-sigchain.c        |  0
 test-string-list.c => t/helper/test-string-list.c  |  0
 .../helper/test-submodule-config.c                 |  0
 test-subprocess.c => t/helper/test-subprocess.c    |  0
 test-svn-fe.c => t/helper/test-svn-fe.c            |  0
 .../helper/test-urlmatch-normalization.c           |  0
 test-wildmatch.c => t/helper/test-wildmatch.c      |  0
 t/t5601-clone.sh                                   |  2 +-
 t/test-lib.sh                                      |  4 +--
 39 files changed, 50 insertions(+), 50 deletions(-)
 create mode 100644 t/helper/.gitignore
 rename test-chmtime.c => t/helper/test-chmtime.c (100%)
 rename test-config.c => t/helper/test-config.c (100%)
 rename test-ctype.c => t/helper/test-ctype.c (100%)
 rename test-date.c => t/helper/test-date.c (100%)
 rename test-delta.c => t/helper/test-delta.c (100%)
 rename test-dump-cache-tree.c => t/helper/test-dump-cache-tree.c (100%)
 rename test-dump-split-index.c => t/helper/test-dump-split-index.c (100%)
 rename test-dump-untracked-cache.c => t/helper/test-dump-untracked-cache.c (100%)
 rename test-fake-ssh.c => t/helper/test-fake-ssh.c (100%)
 rename test-genrandom.c => t/helper/test-genrandom.c (100%)
 rename test-hashmap.c => t/helper/test-hashmap.c (100%)
 rename test-index-version.c => t/helper/test-index-version.c (100%)
 rename test-line-buffer.c => t/helper/test-line-buffer.c (100%)
 rename test-match-trees.c => t/helper/test-match-trees.c (100%)
 rename test-mergesort.c => t/helper/test-mergesort.c (100%)
 rename test-mktemp.c => t/helper/test-mktemp.c (100%)
 rename test-parse-options.c => t/helper/test-parse-options.c (100%)
 rename test-path-utils.c => t/helper/test-path-utils.c (100%)
 rename test-prio-queue.c => t/helper/test-prio-queue.c (100%)
 rename test-read-cache.c => t/helper/test-read-cache.c (100%)
 rename test-regex.c => t/helper/test-regex.c (100%)
 rename test-revision-walking.c => t/helper/test-revision-walking.c (100%)
 rename test-run-command.c => t/helper/test-run-command.c (100%)
 rename test-scrap-cache-tree.c => t/helper/test-scrap-cache-tree.c (100%)
 rename test-sha1-array.c => t/helper/test-sha1-array.c (100%)
 rename test-sha1.c => t/helper/test-sha1.c (100%)
 rename test-sha1.sh => t/helper/test-sha1.sh (96%)
 rename test-sigchain.c => t/helper/test-sigchain.c (100%)
 rename test-string-list.c => t/helper/test-string-list.c (100%)
 rename test-submodule-config.c => t/helper/test-submodule-config.c (100%)
 rename test-subprocess.c => t/helper/test-subprocess.c (100%)
 rename test-svn-fe.c => t/helper/test-svn-fe.c (100%)
 rename test-urlmatch-normalization.c => t/helper/test-urlmatch-normalization.c (100%)
 rename test-wildmatch.c => t/helper/test-wildmatch.c (100%)

diff --git a/.gitignore b/.gitignore
index 5087ce1..05cb58a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/Makefile b/Makefile
index 2742a69..0a5fb9d 100644
--- a/Makefile
+++ b/Makefile
@@ -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.
@@ -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) \
@@ -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.
@@ -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))
 
diff --git a/t/helper/.gitignore b/t/helper/.gitignore
new file mode 100644
index 0000000..d6e8b36
--- /dev/null
+++ b/t/helper/.gitignore
@@ -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
diff --git a/test-chmtime.c b/t/helper/test-chmtime.c
similarity index 100%
rename from test-chmtime.c
rename to t/helper/test-chmtime.c
diff --git a/test-config.c b/t/helper/test-config.c
similarity index 100%
rename from test-config.c
rename to t/helper/test-config.c
diff --git a/test-ctype.c b/t/helper/test-ctype.c
similarity index 100%
rename from test-ctype.c
rename to t/helper/test-ctype.c
diff --git a/test-date.c b/t/helper/test-date.c
similarity index 100%
rename from test-date.c
rename to t/helper/test-date.c
diff --git a/test-delta.c b/t/helper/test-delta.c
similarity index 100%
rename from test-delta.c
rename to t/helper/test-delta.c
diff --git a/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c
similarity index 100%
rename from test-dump-cache-tree.c
rename to t/helper/test-dump-cache-tree.c
diff --git a/test-dump-split-index.c b/t/helper/test-dump-split-index.c
similarity index 100%
rename from test-dump-split-index.c
rename to t/helper/test-dump-split-index.c
diff --git a/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
similarity index 100%
rename from test-dump-untracked-cache.c
rename to t/helper/test-dump-untracked-cache.c
diff --git a/test-fake-ssh.c b/t/helper/test-fake-ssh.c
similarity index 100%
rename from test-fake-ssh.c
rename to t/helper/test-fake-ssh.c
diff --git a/test-genrandom.c b/t/helper/test-genrandom.c
similarity index 100%
rename from test-genrandom.c
rename to t/helper/test-genrandom.c
diff --git a/test-hashmap.c b/t/helper/test-hashmap.c
similarity index 100%
rename from test-hashmap.c
rename to t/helper/test-hashmap.c
diff --git a/test-index-version.c b/t/helper/test-index-version.c
similarity index 100%
rename from test-index-version.c
rename to t/helper/test-index-version.c
diff --git a/test-line-buffer.c b/t/helper/test-line-buffer.c
similarity index 100%
rename from test-line-buffer.c
rename to t/helper/test-line-buffer.c
diff --git a/test-match-trees.c b/t/helper/test-match-trees.c
similarity index 100%
rename from test-match-trees.c
rename to t/helper/test-match-trees.c
diff --git a/test-mergesort.c b/t/helper/test-mergesort.c
similarity index 100%
rename from test-mergesort.c
rename to t/helper/test-mergesort.c
diff --git a/test-mktemp.c b/t/helper/test-mktemp.c
similarity index 100%
rename from test-mktemp.c
rename to t/helper/test-mktemp.c
diff --git a/test-parse-options.c b/t/helper/test-parse-options.c
similarity index 100%
rename from test-parse-options.c
rename to t/helper/test-parse-options.c
diff --git a/test-path-utils.c b/t/helper/test-path-utils.c
similarity index 100%
rename from test-path-utils.c
rename to t/helper/test-path-utils.c
diff --git a/test-prio-queue.c b/t/helper/test-prio-queue.c
similarity index 100%
rename from test-prio-queue.c
rename to t/helper/test-prio-queue.c
diff --git a/test-read-cache.c b/t/helper/test-read-cache.c
similarity index 100%
rename from test-read-cache.c
rename to t/helper/test-read-cache.c
diff --git a/test-regex.c b/t/helper/test-regex.c
similarity index 100%
rename from test-regex.c
rename to t/helper/test-regex.c
diff --git a/test-revision-walking.c b/t/helper/test-revision-walking.c
similarity index 100%
rename from test-revision-walking.c
rename to t/helper/test-revision-walking.c
diff --git a/test-run-command.c b/t/helper/test-run-command.c
similarity index 100%
rename from test-run-command.c
rename to t/helper/test-run-command.c
diff --git a/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c
similarity index 100%
rename from test-scrap-cache-tree.c
rename to t/helper/test-scrap-cache-tree.c
diff --git a/test-sha1-array.c b/t/helper/test-sha1-array.c
similarity index 100%
rename from test-sha1-array.c
rename to t/helper/test-sha1-array.c
diff --git a/test-sha1.c b/t/helper/test-sha1.c
similarity index 100%
rename from test-sha1.c
rename to t/helper/test-sha1.c
diff --git a/test-sha1.sh b/t/helper/test-sha1.sh
similarity index 96%
rename from test-sha1.sh
rename to t/helper/test-sha1.sh
index cef4bcc..750b95a 100755
--- a/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 ./test-sha1 >/dev/null
+/usr/bin/time t/helper/test-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/'
-		} | ./test-sha1 $cnt
+		} | ./t/helper/test-sha1 $cnt
 	)
 	if test "$expect" = "$actual"
 	then
diff --git a/test-sigchain.c b/t/helper/test-sigchain.c
similarity index 100%
rename from test-sigchain.c
rename to t/helper/test-sigchain.c
diff --git a/test-string-list.c b/t/helper/test-string-list.c
similarity index 100%
rename from test-string-list.c
rename to t/helper/test-string-list.c
diff --git a/test-submodule-config.c b/t/helper/test-submodule-config.c
similarity index 100%
rename from test-submodule-config.c
rename to t/helper/test-submodule-config.c
diff --git a/test-subprocess.c b/t/helper/test-subprocess.c
similarity index 100%
rename from test-subprocess.c
rename to t/helper/test-subprocess.c
diff --git a/test-svn-fe.c b/t/helper/test-svn-fe.c
similarity index 100%
rename from test-svn-fe.c
rename to t/helper/test-svn-fe.c
diff --git a/test-urlmatch-normalization.c b/t/helper/test-urlmatch-normalization.c
similarity index 100%
rename from test-urlmatch-normalization.c
rename to t/helper/test-urlmatch-normalization.c
diff --git a/test-wildmatch.c b/t/helper/test-wildmatch.c
similarity index 100%
rename from test-wildmatch.c
rename to t/helper/test-wildmatch.c
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index c1efb8e..150aeaf 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -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 &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0b47eb6..cd0ecd4 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -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
 
-- 
2.8.0.rc0.210.gd302cd2

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-04-13 13:22 [PATCH] Move test-* to t/helper/ subdirectory Nguyễn Thái Ngọc Duy
@ 2016-04-15 15:09 ` Junio C Hamano
  2016-04-15 17:06   ` Junio C Hamano
  2016-04-26 22:07 ` Junio C Hamano
  1 sibling, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2016-04-15 15:09 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

> 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/

But leaves many *.o files after "make clean".  Even "distclean" does
not clean them.

>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  This patch will break any patches that add new test programs.
>  Luckily, none in 'next' or 'pu' does that. I know lmdb backend adds
>  test-lmdb-backend, so a manual move and some .gitignore fixup is
>  required there.
>
>  .gitignore                                         | 33 ----------------------
>  Makefile                                           | 24 ++++++++--------
>  t/helper/.gitignore (new)                          | 33 ++++++++++++++++++++++
>  test-chmtime.c => t/helper/test-chmtime.c          |  0
>  test-config.c => t/helper/test-config.c            |  0
>  test-ctype.c => t/helper/test-ctype.c              |  0
>  test-date.c => t/helper/test-date.c                |  0
>  test-delta.c => t/helper/test-delta.c              |  0
>  .../helper/test-dump-cache-tree.c                  |  0
>  .../helper/test-dump-split-index.c                 |  0
>  .../helper/test-dump-untracked-cache.c             |  0
>  test-fake-ssh.c => t/helper/test-fake-ssh.c        |  0
>  test-genrandom.c => t/helper/test-genrandom.c      |  0
>  test-hashmap.c => t/helper/test-hashmap.c          |  0
>  .../helper/test-index-version.c                    |  0
>  test-line-buffer.c => t/helper/test-line-buffer.c  |  0
>  test-match-trees.c => t/helper/test-match-trees.c  |  0
>  test-mergesort.c => t/helper/test-mergesort.c      |  0
>  test-mktemp.c => t/helper/test-mktemp.c            |  0
>  .../helper/test-parse-options.c                    |  0
>  test-path-utils.c => t/helper/test-path-utils.c    |  0
>  test-prio-queue.c => t/helper/test-prio-queue.c    |  0
>  test-read-cache.c => t/helper/test-read-cache.c    |  0
>  test-regex.c => t/helper/test-regex.c              |  0
>  .../helper/test-revision-walking.c                 |  0
>  test-run-command.c => t/helper/test-run-command.c  |  0
>  .../helper/test-scrap-cache-tree.c                 |  0
>  test-sha1-array.c => t/helper/test-sha1-array.c    |  0
>  test-sha1.c => t/helper/test-sha1.c                |  0
>  test-sha1.sh => t/helper/test-sha1.sh              |  4 +--
>  test-sigchain.c => t/helper/test-sigchain.c        |  0
>  test-string-list.c => t/helper/test-string-list.c  |  0
>  .../helper/test-submodule-config.c                 |  0
>  test-subprocess.c => t/helper/test-subprocess.c    |  0
>  test-svn-fe.c => t/helper/test-svn-fe.c            |  0
>  .../helper/test-urlmatch-normalization.c           |  0
>  test-wildmatch.c => t/helper/test-wildmatch.c      |  0
>  t/t5601-clone.sh                                   |  2 +-
>  t/test-lib.sh                                      |  4 +--
>  39 files changed, 50 insertions(+), 50 deletions(-)
>  create mode 100644 t/helper/.gitignore
>  rename test-chmtime.c => t/helper/test-chmtime.c (100%)
>  rename test-config.c => t/helper/test-config.c (100%)
>  rename test-ctype.c => t/helper/test-ctype.c (100%)
>  rename test-date.c => t/helper/test-date.c (100%)
>  rename test-delta.c => t/helper/test-delta.c (100%)
>  rename test-dump-cache-tree.c => t/helper/test-dump-cache-tree.c (100%)
>  rename test-dump-split-index.c => t/helper/test-dump-split-index.c (100%)
>  rename test-dump-untracked-cache.c => t/helper/test-dump-untracked-cache.c (100%)
>  rename test-fake-ssh.c => t/helper/test-fake-ssh.c (100%)
>  rename test-genrandom.c => t/helper/test-genrandom.c (100%)
>  rename test-hashmap.c => t/helper/test-hashmap.c (100%)
>  rename test-index-version.c => t/helper/test-index-version.c (100%)
>  rename test-line-buffer.c => t/helper/test-line-buffer.c (100%)
>  rename test-match-trees.c => t/helper/test-match-trees.c (100%)
>  rename test-mergesort.c => t/helper/test-mergesort.c (100%)
>  rename test-mktemp.c => t/helper/test-mktemp.c (100%)
>  rename test-parse-options.c => t/helper/test-parse-options.c (100%)
>  rename test-path-utils.c => t/helper/test-path-utils.c (100%)
>  rename test-prio-queue.c => t/helper/test-prio-queue.c (100%)
>  rename test-read-cache.c => t/helper/test-read-cache.c (100%)
>  rename test-regex.c => t/helper/test-regex.c (100%)
>  rename test-revision-walking.c => t/helper/test-revision-walking.c (100%)
>  rename test-run-command.c => t/helper/test-run-command.c (100%)
>  rename test-scrap-cache-tree.c => t/helper/test-scrap-cache-tree.c (100%)
>  rename test-sha1-array.c => t/helper/test-sha1-array.c (100%)
>  rename test-sha1.c => t/helper/test-sha1.c (100%)
>  rename test-sha1.sh => t/helper/test-sha1.sh (96%)
>  rename test-sigchain.c => t/helper/test-sigchain.c (100%)
>  rename test-string-list.c => t/helper/test-string-list.c (100%)
>  rename test-submodule-config.c => t/helper/test-submodule-config.c (100%)
>  rename test-subprocess.c => t/helper/test-subprocess.c (100%)
>  rename test-svn-fe.c => t/helper/test-svn-fe.c (100%)
>  rename test-urlmatch-normalization.c => t/helper/test-urlmatch-normalization.c (100%)
>  rename test-wildmatch.c => t/helper/test-wildmatch.c (100%)
>
> diff --git a/.gitignore b/.gitignore
> index 5087ce1..05cb58a 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -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
> diff --git a/Makefile b/Makefile
> index 2742a69..0a5fb9d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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.
> @@ -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) \
> @@ -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.
> @@ -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))
>  
> diff --git a/t/helper/.gitignore b/t/helper/.gitignore
> new file mode 100644
> index 0000000..d6e8b36
> --- /dev/null
> +++ b/t/helper/.gitignore
> @@ -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
> diff --git a/test-chmtime.c b/t/helper/test-chmtime.c
> similarity index 100%
> rename from test-chmtime.c
> rename to t/helper/test-chmtime.c
> diff --git a/test-config.c b/t/helper/test-config.c
> similarity index 100%
> rename from test-config.c
> rename to t/helper/test-config.c
> diff --git a/test-ctype.c b/t/helper/test-ctype.c
> similarity index 100%
> rename from test-ctype.c
> rename to t/helper/test-ctype.c
> diff --git a/test-date.c b/t/helper/test-date.c
> similarity index 100%
> rename from test-date.c
> rename to t/helper/test-date.c
> diff --git a/test-delta.c b/t/helper/test-delta.c
> similarity index 100%
> rename from test-delta.c
> rename to t/helper/test-delta.c
> diff --git a/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c
> similarity index 100%
> rename from test-dump-cache-tree.c
> rename to t/helper/test-dump-cache-tree.c
> diff --git a/test-dump-split-index.c b/t/helper/test-dump-split-index.c
> similarity index 100%
> rename from test-dump-split-index.c
> rename to t/helper/test-dump-split-index.c
> diff --git a/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
> similarity index 100%
> rename from test-dump-untracked-cache.c
> rename to t/helper/test-dump-untracked-cache.c
> diff --git a/test-fake-ssh.c b/t/helper/test-fake-ssh.c
> similarity index 100%
> rename from test-fake-ssh.c
> rename to t/helper/test-fake-ssh.c
> diff --git a/test-genrandom.c b/t/helper/test-genrandom.c
> similarity index 100%
> rename from test-genrandom.c
> rename to t/helper/test-genrandom.c
> diff --git a/test-hashmap.c b/t/helper/test-hashmap.c
> similarity index 100%
> rename from test-hashmap.c
> rename to t/helper/test-hashmap.c
> diff --git a/test-index-version.c b/t/helper/test-index-version.c
> similarity index 100%
> rename from test-index-version.c
> rename to t/helper/test-index-version.c
> diff --git a/test-line-buffer.c b/t/helper/test-line-buffer.c
> similarity index 100%
> rename from test-line-buffer.c
> rename to t/helper/test-line-buffer.c
> diff --git a/test-match-trees.c b/t/helper/test-match-trees.c
> similarity index 100%
> rename from test-match-trees.c
> rename to t/helper/test-match-trees.c
> diff --git a/test-mergesort.c b/t/helper/test-mergesort.c
> similarity index 100%
> rename from test-mergesort.c
> rename to t/helper/test-mergesort.c
> diff --git a/test-mktemp.c b/t/helper/test-mktemp.c
> similarity index 100%
> rename from test-mktemp.c
> rename to t/helper/test-mktemp.c
> diff --git a/test-parse-options.c b/t/helper/test-parse-options.c
> similarity index 100%
> rename from test-parse-options.c
> rename to t/helper/test-parse-options.c
> diff --git a/test-path-utils.c b/t/helper/test-path-utils.c
> similarity index 100%
> rename from test-path-utils.c
> rename to t/helper/test-path-utils.c
> diff --git a/test-prio-queue.c b/t/helper/test-prio-queue.c
> similarity index 100%
> rename from test-prio-queue.c
> rename to t/helper/test-prio-queue.c
> diff --git a/test-read-cache.c b/t/helper/test-read-cache.c
> similarity index 100%
> rename from test-read-cache.c
> rename to t/helper/test-read-cache.c
> diff --git a/test-regex.c b/t/helper/test-regex.c
> similarity index 100%
> rename from test-regex.c
> rename to t/helper/test-regex.c
> diff --git a/test-revision-walking.c b/t/helper/test-revision-walking.c
> similarity index 100%
> rename from test-revision-walking.c
> rename to t/helper/test-revision-walking.c
> diff --git a/test-run-command.c b/t/helper/test-run-command.c
> similarity index 100%
> rename from test-run-command.c
> rename to t/helper/test-run-command.c
> diff --git a/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c
> similarity index 100%
> rename from test-scrap-cache-tree.c
> rename to t/helper/test-scrap-cache-tree.c
> diff --git a/test-sha1-array.c b/t/helper/test-sha1-array.c
> similarity index 100%
> rename from test-sha1-array.c
> rename to t/helper/test-sha1-array.c
> diff --git a/test-sha1.c b/t/helper/test-sha1.c
> similarity index 100%
> rename from test-sha1.c
> rename to t/helper/test-sha1.c
> diff --git a/test-sha1.sh b/t/helper/test-sha1.sh
> similarity index 96%
> rename from test-sha1.sh
> rename to t/helper/test-sha1.sh
> index cef4bcc..750b95a 100755
> --- a/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 ./test-sha1 >/dev/null
> +/usr/bin/time t/helper/test-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/'
> -		} | ./test-sha1 $cnt
> +		} | ./t/helper/test-sha1 $cnt
>  	)
>  	if test "$expect" = "$actual"
>  	then
> diff --git a/test-sigchain.c b/t/helper/test-sigchain.c
> similarity index 100%
> rename from test-sigchain.c
> rename to t/helper/test-sigchain.c
> diff --git a/test-string-list.c b/t/helper/test-string-list.c
> similarity index 100%
> rename from test-string-list.c
> rename to t/helper/test-string-list.c
> diff --git a/test-submodule-config.c b/t/helper/test-submodule-config.c
> similarity index 100%
> rename from test-submodule-config.c
> rename to t/helper/test-submodule-config.c
> diff --git a/test-subprocess.c b/t/helper/test-subprocess.c
> similarity index 100%
> rename from test-subprocess.c
> rename to t/helper/test-subprocess.c
> diff --git a/test-svn-fe.c b/t/helper/test-svn-fe.c
> similarity index 100%
> rename from test-svn-fe.c
> rename to t/helper/test-svn-fe.c
> diff --git a/test-urlmatch-normalization.c b/t/helper/test-urlmatch-normalization.c
> similarity index 100%
> rename from test-urlmatch-normalization.c
> rename to t/helper/test-urlmatch-normalization.c
> diff --git a/test-wildmatch.c b/t/helper/test-wildmatch.c
> similarity index 100%
> rename from test-wildmatch.c
> rename to t/helper/test-wildmatch.c
> diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
> index c1efb8e..150aeaf 100755
> --- a/t/t5601-clone.sh
> +++ b/t/t5601-clone.sh
> @@ -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 &&
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 0b47eb6..cd0ecd4 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-04-15 15:09 ` Junio C Hamano
@ 2016-04-15 17:06   ` Junio C Hamano
  2016-04-16  0:08     ` Duy Nguyen
  0 siblings, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2016-04-15 17:06 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git

Junio C Hamano <gitster@pobox.com> writes:

> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> 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/
>
> But leaves many *.o files after "make clean".  Even "distclean" does
> not clean them.

Perhaps something like this as a preparatory patch, to protect us
from future breakages similar to this change.

-- >8 --
Subject: Makefile: clean *.o files we create

The part that removes object files in the 'clean' target predates
various Makefile macros that list object files we create, and
instead removes the objects with shell glob, perpetually requiring
updates whenever a new location that builds object files is added.

Simplify the target by removing $(OBJECTS), which is supposed to
have all the objects we create during the build.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index fe0bf7d..69d32bf 100644
--- a/Makefile
+++ b/Makefile
@@ -2456,8 +2456,8 @@ profile-clean:
 	$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
 
 clean: profile-clean coverage-clean
-	$(RM) *.o *.res refs/*.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o
-	$(RM) xdiff/*.o vcs-svn/*.o ewah/*.o builtin/*.o
+	$(RM) *.res
+	$(RM) $(OBJECTS)
 	$(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
 	$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
 	$(RM) $(TEST_PROGRAMS) $(NO_INSTALL)

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-04-15 17:06   ` Junio C Hamano
@ 2016-04-16  0:08     ` Duy Nguyen
  0 siblings, 0 replies; 17+ messages in thread
From: Duy Nguyen @ 2016-04-16  0:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Sat, Apr 16, 2016 at 12:06 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>>
>>> 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/
>>
>> But leaves many *.o files after "make clean".  Even "distclean" does
>> not clean them.
>
> Perhaps something like this as a preparatory patch, to protect us
> from future breakages similar to this change.

Yes. Much better than adding t/helper/*.o there. Thanks.

>
> -- >8 --
> Subject: Makefile: clean *.o files we create
>
> The part that removes object files in the 'clean' target predates
> various Makefile macros that list object files we create, and
> instead removes the objects with shell glob, perpetually requiring
> updates whenever a new location that builds object files is added.
>
> Simplify the target by removing $(OBJECTS), which is supposed to
> have all the objects we create during the build.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index fe0bf7d..69d32bf 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2456,8 +2456,8 @@ profile-clean:
>         $(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
>
>  clean: profile-clean coverage-clean
> -       $(RM) *.o *.res refs/*.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o
> -       $(RM) xdiff/*.o vcs-svn/*.o ewah/*.o builtin/*.o
> +       $(RM) *.res
> +       $(RM) $(OBJECTS)
>         $(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
>         $(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
>         $(RM) $(TEST_PROGRAMS) $(NO_INSTALL)



-- 
Duy

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-04-13 13:22 [PATCH] Move test-* to t/helper/ subdirectory Nguyễn Thái Ngọc Duy
  2016-04-15 15:09 ` Junio C Hamano
@ 2016-04-26 22:07 ` Junio C Hamano
  2016-04-27  0:52   ` Duy Nguyen
  1 sibling, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2016-04-26 22:07 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

> 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 <pclouds@gmail.com>
> ---
>  This patch will break any patches that add new test programs.
>  Luckily, none in 'next' or 'pu' does that. I know lmdb backend adds
>  test-lmdb-backend, so a manual move and some .gitignore fixup is
>  required there.

Can you (or somebody else) double check that the resulting Makefile
gets the build dependencies and exec path right?

I am seeing occasional failure from t0040 when checking out between
master and pu, and between the branches test-parse-options do change
behaviour which explains the breakage.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-04-26 22:07 ` Junio C Hamano
@ 2016-04-27  0:52   ` Duy Nguyen
  2016-04-27 10:18     ` Duy Nguyen
  0 siblings, 1 reply; 17+ messages in thread
From: Duy Nguyen @ 2016-04-27  0:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Wed, Apr 27, 2016 at 5:07 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> 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 <pclouds@gmail.com>
>> ---
>>  This patch will break any patches that add new test programs.
>>  Luckily, none in 'next' or 'pu' does that. I know lmdb backend adds
>>  test-lmdb-backend, so a manual move and some .gitignore fixup is
>>  required there.
>
> Can you (or somebody else) double check that the resulting Makefile
> gets the build dependencies and exec path right?
>
> I am seeing occasional failure from t0040 when checking out between
> master and pu, and between the branches test-parse-options do change
> behaviour which explains the breakage.

I looked at "make -p" and saw nothing wrong with build rules. A bit
concerned about fa8fe28 (Makefile: do not allow gnu make to remove
test-*.o files - 2007-08-30) because make info pages say it could
leave probably broken .o files when make is interrupted. But that's
probably not it.

There is a problem moving between master and next/pu though.
bin-wrappers is not regenerated after the move so it could point to
the old binaries (in the other place). Not sure how to fix that
cleanly, will think of something, maybe, in about 8 hours.
-- 
Duy

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-04-27  0:52   ` Duy Nguyen
@ 2016-04-27 10:18     ` Duy Nguyen
  2016-04-27 16:15       ` Junio C Hamano
  0 siblings, 1 reply; 17+ messages in thread
From: Duy Nguyen @ 2016-04-27 10:18 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Wed, Apr 27, 2016 at 07:52:41AM +0700, Duy Nguyen wrote:
> > Can you (or somebody else) double check that the resulting Makefile
> > gets the build dependencies and exec path right?
> >
> > I am seeing occasional failure from t0040 when checking out between
> > master and pu, and between the branches test-parse-options do change
> > behaviour which explains the breakage.
> 
> There is a problem moving between master and next/pu though.
> bin-wrappers is not regenerated after the move so it could point to
> the old binaries (in the other place). Not sure how to fix that
> cleanly, will think of something, maybe, in about 8 hours.

This patch forces bin-wrappers regeneration every time a test program
is updated. A bit wasteful, but I don't see a better option (which is
also why I limit this to test programs only).

A similar patch (without "t/helper/") could be applied on
maint/master, otherwise bin-wrappers is still not updated when moving
back from next/pu. And of course the problem will pop up again if you
build old history...

-- 8< --
diff --git a/Makefile b/Makefile
index dd178ee..6b6a844 100644
--- a/Makefile
+++ b/Makefile
@@ -2196,10 +2196,13 @@ GIT-PYTHON-VARS: FORCE
 endif
 
 test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))
+bindir_test_programs := $(patsubst %,bin-wrappers/%,$(TEST_PROGRAMS_NEED_X))
 
 all:: $(TEST_PROGRAMS) $(test_bindir_programs)
 all:: $(NO_INSTALL)
 
+$(bindir_test_programs): bin-wrappers/%: t/helper/%$X
+
 bin-wrappers/%: wrap-for-bin.sh
 	@mkdir -p bin-wrappers
 	$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-- 8< --

-- 
Duy

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-04-27 10:18     ` Duy Nguyen
@ 2016-04-27 16:15       ` Junio C Hamano
  2016-05-01  0:28         ` Duy Nguyen
  0 siblings, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2016-04-27 16:15 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List

Duy Nguyen <pclouds@gmail.com> writes:

> This patch forces bin-wrappers regeneration every time a test program
> is updated. A bit wasteful, but I don't see a better option (which is
> also why I limit this to test programs only).

In other words, when we update the location where the programs that
would be eventually installed are created, we'd see the same
problem.

I actually wonder if it is a better overall structure to move
t/helper/test-foo back to test-foo, while keeping the source file
that contains main() for test-foo at t/helper/test-foo.c.  Then we
do not have to have many copies that are slightly different in
bin-wrappers, but they can all be

	exec "${GIT_EXEC_PATH}/$0" "$@"

instead of "bin-wrappers/git-bar" being

	exec "${GIT_EXEC_PATH}/git-bar" "$@"

and "bin-wrappers/test-foo" being

	exec "${GIT_EXEC_PATH}/t/helper/test-foo" "$@"

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-04-27 16:15       ` Junio C Hamano
@ 2016-05-01  0:28         ` Duy Nguyen
  2016-05-01  6:00           ` Duy Nguyen
  0 siblings, 1 reply; 17+ messages in thread
From: Duy Nguyen @ 2016-05-01  0:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Wed, Apr 27, 2016 at 09:15:41AM -0700, Junio C Hamano wrote:
> Duy Nguyen <pclouds@gmail.com> writes:
> 
> > This patch forces bin-wrappers regeneration every time a test program
> > is updated. A bit wasteful, but I don't see a better option (which is
> > also why I limit this to test programs only).
> 
> In other words, when we update the location where the programs that
> would be eventually installed are created, we'd see the same
> problem.
> 
> I actually wonder if it is a better overall structure to move
> t/helper/test-foo back to test-foo, while keeping the source file
> that contains main() for test-foo at t/helper/test-foo.c.  Then we
> do not have to have many copies that are slightly different in
> bin-wrappers, but they can all be
> 
> 	exec "${GIT_EXEC_PATH}/$0" "$@"
> 
> instead of "bin-wrappers/git-bar" being
> 
> 	exec "${GIT_EXEC_PATH}/git-bar" "$@"
> 
> and "bin-wrappers/test-foo" being
> 
> 	exec "${GIT_EXEC_PATH}/t/helper/test-foo" "$@"
> 

It's not a perfect solution (rebuild bin-wrappers when the real binary
moves) but I think it's the best option so far. We can move test-*
binaries back with this patch.

-- 8< --
diff --git a/.gitignore b/.gitignore
index 05cb58a..5087ce1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -179,6 +179,39 @@
 /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
diff --git a/Makefile b/Makefile
index dd178ee..7a1c973 100644
--- a/Makefile
+++ b/Makefile
@@ -620,7 +620,7 @@ TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
 TEST_PROGRAMS_NEED_X += test-wildmatch
 
-TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
+TEST_PROGRAMS = $(patsubst %,%$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.
@@ -1897,7 +1897,7 @@ VCSSVN_OBJS += vcs-svn/fast_export.o
 VCSSVN_OBJS += vcs-svn/svndiff.o
 VCSSVN_OBJS += vcs-svn/svndump.o
 
-TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS))
+TEST_OBJS := $(patsubst %,t/helper/%.o,$(TEST_PROGRAMS_NEED_X))
 OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
 	$(XDIFF_OBJS) \
 	$(VCSSVN_OBJS) \
@@ -2204,7 +2204,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@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
+	     -e 's|@@PROG@@|$(@F)|'< $< > $@ && \
 	chmod +x $@
 
 # GNU make supports exporting all variables by "export" without parameters.
@@ -2224,24 +2224,24 @@ perf: all
 
 .PHONY: test perf
 
-t/helper/test-ctype$X: ctype.o
+test-ctype$X: ctype.o
 
-t/helper/test-date$X: date.o ctype.o
+test-date$X: date.o ctype.o
 
-t/helper/test-delta$X: diff-delta.o patch-delta.o
+test-delta$X: diff-delta.o patch-delta.o
 
-t/helper/test-line-buffer$X: vcs-svn/lib.a
+test-line-buffer$X: vcs-svn/lib.a
 
-t/helper/test-parse-options$X: parse-options.o parse-options-cb.o
+test-parse-options$X: parse-options.o parse-options-cb.o
 
-t/helper/test-svn-fe$X: vcs-svn/lib.a
+test-svn-fe$X: vcs-svn/lib.a
 
 .PRECIOUS: $(TEST_OBJS)
 
-t/helper/test-%$X: t/helper/test-%.o GIT-LDFLAGS $(GITLIBS)
+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:: test-sha1$X
 	t/helper/test-sha1.sh
 
 SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))
diff --git a/t/helper/test-sha1.sh b/t/helper/test-sha1.sh
index 750b95a..cef4bcc 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 ./test-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
+		} | ./test-sha1 $cnt
 	)
 	if test "$expect" = "$actual"
 	then
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 150aeaf..c1efb8e 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -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/t/helper/test-fake-ssh$X" \
+		cp "$GIT_BUILD_DIR/test-fake-ssh$X" \
 			"$TRASH_DIRECTORY/ssh-wrapper$X" &&
 		GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper$X" &&
 		export GIT_SSH &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index cd0ecd4..0b47eb6 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -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"/t/helper/test-chmtime
+if ! test -x "$GIT_BUILD_DIR"/test-chmtime
 then
 	echo >&2 'You need to build test-chmtime:'
-	echo >&2 'Run "make t/helper/test-chmtime" in the source (toplevel) directory'
+	echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
 	exit 1
 fi
-- 8< --
 

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-05-01  0:28         ` Duy Nguyen
@ 2016-05-01  6:00           ` Duy Nguyen
  2016-05-02 17:34             ` Junio C Hamano
  0 siblings, 1 reply; 17+ messages in thread
From: Duy Nguyen @ 2016-05-01  6:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Sun, May 01, 2016 at 07:28:52AM +0700, Duy Nguyen wrote:
> On Wed, Apr 27, 2016 at 09:15:41AM -0700, Junio C Hamano wrote:
> > Duy Nguyen <pclouds@gmail.com> writes:
> > 
> > > This patch forces bin-wrappers regeneration every time a test program
> > > is updated. A bit wasteful, but I don't see a better option (which is
> > > also why I limit this to test programs only).
> > 
> > In other words, when we update the location where the programs that
> > would be eventually installed are created, we'd see the same
> > problem.
> > 
> > I actually wonder if it is a better overall structure to move
> > t/helper/test-foo back to test-foo, while keeping the source file
> > that contains main() for test-foo at t/helper/test-foo.c.  Then we
> > do not have to have many copies that are slightly different in
> > bin-wrappers, but they can all be
> > 
> > 	exec "${GIT_EXEC_PATH}/$0" "$@"
> > 
> > instead of "bin-wrappers/git-bar" being
> > 
> > 	exec "${GIT_EXEC_PATH}/git-bar" "$@"
> > 
> > and "bin-wrappers/test-foo" being
> > 
> > 	exec "${GIT_EXEC_PATH}/t/helper/test-foo" "$@"
> > 
> 
> It's not a perfect solution (rebuild bin-wrappers when the real binary
> moves) but I think it's the best option so far.

I may have rushed to judgement. wrap-for-bin.sh has always been the
dependency for bin-wrappers/*. If we force that file to change, then
bin-wrappers/* will be recreated when switching branches. So how about
this?

-- 8< --
Subject: [PATCH] wrap-for-bin.sh: handle t/helper/ paths internally

Commit e6e7530 (test helpers: move test-* to t/helper/ subdirectory -
2016-04-13) moves test-* to t/helper. However because bin-wrappers/*
only depend on wrap-for-bin.sh, when switching between a branch that has
this commit and one that does not, bin-wrappers/* may not be regenerated
and point to the old/outdated test programs. Fix it by force updating
wrap-for-bin.sh so that it will be regenerated anyway.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Makefile        |  2 +-
 wrap-for-bin.sh | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index dd178ee..38dcdf7 100644
--- a/Makefile
+++ b/Makefile
@@ -2204,7 +2204,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@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
+	     -e 's|@@PROG@@|$(@F)|' < $< > $@ && \
 	chmod +x $@
 
 # GNU make supports exporting all variables by "export" without parameters.
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index db0ec6a..bb334ed 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -18,11 +18,19 @@ GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
 GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
 export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+case "@@PATH@@" in
+    test-*)
+	PROG="${GIT_EXEC_PATH}/t/helper/@@PROG@@"
+	;;
+    *)
+	PROG="${GIT_EXEC_PATH}/@@PROG@@"
+	;;
+esac
 
 if test -n "$GIT_TEST_GDB"
 then
 	unset GIT_TEST_GDB
-	exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+	exec gdb --args "$PROG" "$@"
 else
-	exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+	exec "$PROG" "$@"
 fi
-- 
2.8.0.rc0.210.gd302cd2
-- 8< --

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-05-01  6:00           ` Duy Nguyen
@ 2016-05-02 17:34             ` Junio C Hamano
  2016-05-03  0:15               ` Duy Nguyen
  0 siblings, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2016-05-02 17:34 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List

Duy Nguyen <pclouds@gmail.com> writes:

> I may have rushed to judgement. wrap-for-bin.sh has always been the
> dependency for bin-wrappers/*. If we force that file to change, then
> bin-wrappers/* will be recreated when switching branches. So how about
> this?

I do not think you are "force updating wrap-for-bin" in any way in
the patch, though.  You are building it in such a way that it does
not have to get updated within the revision that contains e6e7530
(assuming that this will be queued directly on top it and merged to
everywhere e6e7530 is contained).

The new case/esac looks somewhat bad (its knowing that where test-*
lives, test-* is the only thing that is special, etc. troubles me at
the same time that case/esac is funnily formated).

Where does "@@PATH@@" come from and who rewrites it?  Is that a
misspelt "@@PROG@@"?

> -- 8< --
> Subject: [PATCH] wrap-for-bin.sh: handle t/helper/ paths internally
>
> Commit e6e7530 (test helpers: move test-* to t/helper/ subdirectory -
> 2016-04-13) moves test-* to t/helper. However because bin-wrappers/*
> only depend on wrap-for-bin.sh, when switching between a branch that has
> this commit and one that does not, bin-wrappers/* may not be regenerated
> and point to the old/outdated test programs. Fix it by force updating
> wrap-for-bin.sh so that it will be regenerated anyway.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  Makefile        |  2 +-
>  wrap-for-bin.sh | 12 ++++++++++--
>  2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index dd178ee..38dcdf7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2204,7 +2204,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@@|$(patsubst test-%,t/helper/test-%,$(@F))|' < $< > $@ && \
> +	     -e 's|@@PROG@@|$(@F)|' < $< > $@ && \
>  	chmod +x $@
>  
>  # GNU make supports exporting all variables by "export" without parameters.
> diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
> index db0ec6a..bb334ed 100644
> --- a/wrap-for-bin.sh
> +++ b/wrap-for-bin.sh
> @@ -18,11 +18,19 @@ GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
>  GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
>  PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
>  export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
> +case "@@PATH@@" in
> +    test-*)
> +	PROG="${GIT_EXEC_PATH}/t/helper/@@PROG@@"
> +	;;
> +    *)
> +	PROG="${GIT_EXEC_PATH}/@@PROG@@"
> +	;;
> +esac
>  
>  if test -n "$GIT_TEST_GDB"
>  then
>  	unset GIT_TEST_GDB
> -	exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
> +	exec gdb --args "$PROG" "$@"
>  else
> -	exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
> +	exec "$PROG" "$@"
>  fi

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-05-02 17:34             ` Junio C Hamano
@ 2016-05-03  0:15               ` Duy Nguyen
  2016-05-08  9:51                 ` Duy Nguyen
  0 siblings, 1 reply; 17+ messages in thread
From: Duy Nguyen @ 2016-05-03  0:15 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Tue, May 3, 2016 at 12:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Duy Nguyen <pclouds@gmail.com> writes:
>
>> I may have rushed to judgement. wrap-for-bin.sh has always been the
>> dependency for bin-wrappers/*. If we force that file to change, then
>> bin-wrappers/* will be recreated when switching branches. So how about
>> this?
>
> I do not think you are "force updating wrap-for-bin" in any way in
> the patch, though.  You are building it in such a way that it does
> not have to get updated within the revision that contains e6e7530
> (assuming that this will be queued directly on top it and merged to
> everywhere e6e7530 is contained).

Yep.

> The new case/esac looks somewhat bad (its knowing that where test-*
> lives, test-* is the only thing that is special, etc. troubles me at
> the same time that case/esac is funnily formated).

We could just make some random changes in this file. That would have
the same effect.

> Where does "@@PATH@@" come from and who rewrites it?  Is that a
> misspelt "@@PROG@@"?

Yep. Should have run make distclean before testing :(
-- 
Duy

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-05-03  0:15               ` Duy Nguyen
@ 2016-05-08  9:51                 ` Duy Nguyen
  2016-05-09 16:03                   ` Junio C Hamano
  0 siblings, 1 reply; 17+ messages in thread
From: Duy Nguyen @ 2016-05-08  9:51 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

So among the options we have so far, which way should we go, or leave it as is?

On Tue, May 3, 2016 at 7:15 AM, Duy Nguyen <pclouds@gmail.com> wrote:
> On Tue, May 3, 2016 at 12:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Duy Nguyen <pclouds@gmail.com> writes:
>>
>>> I may have rushed to judgement. wrap-for-bin.sh has always been the
>>> dependency for bin-wrappers/*. If we force that file to change, then
>>> bin-wrappers/* will be recreated when switching branches. So how about
>>> this?
>>
>> I do not think you are "force updating wrap-for-bin" in any way in
>> the patch, though.  You are building it in such a way that it does
>> not have to get updated within the revision that contains e6e7530
>> (assuming that this will be queued directly on top it and merged to
>> everywhere e6e7530 is contained).
>
> Yep.
>
>> The new case/esac looks somewhat bad (its knowing that where test-*
>> lives, test-* is the only thing that is special, etc. troubles me at
>> the same time that case/esac is funnily formated).
>
> We could just make some random changes in this file. That would have
> the same effect.
>
>> Where does "@@PATH@@" come from and who rewrites it?  Is that a
>> misspelt "@@PROG@@"?
>
> Yep. Should have run make distclean before testing :(
> --
> Duy
-- 
Duy

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-05-08  9:51                 ` Duy Nguyen
@ 2016-05-09 16:03                   ` Junio C Hamano
  2016-05-10 11:58                     ` Duy Nguyen
  0 siblings, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2016-05-09 16:03 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List

Duy Nguyen <pclouds@gmail.com> writes:

> So among the options we have so far, which way should we go, or leave it as is?

Thanks for reminding me.

I like that version you sent with "I may have rushed to judgment"
comment the most.  Perhaps I can just queue it with s/PATH/PROG/
fixup?

>
> On Tue, May 3, 2016 at 7:15 AM, Duy Nguyen <pclouds@gmail.com> wrote:
>> On Tue, May 3, 2016 at 12:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Duy Nguyen <pclouds@gmail.com> writes:
>>>
>>>> I may have rushed to judgement. wrap-for-bin.sh has always been the
>>>> dependency for bin-wrappers/*. If we force that file to change, then
>>>> bin-wrappers/* will be recreated when switching branches. So how about
>>>> this?
>>>
>>> I do not think you are "force updating wrap-for-bin" in any way in
>>> the patch, though.  You are building it in such a way that it does
>>> not have to get updated within the revision that contains e6e7530
>>> (assuming that this will be queued directly on top it and merged to
>>> everywhere e6e7530 is contained).
>>
>> Yep.
>>
>>> The new case/esac looks somewhat bad (its knowing that where test-*
>>> lives, test-* is the only thing that is special, etc. troubles me at
>>> the same time that case/esac is funnily formated).
>>
>> We could just make some random changes in this file. That would have
>> the same effect.
>>
>>> Where does "@@PATH@@" come from and who rewrites it?  Is that a
>>> misspelt "@@PROG@@"?
>>
>> Yep. Should have run make distclean before testing :(
>> --
>> Duy

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-05-09 16:03                   ` Junio C Hamano
@ 2016-05-10 11:58                     ` Duy Nguyen
  2016-05-10 20:23                       ` Junio C Hamano
  0 siblings, 1 reply; 17+ messages in thread
From: Duy Nguyen @ 2016-05-10 11:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Mon, May 09, 2016 at 09:03:44AM -0700, Junio C Hamano wrote:
> Duy Nguyen <pclouds@gmail.com> writes:
> 
> > So among the options we have so far, which way should we go, or leave it as is?
> 
> Thanks for reminding me.
> 
> I like that version you sent with "I may have rushed to judgment"
> comment the most.  Perhaps I can just queue it with s/PATH/PROG/
> fixup?

Or a simpler, more-to-the-point patch like this?

-- 8< --
Subject: [PATCH] wrap-for-bin.sh: regenerate bin-wrappers when switching branches

Commit e6e7530 (test helpers: move test-* to t/helper/ subdirectory -
2016-04-13) moves test-* to t/helper. However because bin-wrappers/*
only depend on wrap-for-bin.sh, when switching between a branch that has
this commit and one that does not, bin-wrappers/* may not be regenerated
and point to the old/outdated test programs.

This commit makes a non-functional change in wrap-for-bin.sh, just
enough for 'make' to detect and re-execute wrap-for-bin.sh. When
switching between a branch containing both this commit and e6e7530 and
one containing neither, bin-wrappers/*, we should get fresh bin-wrappers/*.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 wrap-for-bin.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index db0ec6a..22b6e49 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -17,6 +17,7 @@ fi
 GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
 GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
+
 export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
 
 if test -n "$GIT_TEST_GDB"
-- 
2.8.2.524.g6ff3d78
-- 8< --
--
Duy

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] Move test-* to t/helper/ subdirectory
  2016-05-10 11:58                     ` Duy Nguyen
@ 2016-05-10 20:23                       ` Junio C Hamano
  0 siblings, 0 replies; 17+ messages in thread
From: Junio C Hamano @ 2016-05-10 20:23 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List

Duy Nguyen <pclouds@gmail.com> writes:

> Or a simpler, more-to-the-point patch like this?

I am OK with that, even though I find it a bit too "cute" for my
taste.



> -- 8< --
> Subject: [PATCH] wrap-for-bin.sh: regenerate bin-wrappers when switching branches
>
> Commit e6e7530 (test helpers: move test-* to t/helper/ subdirectory -
> 2016-04-13) moves test-* to t/helper. However because bin-wrappers/*
> only depend on wrap-for-bin.sh, when switching between a branch that has
> this commit and one that does not, bin-wrappers/* may not be regenerated
> and point to the old/outdated test programs.
>
> This commit makes a non-functional change in wrap-for-bin.sh, just
> enough for 'make' to detect and re-execute wrap-for-bin.sh. When
> switching between a branch containing both this commit and e6e7530 and
> one containing neither, bin-wrappers/*, we should get fresh bin-wrappers/*.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  wrap-for-bin.sh | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
> index db0ec6a..22b6e49 100644
> --- a/wrap-for-bin.sh
> +++ b/wrap-for-bin.sh
> @@ -17,6 +17,7 @@ fi
>  GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
>  GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
>  PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
> +
>  export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
>  
>  if test -n "$GIT_TEST_GDB"

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH] Move test-* to t/helper/ subdirectory
  2011-02-09 22:15 [PATCH/RFC] Move test-*.c to test/ subdirectory Junio C Hamano
@ 2011-02-10  2:14 ` Nguyễn Thái Ngọc Duy
  0 siblings, 0 replies; 17+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2011-02-10  2:14 UTC (permalink / raw)
  To: git, Junio C Hamano; +Cc: Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 .gitignore                                         |   19 ------------
 Makefile                                           |   30 ++++++++++----------
 t/helper/.gitignore                                |   19 ++++++++++++
 test-chmtime.c => t/helper/test-chmtime.c          |    0
 test-ctype.c => t/helper/test-ctype.c              |    0
 test-date.c => t/helper/test-date.c                |    0
 test-delta.c => t/helper/test-delta.c              |    0
 .../helper/test-dump-cache-tree.c                  |    0
 test-genrandom.c => t/helper/test-genrandom.c      |    0
 .../helper/test-index-version.c                    |    0
 test-line-buffer.c => t/helper/test-line-buffer.c  |    0
 test-match-trees.c => t/helper/test-match-trees.c  |    0
 test-obj-pool.c => t/helper/test-obj-pool.c        |    0
 .../helper/test-parse-options.c                    |    0
 test-path-utils.c => t/helper/test-path-utils.c    |    0
 test-run-command.c => t/helper/test-run-command.c  |    0
 test-sha1.c => t/helper/test-sha1.c                |    0
 test-sha1.sh => t/helper/test-sha1.sh              |    4 +-
 test-sigchain.c => t/helper/test-sigchain.c        |    0
 test-string-pool.c => t/helper/test-string-pool.c  |    0
 test-subprocess.c => t/helper/test-subprocess.c    |    0
 test-svn-fe.c => t/helper/test-svn-fe.c            |    0
 test-treap.c => t/helper/test-treap.c              |    0
 t/test-lib.sh                                      |    4 +-
 24 files changed, 38 insertions(+), 38 deletions(-)
 create mode 100644 t/helper/.gitignore
 rename test-chmtime.c => t/helper/test-chmtime.c (100%)
 rename test-ctype.c => t/helper/test-ctype.c (100%)
 rename test-date.c => t/helper/test-date.c (100%)
 rename test-delta.c => t/helper/test-delta.c (100%)
 rename test-dump-cache-tree.c => t/helper/test-dump-cache-tree.c (100%)
 rename test-genrandom.c => t/helper/test-genrandom.c (100%)
 rename test-index-version.c => t/helper/test-index-version.c (100%)
 rename test-line-buffer.c => t/helper/test-line-buffer.c (100%)
 rename test-match-trees.c => t/helper/test-match-trees.c (100%)
 rename test-obj-pool.c => t/helper/test-obj-pool.c (100%)
 rename test-parse-options.c => t/helper/test-parse-options.c (100%)
 rename test-path-utils.c => t/helper/test-path-utils.c (100%)
 rename test-run-command.c => t/helper/test-run-command.c (100%)
 rename test-sha1.c => t/helper/test-sha1.c (100%)
 rename test-sha1.sh => t/helper/test-sha1.sh (96%)
 rename test-sigchain.c => t/helper/test-sigchain.c (100%)
 rename test-string-pool.c => t/helper/test-string-pool.c (100%)
 rename test-subprocess.c => t/helper/test-subprocess.c (100%)
 rename test-svn-fe.c => t/helper/test-svn-fe.c (100%)
 rename test-treap.c => t/helper/test-treap.c (100%)

diff --git a/.gitignore b/.gitignore
index 3dd6ef7..a99a216 100644
--- a/.gitignore
+++ b/.gitignore
@@ -161,25 +161,6 @@
 /gitweb/GITWEB-BUILD-OPTIONS
 /gitweb/gitweb.cgi
 /gitweb/static/gitweb.min.*
-/test-chmtime
-/test-ctype
-/test-date
-/test-delta
-/test-dump-cache-tree
-/test-genrandom
-/test-index-version
-/test-line-buffer
-/test-match-trees
-/test-obj-pool
-/test-parse-options
-/test-path-utils
-/test-run-command
-/test-sha1
-/test-sigchain
-/test-string-pool
-/test-subprocess
-/test-svn-fe
-/test-treap
 /common-cmds.h
 *.tar.gz
 *.dsc
diff --git a/Makefile b/Makefile
index 775ee83..e2b3b92 100644
--- a/Makefile
+++ b/Makefile
@@ -436,7 +436,7 @@ TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-treap
 TEST_PROGRAMS_NEED_X += test-index-version
 
-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.
@@ -1829,7 +1829,7 @@ git.o git.spec \
 	$(patsubst %.perl,%,$(SCRIPT_PERL)) \
 	: GIT-VERSION-FILE
 
-TEST_OBJS := $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
+TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS))
 GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
 	git.o
 ifndef NO_CURL
@@ -1963,12 +1963,12 @@ xdiff-interface.o $(XDIFF_OBJS): \
 	xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
 	xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
 
-$(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) \
+$(VCSSVN_OBJS) $(patsubst %,t/helper/%,$(VCSSVN_TEST_OBJS)): $(LIB_H) \
 	vcs-svn/obj_pool.h vcs-svn/trp.h vcs-svn/string_pool.h \
 	vcs-svn/line_buffer.h vcs-svn/repo_tree.h vcs-svn/fast_export.h \
 	vcs-svn/svndump.h
 
-test-svn-fe.o: vcs-svn/svndump.h
+t/helper/test-svn-fe.o: vcs-svn/svndump.h
 endif
 
 exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
@@ -2108,7 +2108,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.
@@ -2122,27 +2122,27 @@ export NO_SVN_TESTS
 test: all
 	$(MAKE) -C t/ all
 
-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
+t/helper/test-parse-options$X: parse-options.o
 
-test-string-pool$X: vcs-svn/lib.a
+t/helper/test-string-pool$X: vcs-svn/lib.a
 
-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 $(GITLIBS)
+t/helper/test-%$X: t/helper/test-%.o $(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
 
 check: common-cmds.h
 	if sparse; \
diff --git a/t/helper/.gitignore b/t/helper/.gitignore
new file mode 100644
index 0000000..8f1b042
--- /dev/null
+++ b/t/helper/.gitignore
@@ -0,0 +1,19 @@
+/test-chmtime
+/test-ctype
+/test-date
+/test-delta
+/test-dump-cache-tree
+/test-genrandom
+/test-index-version
+/test-line-buffer
+/test-match-trees
+/test-obj-pool
+/test-parse-options
+/test-path-utils
+/test-run-command
+/test-sha1
+/test-sigchain
+/test-string-pool
+/test-subprocess
+/test-svn-fe
+/test-treap
diff --git a/test-chmtime.c b/t/helper/test-chmtime.c
similarity index 100%
rename from test-chmtime.c
rename to t/helper/test-chmtime.c
diff --git a/test-ctype.c b/t/helper/test-ctype.c
similarity index 100%
rename from test-ctype.c
rename to t/helper/test-ctype.c
diff --git a/test-date.c b/t/helper/test-date.c
similarity index 100%
rename from test-date.c
rename to t/helper/test-date.c
diff --git a/test-delta.c b/t/helper/test-delta.c
similarity index 100%
rename from test-delta.c
rename to t/helper/test-delta.c
diff --git a/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c
similarity index 100%
rename from test-dump-cache-tree.c
rename to t/helper/test-dump-cache-tree.c
diff --git a/test-genrandom.c b/t/helper/test-genrandom.c
similarity index 100%
rename from test-genrandom.c
rename to t/helper/test-genrandom.c
diff --git a/test-index-version.c b/t/helper/test-index-version.c
similarity index 100%
rename from test-index-version.c
rename to t/helper/test-index-version.c
diff --git a/test-line-buffer.c b/t/helper/test-line-buffer.c
similarity index 100%
rename from test-line-buffer.c
rename to t/helper/test-line-buffer.c
diff --git a/test-match-trees.c b/t/helper/test-match-trees.c
similarity index 100%
rename from test-match-trees.c
rename to t/helper/test-match-trees.c
diff --git a/test-obj-pool.c b/t/helper/test-obj-pool.c
similarity index 100%
rename from test-obj-pool.c
rename to t/helper/test-obj-pool.c
diff --git a/test-parse-options.c b/t/helper/test-parse-options.c
similarity index 100%
rename from test-parse-options.c
rename to t/helper/test-parse-options.c
diff --git a/test-path-utils.c b/t/helper/test-path-utils.c
similarity index 100%
rename from test-path-utils.c
rename to t/helper/test-path-utils.c
diff --git a/test-run-command.c b/t/helper/test-run-command.c
similarity index 100%
rename from test-run-command.c
rename to t/helper/test-run-command.c
diff --git a/test-sha1.c b/t/helper/test-sha1.c
similarity index 100%
rename from test-sha1.c
rename to t/helper/test-sha1.c
diff --git a/test-sha1.sh b/t/helper/test-sha1.sh
similarity index 96%
rename from test-sha1.sh
rename to t/helper/test-sha1.sh
index 0f0bc5d..4e691d1 100755
--- a/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 ./test-sha1 >/dev/null
+/usr/bin/time t/helper/test-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/'
-		} | ./test-sha1 $cnt
+		} | t/helper/test-sha1 $cnt
 	`
 	if test "$expect" = "$actual"
 	then
diff --git a/test-sigchain.c b/t/helper/test-sigchain.c
similarity index 100%
rename from test-sigchain.c
rename to t/helper/test-sigchain.c
diff --git a/test-string-pool.c b/t/helper/test-string-pool.c
similarity index 100%
rename from test-string-pool.c
rename to t/helper/test-string-pool.c
diff --git a/test-subprocess.c b/t/helper/test-subprocess.c
similarity index 100%
rename from test-subprocess.c
rename to t/helper/test-subprocess.c
diff --git a/test-svn-fe.c b/t/helper/test-svn-fe.c
similarity index 100%
rename from test-svn-fe.c
rename to t/helper/test-svn-fe.c
diff --git a/test-treap.c b/t/helper/test-treap.c
similarity index 100%
rename from test-treap.c
rename to t/helper/test-treap.c
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0fdc541..eebf7a8 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -984,9 +984,9 @@ then
 	}
 fi
 
-if ! test -x "$GIT_BUILD_DIR"/test-chmtime; then
+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
 
-- 
1.7.4.74.g639db

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-05-10 20:23 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13 13:22 [PATCH] Move test-* to t/helper/ subdirectory Nguyễn Thái Ngọc Duy
2016-04-15 15:09 ` Junio C Hamano
2016-04-15 17:06   ` Junio C Hamano
2016-04-16  0:08     ` Duy Nguyen
2016-04-26 22:07 ` Junio C Hamano
2016-04-27  0:52   ` Duy Nguyen
2016-04-27 10:18     ` Duy Nguyen
2016-04-27 16:15       ` Junio C Hamano
2016-05-01  0:28         ` Duy Nguyen
2016-05-01  6:00           ` Duy Nguyen
2016-05-02 17:34             ` Junio C Hamano
2016-05-03  0:15               ` Duy Nguyen
2016-05-08  9:51                 ` Duy Nguyen
2016-05-09 16:03                   ` Junio C Hamano
2016-05-10 11:58                     ` Duy Nguyen
2016-05-10 20:23                       ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2011-02-09 22:15 [PATCH/RFC] Move test-*.c to test/ subdirectory Junio C Hamano
2011-02-10  2:14 ` [PATCH] Move test-* to t/helper/ subdirectory Nguyễn Thái Ngọc Duy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.