threads / patch / 6141

patch, 3 partst6024-recursive-merge: quiet down this test

Subject: [PATCH 1/3] t6024-recursive-merge: quiet down this test

## tl;dr

6 messages between Dec 28, 2006 and Dec 28, 2006. Diffs are folded; open one to read it.

replies: 5people: 2as markdown or json

Eric Wong· Dec 28, 2006, 09:10 UTC · lore

quieting down git-commit (and init-db) in tests

There are more places where the tests have gotten, but I noticed these the most. Some non-portable uses of 'export' have been replaced. I'll try to get to the rest in a day or two, but I'm sleepy and have more things for git-svn to do.

--
 t/t6024-recursive-merge.sh     |   90 +++++++++++++++++++++-------------------
 t/t9200-git-cvsexportcommit.sh |   10 +++--
 t/test-lib.sh                  |    2 +-
 3 files changed, 54 insertions(+), 48 deletions(-)
-- 
Eric Wong
Eric Wong· Dec 28, 2006, 09:10 UTC · re: Eric Wong · lore

We get an extra measure of error checking here as well. While we're at it, also removed a less portable use of export.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 t/t6024-recursive-merge.sh |   90 +++++++++++++++++++++++---------------------
 1 files changed, 47 insertions(+), 43 deletions(-)
Show changes to t/t6024-recursive-merge.sh +47 −43
diff --git a/t/t6024-recursive-merge.sh b/t/t6024-recursive-merge.sh
index 69b18f7..31b9625 100644
--- a/t/t6024-recursive-merge.sh
+++ b/t/t6024-recursive-merge.sh
@@ -11,50 +11,54 @@ test_description='Test merge without common ancestors'
 #       X   \
 # 2 - C - E - G
 
-export GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100"
-echo 1 > a1
-git add a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1
-
-git checkout -b A master
-echo A > a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:01" git commit -m A a1
-
-git checkout -b B master
-echo B > a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:02" git commit -m B a1
-
-git checkout -b D A
-git-rev-parse B > .git/MERGE_HEAD
-echo D > a1
-git update-index a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:03" git commit -m D
-
-git symbolic-ref HEAD refs/heads/other
-echo 2 > a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:04" git commit -m 2 a1
-
-git checkout -b C
-echo C > a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1
-
-git checkout -b E C
-git-rev-parse B > .git/MERGE_HEAD
-echo E > a1
-git update-index a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:06" git commit -m E
-
-git checkout -b G E
-git-rev-parse A > .git/MERGE_HEAD
-echo G > a1
-git update-index a1
-GIT_AUTHOR_DATE="2006-12-12 23:00:07" git commit -m G
-
-git checkout -b F D
-git-rev-parse C > .git/MERGE_HEAD
-echo F > a1
-git update-index a1
+GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100"
+export GIT_COMMITTER_DATE
+
+test_expect_success "setup tests" '
+echo 1 > a1 &&
+git add a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1 &&
+
+git checkout -b A master &&
+echo A > a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:01" git commit -m A a1 &&
+
+git checkout -b B master &&
+echo B > a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:02" git commit -m B a1 &&
+
+git checkout -b D A &&
+git-rev-parse B > .git/MERGE_HEAD &&
+echo D > a1 &&
+git update-index a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:03" git commit -m D &&
+
+git symbolic-ref HEAD refs/heads/other &&
+echo 2 > a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:04" git commit -m 2 a1 &&
+
+git checkout -b C &&
+echo C > a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1 &&
+
+git checkout -b E C &&
+git-rev-parse B > .git/MERGE_HEAD &&
+echo E > a1 &&
+git update-index a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:06" git commit -m E &&
+
+git checkout -b G E &&
+git-rev-parse A > .git/MERGE_HEAD &&
+echo G > a1 &&
+git update-index a1 &&
+GIT_AUTHOR_DATE="2006-12-12 23:00:07" git commit -m G &&
+
+git checkout -b F D &&
+git-rev-parse C > .git/MERGE_HEAD &&
+echo F > a1 &&
+git update-index a1 &&
 GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F
