Skip to contentSkip to conversation

t/perf: add "trash directory" to .gitignore

PATCH In review Ramkumar Ramachandra 2 participants 12 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t/perf: add "trash directory" to .gitignore

---
 t/perf/.gitignore |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
t/perf/.gitignore +3 -2
index 50f5cc1..0061cbc 100644
@@ -1,2 +1,3 @@
-build/
-test-results/
+/build
+/test-results
+/trash directory*
Signature · 1 line
1.7.8.1.362.g5d6df.dirty
#1 lore raw

PATCH 1/1 t/test-lib: print pretty msg when git isn't built

When tests were run without building git, the following error message was displayed:

    .: 54: Can't open /path/to/git/source/t/../GIT-BUILD-OPTIONS

Change this to display a more user-friendly error message:

error: you do not seem to have built git yet.

---
 t/t0000-basic.sh |   10 ----------
 t/test-lib.sh    |    6 ++++++
 2 files changed, 6 insertions(+), 10 deletions(-)
t/t0000-basic.sh +0 -10
index ae6a3f0..08677df 100755
@@ -18,16 +18,6 @@ swapping compression and hashing order, the person who is making the
 modification *should* take notice and update the test vectors here.
 '
 
-################################################################
-# It appears that people try to run tests without building...
-
-../git >/dev/null
-if test $? != 1
-then
-	echo >&2 'You do not seem to have built git yet.'
-	exit 1
-fi
-
 . ./test-lib.sh
 
 ################################################################
t/test-lib.sh +6 -0
index f8e3733..c00452a 100644
@@ -51,6 +51,12 @@ then
 fi
 GIT_BUILD_DIR="$TEST_DIRECTORY"/..
 
+if ! test -r "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
+then
+	echo 'error: you do not seem to have built git yet.' >&2
+	exit 1
+fi
+
 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
 export PERL_PATH SHELL_PATH
 
Signature · 1 line
1.7.8.1.362.g5d6df.dirty
#2 lore raw

Re: [PATCH] t/test-lib: print pretty msg when git isn't built

Quoted 41 lines · Ramkumar Ramachandra

When tests were run without building git, the following error message was displayed:

    .: 54: Can't open /path/to/git/source/t/../GIT-BUILD-OPTIONS

Change this to display a more user-friendly error message:

error: you do not seem to have built git yet.

---
 t/t0000-basic.sh |   10 ----------
 t/test-lib.sh    |    6 ++++++
 2 files changed, 6 insertions(+), 10 deletions(-)
t/t0000-basic.sh +0 -10
index ae6a3f0..08677df 100755
@@ -18,16 +18,6 @@ swapping compression and hashing order, the person who is making the
 modification *should* take notice and update the test vectors here.
 '
 
-################################################################
-# It appears that people try to run tests without building...
-
-../git >/dev/null
-if test $? != 1
-then
-	echo >&2 'You do not seem to have built git yet.'
-	exit 1
-fi
-
 . ./test-lib.sh
 
 ################################################################
t/test-lib.sh +0 -0
index f8e3733..c00452a 100644

t/test-lib.sh then · line 59

Quoted 9 lines
t/test-lib.sh +6 -0
@@ -51,6 +51,12 @@ then
 fi
 GIT_BUILD_DIR="$TEST_DIRECTORY"/..
 
+if ! test -r "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
+then
+	echo 'error: you do not seem to have built git yet.' >&2
+	exit 1
+fi
+

Is this a sufficient replacement for what you removed from 0000? Can the BUILD-OPTIONS file exist when your build of git failed?

Quoted 2 lines
t/test-lib.sh +0 -0
 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
 export PERL_PATH SHELL_PATH
#3 lore raw

Re: [PATCH] t/test-lib: print pretty msg when git isn't built

Hi Junio,

Quoted 2 lines · Junio C Hamano

Is this a sufficient replacement for what you removed from 0000? Can the BUILD-OPTIONS file exist when your build of git failed?

Oops, I didn't realize that BUILD-OPTIONS would be written when the build fails. How about something like this instead:

t/t0000-basic.sh +0 -0
index ae6a3f0..08677df 100755
@@ -18,16 +18,6 @@ swapping compression and hashing order, the person

who is making the
modification *should* take notice and update the test vectors here. '

-################################################################
-# It appears that people try to run tests without building... -
-../git >/dev/null
-if test $? != 1
-then
- echo >&2 'You do not seem to have built git yet.'
- exit 1
-fi
-
. ./test-lib.sh

################################################################
Modified t/test-lib.sh

t/test-lib.sh +6 -0
index f8e3733..8cc7755 100644
@@ -51,6 +51,12 @@ then
 fi
 GIT_BUILD_DIR="$TEST_DIRECTORY"/..
 
+if ! test -x "$GIT_BUILD_DIR"/git || "$GIT_BUILD_DIR"/git && test $? != 1
+then
+	echo 'error: you do not seem to have built git yet.' >&2
+	exit 1
+fi
+
 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
 export PERL_PATH SHELL_PATH