+'
 
 test_expect_failure "combined merge conflicts" "git merge -m final G"
 
-- 
1.4.4.3.gd4ada
Eric Wong· Dec 28, 2006, 09:10 UTC · re: Eric Wong · lore

[PATCH 2/3] test-lib: quiet down init-db output for tests

I don't think anybody running tests needs to know they're running init-db and creating a repository for testing.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 t/test-lib.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to t/test-lib.sh +1 −1
diff --git a/t/test-lib.sh b/t/test-lib.sh
index f0f9cd6..ad2b6f6 100755
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -176,7 +176,7 @@ test_create_repo () {
 	repo="$1"
 	mkdir "$repo"
 	cd "$repo" || error "Cannot setup test environment"
-	"$GIT_EXEC_PATH/git" init-db --template=$GIT_EXEC_PATH/templates/blt/ 2>/dev/null ||
+	"$GIT_EXEC_PATH/git" init-db --template=$GIT_EXEC_PATH/templates/blt/ >/dev/null 2>&1 ||
 	error "cannot run git init-db -- have you built things yet?"
 	mv .git/hooks .git/hooks-disabled
 	cd "$owd"
-- 
1.4.4.3.gd4ada
Eric Wong· Dec 28, 2006, 09:10 UTC · re: Eric Wong · lore

[PATCH 3/3] t9200-git-cvsexportcommit.sh: quiet down commit

Also, fixed an unportable use of 'export'.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 t/t9200-git-cvsexportcommit.sh |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
Show changes to t/t9200-git-cvsexportcommit.sh +6 −4
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index ca0513b..315119a 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -14,16 +14,18 @@ then
     exit
 fi
 
-export CVSROOT=$(pwd)/cvsroot
-export CVSWORK=$(pwd)/cvswork
+CVSROOT=$(pwd)/cvsroot
+CVSWORK=$(pwd)/cvswork
+GIT_DIR=$(pwd)/.git
+export CVSROOT CVSWORK GIT_DIR
+
 rm -rf "$CVSROOT" "$CVSWORK"
 mkdir "$CVSROOT" &&
 cvs init &&
 cvs -Q co -d "$CVSWORK" . &&
-export GIT_DIR=$(pwd)/.git &&
 echo >empty &&
 git add empty &&
-git commit -a -m "Initial" 2>/dev/null ||
+git commit -q -a -m "Initial" 2>/dev/null ||
 exit 1
 
 test_expect_success \
-- 
1.4.4.3.gd4ada
Junio C Hamano· Dec 28, 2006, 09:24 UTC · re: Eric Wong · lore

Re: [PATCH 3/3] t9200-git-cvsexportcommit.sh: quiet down commit

Eric Wong <normalperson@yhbt.net> writes:
> Also, fixed an unportable use of 'export'.

As a traditionalist, I tend to prefer "var=val; export var" over "export var=val" myself, but I wonder how unportable this is these days.

Just wondering, no objection.

Do you have a specific shell in mind that groks other constructs used in our tests but not "export var=val" form?

Eric Wong· Dec 28, 2006, 18:14 UTC · re: Junio C Hamano · lore

Re: [PATCH 3/3] t9200-git-cvsexportcommit.sh: quiet down commit

Junio C Hamano <junkio@cox.net> wrote:
Show 12 quoted lines
> Eric Wong <normalperson@yhbt.net> writes:
> 
> > Also, fixed an unportable use of 'export'.
> 
> As a traditionalist, I tend to prefer "var=val; export var" over
> "export var=val" myself, but I wonder how unportable this is
> these days.
> 
> Just wondering, no objection.
> 
> Do you have a specific shell in mind that groks other constructs
> used in our tests but not "export var=val" form?

I can't remember, and I can't seem to find one, either. Even posh (latest debian unstable) and ash (from woody) seem to support it...

On a related note, how portable is mkdir -p these days? I remember seeing systems that don't have it, too.

-- 
Eric Wong

← back to recent threads