#4 lore raw

Re: [PATCH] t/test-lib: print pretty msg when git isn't built

Quoted 8 lines · Ramkumar Ramachandra

Hi Junio,

Quoted 2 lines · Junio C Hamano

Is this a sufficient replacement for what you removed from 0000? Can the BUILD-OPTIONS file exist when your build of git failed?

Oops, I didn't realize that BUILD-OPTIONS would be written when the build fails. How about something like this instead:

Yeah, but why change it so much? Wouldn't writing

	"$GIT_BUILD_DIR/git" >/dev/null
	if test $? != 1
        then
		: You haven't built git!
	fi

just like the original in 0000 be sufficient??

Quoted 39 lines
t/t0000-basic.sh +0 -0
index ae6a3f0..08677df 100755
@@ -18,16 +18,6 @@ swapping compression and hashing order, the person

who is making the
modification *should* take notice and update the test vectors here. '

t/t0000-basic.sh +0 -10
-################################################################
-# It appears that people try to run tests without building...
-
-../git >/dev/null
-if test $? != 1
-then
-	echo >&2 'You do not seem to have built git yet.'
-	exit 1
-fi
-
 . ./test-lib.sh
 
 ################################################################

Modified t/test-lib.sh

t/test-lib.sh +6 -0
index f8e3733..8cc7755 100644
@@ -51,6 +51,12 @@ then
 fi
 GIT_BUILD_DIR="$TEST_DIRECTORY"/..
 
+if ! test -x "$GIT_BUILD_DIR"/git || "$GIT_BUILD_DIR"/git && test $? != 1
+then
+	echo 'error: you do not seem to have built git yet.' >&2
+	exit 1
+fi
+
 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
 export PERL_PATH SHELL_PATH
#5 lore raw

Re: [PATCH] t/test-lib: print pretty msg when git isn't built

Hi,

Quoted 13 lines · Junio C Hamano
Quoted 8 lines · Ramkumar Ramachandra

Hi Junio,

Quoted 2 lines · Junio C Hamano

Is this a sufficient replacement for what you removed from 0000? Can the BUILD-OPTIONS file exist when your build of git failed?

Oops, I didn't realize that BUILD-OPTIONS would be written when the build fails. How about something like this instead:

Yeah, but why change it so much? Wouldn't writing

Quoted 7 lines
        "$GIT_BUILD_DIR/git" >/dev/null
        if test $? != 1
        then
                : You haven't built git!
        fi

just like the original in 0000 be sufficient??

Because that emits an ugly
./test-lib.sh: 54: /home/artagnon/src/git/t/../git: not found

Ram

#6 lore raw

Re: [PATCH] t/test-lib: print pretty msg when git isn't built

Quoted 22 lines · Ramkumar Ramachandra

Hi,

Quoted 19 lines · Junio C Hamano
Quoted 8 lines · Ramkumar Ramachandra

Hi Junio,

Quoted 2 lines · Junio C Hamano

Is this a sufficient replacement for what you removed from 0000? Can the BUILD-OPTIONS file exist when your build of git failed?

Oops, I didn't realize that BUILD-OPTIONS would be written when the build fails. How about something like this instead:

Yeah, but why change it so much? Wouldn't writing

        "$GIT_BUILD_DIR/git" >/dev/null
        if test $? != 1
        then
                : You haven't built git!
        fi
Quoted 4 lines
Quoted 1 line

just like the original in 0000 be sufficient??

Because that emits an ugly
./test-lib.sh: 54: /home/artagnon/src/git/t/../git: not found

Don't you deserve it? ;-)

The full message would read

./test-lib.sh: 54: /home/artagnon/src/git/t/../git: not found
error: you do not seem to have built git yet.

which looks perfectly sensible to me. It makes it clear where on the filesystem the test script expects your "git", which is an added benefit.

#7 lore raw

Re: [PATCH] t/test-lib: print pretty msg when git isn't built

Hi Junio,

Quoted 16 lines · Junio C Hamano
Quoted 9 lines
Quoted 8 lines · Junio C Hamano

Yeah, but why change it so much? Wouldn't writing

        "$GIT_BUILD_DIR/git" >/dev/null
        if test $? != 1
        then
                : You haven't built git!
        fi
Quoted 4 lines
Quoted 1 line

just like the original in 0000 be sufficient??

Because that emits an ugly
./test-lib.sh: 54: /home/artagnon/src/git/t/../git: not found

Don't you deserve it? ;-)

Quoted 8 lines

The full message would read

./test-lib.sh: 54: /home/artagnon/src/git/t/../git: not found
error: you do not seem to have built git yet.

which looks perfectly sensible to me. It makes it clear where on the filesystem the test script expects your "git", which is an added benefit.

Fair enough- use your version then. Let me know if you want me to submit a revised patch.

Ram

#10 lore raw
In reply to Ramkumar Ramachandra
Quoted 10 lines · Ramkumar Ramachandra
---
 t/perf/.gitignore |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
t/perf/.gitignore +0 -0
index 50f5cc1..0061cbc 100644

t/perf/.gitignore line 3

Quoted 5 lines
t/perf/.gitignore +3 -2
@@ -1,2 +1,3 @@
-build/
-test-results/
+/build
+/test-results
+/trash directory*

Thanks. I _think_ you still want to make sure these are directories, so instead of losing the trailing slash, you would want to keep it and add a leading slash to anchor them to the t/perf directory, i.e.

	/build/
        /test-results/
        /trash directory*/
#11 lore raw

Hi,

Quoted 8 lines · Junio C Hamano

Thanks. I _think_ you still want to make sure these are directories, so instead of losing the trailing slash, you would want to keep it and add a leading slash to anchor them to the t/perf directory, i.e.

        /build/
        /test-results/
        /trash directory*/

Right. Thanks for taking care of this.

Ram

#8 lore raw

Re: [PATCH] t/test-lib: print pretty msg when git isn't built

In reply to Ramkumar Ramachandra
Quoted 10 lines · Ramkumar Ramachandra
Quoted 10 lines
Quoted 2 lines

Because that emits an ugly
./test-lib.sh: 54: /home/artagnon/src/git/t/../git: not found

Don't you deserve it? ;-)

The full message would read

./test-lib.sh: 54: /home/artagnon/src/git/t/../git: not found
error: you do not seem to have built git yet.

Quoted 6 lines
Quoted 3 lines

which looks perfectly sensible to me. It makes it clear where on the filesystem the test script expects your "git", which is an added benefit.

Fair enough- use your version then. Let me know if you want me to submit a revised patch.

OK, let's do this.

-- >8 --
From: Ramkumar Ramachandra <[email protected]>
Date: Mon, 17 Sep 2012 22:36:19 +0530
Subject: [PATCH] t/test-lib: print pretty msg when git isn't built

When tests were run without building git, they stopped with:

    .: 54: Can't open /path/to/git/source/t/../GIT-BUILD-OPTIONS

Move the check that makes sure that git has already been built from t0000 to test-lib, so that any test will do so before it runs.

---
 t/t0000-basic.sh | 10 ----------
 t/test-lib.sh    |  7 +++++++
 2 files changed, 7 insertions(+), 10 deletions(-)
t/t0000-basic.sh +0 -10
index ccb5435..741b6b6 100755
@@ -18,16 +18,6 @@ swapping compression and hashing order, the person who is making the
 modification *should* take notice and update the test vectors here.
 '
 
-################################################################
-# It appears that people try to run tests without building...
-
-../git >/dev/null
-if test $? != 1
-then
-	echo >&2 'You do not seem to have built git yet.'
-	exit 1
-fi
-
 . ./test-lib.sh
 
 ################################################################
t/test-lib.sh +7 -0
index 78c4286..61930fb 100644
@@ -51,6 +51,13 @@ then
 fi
 GIT_BUILD_DIR="$TEST_DIRECTORY"/..
 
+"$GIT_BUILD_DIR/git" >/dev/null
+if test $? != 1
+then
+	echo >&2 'error: you do not seem to have built git yet.'
+	exit 1
+fi
+
 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
 export PERL_PATH SHELL_PATH
 
Signature · 1 line
1.7.12.563.g54818e4
#9 lore raw

Re: [PATCH] t/test-lib: print pretty msg when git isn't built

In reply to Ramkumar Ramachandra
Quoted 4 lines · Ramkumar Ramachandra

When tests were run without building git, the following error message was displayed:

    .: 54: Can't open /path/to/git/source/t/../GIT-BUILD-OPTIONS

Does the test stop due to this error, or it just goes on and hit another error? I am guessing that it is the latter, and if that is the case, a more important change to describe here is

Quoted 3 lines

Change this to display a more user-friendly error message:

error: you do not seem to have built git yet.

... "and stop the execution."

Quoted 43 lines
---
 t/t0000-basic.sh |   10 ----------
 t/test-lib.sh    |    6 ++++++
 2 files changed, 6 insertions(+), 10 deletions(-)
t/t0000-basic.sh +0 -10
index ae6a3f0..08677df 100755
@@ -18,16 +18,6 @@ swapping compression and hashing order, the person who is making the
 modification *should* take notice and update the test vectors here.
 '
 
-################################################################
-# It appears that people try to run tests without building...
-
-../git >/dev/null
-if test $? != 1
-then
-	echo >&2 'You do not seem to have built git yet.'
-	exit 1
-fi
-
 . ./test-lib.sh
 
 ################################################################
t/test-lib.sh +6 -0
index f8e3733..c00452a 100644
@@ -51,6 +51,12 @@ then
 fi
 GIT_BUILD_DIR="$TEST_DIRECTORY"/..
 
+if ! test -r "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
+then
+	echo 'error: you do not seem to have built git yet.' >&2
+	exit 1
+fi
+
 . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
 export PERL_PATH SHELL_PATH