Re: [HACK] t/test-lib.sh HACK: Add -s/--show-hack to test suite.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Johannes Schindelin wrote:
[...]
> 
> Please clarify,
> Dscho

Ok, I add an example and show you what my output is using sh -x and my
hack. Perhaps you can point me to something that wents wrong.

First I make t4150 fail:

diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index bc98260..07e626a 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -69,6 +69,7 @@ test_expect_success setup '
 	echo hello >file &&
 	git add file &&
 	test_tick &&
+	! : &&
 	git commit -m first &&
 	git tag first &&
 	echo world >>file &&

Now:

-------------
$ ./t4150-am.sh -s
Initialized empty Git repository in /home/sbeyer/src/git/t/trash directory/.git/
* expecting success:
        echo hello >file &&
        git add file &&
        test_tick &&
        ! : &&
        git commit -m first &&
        git tag first &&
        echo world >>file &&
        git add file &&
        test_tick &&
        git commit -s -F msg &&
        git tag second &&
        git format-patch --stdout first >patch1 &&
        sed -n -e "3,\$p" msg >file &&
        git add file &&
        test_tick &&
        git commit -m third &&
        git format-patch --stdout first >patch2 &&
        git checkout -b lorem &&
        sed -n -e "11,\$p" msg >file &&
        head -n 9 msg >>file &&
        test_tick &&
        git commit -a -m "moved stuff" &&
        echo goodbye >another &&
        git add another &&
        test_tick &&
        git commit -m "added another file" &&
        git format-patch --stdout master >lorem-move.patch

Testing:

        echo hello >file

-------
Testing:
        git add file

-------
Testing:
        test_tick

-------
Testing:
        ! :

* FAIL 1: setup

                echo hello >file &&
                git add file &&
                test_tick &&
                ! : &&
                git commit -m first &&
                git tag first &&
                echo world >>file &&
                git add file &&
                test_tick &&
                git commit -s -F msg &&
                git tag second &&
                git format-patch --stdout first >patch1 &&
                sed -n -e "3,\$p" msg >file &&
                git add file &&
                test_tick &&
                git commit -m third &&
                git format-patch --stdout first >patch2 &&
                git checkout -b lorem &&
                sed -n -e "11,\$p" msg >file &&
                head -n 9 msg >>file &&
                test_tick &&
                git commit -a -m "moved stuff" &&
                echo goodbye >another &&
                git add another &&
                test_tick &&
                git commit -m "added another file" &&
                git format-patch --stdout master >lorem-move.patch

-------------


And now sh -x:

-------------
$ sh --version
GNU bash, version 3.2.39(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
$ # no big differences using dash or zsh
$ sh -x ./t4150-am.sh -i
+ test_description='git am running'
+ . ./test-lib.sh
++ ORIGINAL_TERM=xterm
++ LANG=C
++ LC_ALL=C
++ PAGER=cat
++ TZ=UTC
++ TERM=dumb
++ export LANG LC_ALL PAGER TERM TZ
++ EDITOR=:
++ VISUAL=:
++ unset GIT_EDITOR
++ unset AUTHOR_DATE
++ unset AUTHOR_EMAIL
++ unset AUTHOR_NAME
++ unset COMMIT_AUTHOR_EMAIL
++ unset COMMIT_AUTHOR_NAME
++ unset EMAIL
++ unset GIT_ALTERNATE_OBJECT_DIRECTORIES
++ unset GIT_AUTHOR_DATE
++ GIT_AUTHOR_EMAIL=author@xxxxxxxxxxx
++ GIT_AUTHOR_NAME='A U Thor'
++ unset GIT_COMMITTER_DATE
++ GIT_COMMITTER_EMAIL=committer@xxxxxxxxxxx
++ GIT_COMMITTER_NAME='C O Mitter'
++ unset GIT_DIFF_OPTS
++ unset GIT_DIR
++ unset GIT_WORK_TREE
++ unset GIT_EXTERNAL_DIFF
++ unset GIT_INDEX_FILE
++ unset GIT_OBJECT_DIRECTORY
++ unset GIT_CEILING_DIRECTORIES
++ unset SHA1_FILE_DIRECTORIES
++ unset SHA1_FILE_DIRECTORY
++ GIT_MERGE_VERBOSITY=5
++ export GIT_MERGE_VERBOSITY
++ export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
++ export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
++ export EDITOR VISUAL
++ GIT_TEST_CMP='diff -u'
++ unset CDPATH
++ case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in
+++ echo
+++ tr '[A-Z]' '[a-z]'
++ '[' xxterm '!=' xdumb ']'
++ TERM=xterm
++ export TERM
++ '[' -t 1 ']'
++ tput bold
++ tput setaf 1
++ tput sgr0
++ color=t
++ test 1 -ne 0
++ case "$1" in
++ immediate=t
++ shift
++ test 0 -ne 0
++ test -n t
++ test 'git am running' '!=' ''
++ test '' = t
++ exec
++ test '' = t
++ exec
++ test_failure=0
++ test_count=0
++ test_fixed=0
++ test_broken=0
++ test_success=0
++ trap die exit
+++ pwd
++ TEST_DIRECTORY=/home/sbeyer/src/git/t
++ PATH=/home/sbeyer/src/git/t/..:/home/sbeyer/bin/:/usr/local/bin:/usr/bin:/bin:/usr/games
+++ pwd
++ GIT_EXEC_PATH=/home/sbeyer/src/git/t/..
+++ pwd
++ GIT_TEMPLATE_DIR=/home/sbeyer/src/git/t/../templates/blt
++ unset GIT_CONFIG
++ unset GIT_CONFIG_LOCAL
++ GIT_CONFIG_NOSYSTEM=1
++ GIT_CONFIG_NOGLOBAL=1
++ export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL
+++ pwd
+++ pwd
++ GITPERLLIB=/home/sbeyer/src/git/t/../perl/blib/lib:/home/sbeyer/src/git/t/../perl/blib/arch/auto/Git
++ export GITPERLLIB
++ test -d ../templates/blt
++ test -x ../test-chmtime
++ . ../GIT-BUILD-OPTIONS
+++ SHELL_PATH=/bin/sh
++ test='trash directory'
++ rm -fr 'trash directory'
++ test_create_repo 'trash directory'
++ test 1 = 1
+++ pwd
++ owd=/home/sbeyer/src/git/t
++ repo='trash directory'
++ mkdir 'trash directory'
++ cd 'trash directory'
++ /home/sbeyer/src/git/t/../git init --template=/home/sbeyer/src/git/t/../templates/blt/
++ mv .git/hooks .git/hooks-disabled
++ cd /home/sbeyer/src/git/t
++ cd -P 'trash directory'
+++ expr ././t4150-am.sh : '.*/\(t[0-9]*\)-[^/]*$'
++ this_test=t4150
+ cat
+ cat
+ cat
+ echo 'Signed-off-by: C O Mitter <committer@xxxxxxxxxxx>'
+ test_expect_success setup '
	echo hello >file &&
	git add file &&
	test_tick &&
	! : &&
	git commit -m first &&
	git tag first &&
	echo world >>file &&
	git add file &&
	test_tick &&
	git commit -s -F msg &&
	git tag second &&
	git format-patch --stdout first >patch1 &&
	sed -n -e "3,\$p" msg >file &&
	git add file &&
	test_tick &&
	git commit -m third &&
	git format-patch --stdout first >patch2	&&
	git checkout -b lorem &&
	sed -n -e "11,\$p" msg >file &&
	head -n 9 msg >>file &&
	test_tick &&
	git commit -a -m "moved stuff" &&
	echo goodbye >another &&
	git add another &&
	test_tick &&
	git commit -m "added another file" &&
	git format-patch --stdout master >lorem-move.patch
'
+ test 2 = 2
+ test_skip setup '
	echo hello >file &&
	git add file &&
	test_tick &&
	! : &&
	git commit -m first &&
	git tag first &&
	echo world >>file &&
	git add file &&
	test_tick &&
	git commit -s -F msg &&
	git tag second &&
	git format-patch --stdout first >patch1 &&
	sed -n -e "3,\$p" msg >file &&
	git add file &&
	test_tick &&
	git commit -m third &&
	git format-patch --stdout first >patch2	&&
	git checkout -b lorem &&
	sed -n -e "11,\$p" msg >file &&
	head -n 9 msg >>file &&
	test_tick &&
	git commit -a -m "moved stuff" &&
	echo goodbye >another &&
	git add another &&
	test_tick &&
	git commit -m "added another file" &&
	git format-patch --stdout master >lorem-move.patch
'
++ expr ././t4150-am.sh : '.*/\(t[0-9]*\)-[^/]*$'
+ this_test=t4150
++ expr 0 + 1
+ this_test=t4150.1
+ to_skip=
+ case "$to_skip" in
+ false
+ say 'expecting success: 
	echo hello >file &&
	git add file &&
	test_tick &&
	! : &&
	git commit -m first &&
	git tag first &&
	echo world >>file &&
	git add file &&
	test_tick &&
	git commit -s -F msg &&
	git tag second &&
	git format-patch --stdout first >patch1 &&
	sed -n -e "3,\$p" msg >file &&
	git add file &&
	test_tick &&
	git commit -m third &&
	git format-patch --stdout first >patch2	&&
	git checkout -b lorem &&
	sed -n -e "11,\$p" msg >file &&
	head -n 9 msg >>file &&
	test_tick &&
	git commit -a -m "moved stuff" &&
	echo goodbye >another &&
	git add another &&
	test_tick &&
	git commit -m "added another file" &&
	git format-patch --stdout master >lorem-move.patch
'
+ say_color info 'expecting success: 
	echo hello >file &&
	git add file &&
	test_tick &&
	! : &&
	git commit -m first &&
	git tag first &&
	echo world >>file &&
	git add file &&
	test_tick &&
	git commit -s -F msg &&
	git tag second &&
	git format-patch --stdout first >patch1 &&
	sed -n -e "3,\$p" msg >file &&
	git add file &&
	test_tick &&
	git commit -m third &&
	git format-patch --stdout first >patch2	&&
	git checkout -b lorem &&
	sed -n -e "11,\$p" msg >file &&
	head -n 9 msg >>file &&
	test_tick &&
	git commit -a -m "moved stuff" &&
	echo goodbye >another &&
	git add another &&
	test_tick &&
	git commit -m "added another file" &&
	git format-patch --stdout master >lorem-move.patch
'
+ TERM=xterm
+ export TERM
+ case "$1" in
+ tput setaf 3
+ shift
+ echo '* expecting success: 
	echo hello >file &&
	git add file &&
	test_tick &&
	! : &&
	git commit -m first &&
	git tag first &&
	echo world >>file &&
	git add file &&
	test_tick &&
	git commit -s -F msg &&
	git tag second &&
	git format-patch --stdout first >patch1 &&
	sed -n -e "3,\$p" msg >file &&
	git add file &&
	test_tick &&
	git commit -m third &&
	git format-patch --stdout first >patch2	&&
	git checkout -b lorem &&
	sed -n -e "11,\$p" msg >file &&
	head -n 9 msg >>file &&
	test_tick &&
	git commit -a -m "moved stuff" &&
	echo goodbye >another &&
	git add another &&
	test_tick &&
	git commit -m "added another file" &&
	git format-patch --stdout master >lorem-move.patch
'
+ tput sgr0
+ test_run_ '
	echo hello >file &&
	git add file &&
	test_tick &&
	! : &&
	git commit -m first &&
	git tag first &&
	echo world >>file &&
	git add file &&
	test_tick &&
	git commit -s -F msg &&
	git tag second &&
	git format-patch --stdout first >patch1 &&
	sed -n -e "3,\$p" msg >file &&
	git add file &&
	test_tick &&
	git commit -m third &&
	git format-patch --stdout first >patch2	&&
	git checkout -b lorem &&
	sed -n -e "11,\$p" msg >file &&
	head -n 9 msg >>file &&
	test_tick &&
	git commit -a -m "moved stuff" &&
	echo goodbye >another &&
	git add another &&
	test_tick &&
	git commit -m "added another file" &&
	git format-patch --stdout master >lorem-move.patch
'
+ eval '
	echo hello >file &&
	git add file &&
	test_tick &&
	! : &&
	git commit -m first &&
	git tag first &&
	echo world >>file &&
	git add file &&
	test_tick &&
	git commit -s -F msg &&
	git tag second &&
	git format-patch --stdout first >patch1 &&
	sed -n -e "3,\$p" msg >file &&
	git add file &&
	test_tick &&
	git commit -m third &&
	git format-patch --stdout first >patch2	&&
	git checkout -b lorem &&
	sed -n -e "11,\$p" msg >file &&
	head -n 9 msg >>file &&
	test_tick &&
	git commit -a -m "moved stuff" &&
	echo goodbye >another &&
	git add another &&
	test_tick &&
	git commit -m "added another file" &&
	git format-patch --stdout master >lorem-move.patch
'
+ eval_ret=1
+ return 0
+ '[' 0 = 0 -a 1 = 0 ']'
+ test_failure_ setup '
	echo hello >file &&
	git add file &&
	test_tick &&
	! : &&
	git commit -m first &&
	git tag first &&
	echo world >>file &&
	git add file &&
	test_tick &&
	git commit -s -F msg &&
	git tag second &&
	git format-patch --stdout first >patch1 &&
	sed -n -e "3,\$p" msg >file &&
	git add file &&
	test_tick &&
	git commit -m third &&
	git format-patch --stdout first >patch2	&&
	git checkout -b lorem &&
	sed -n -e "11,\$p" msg >file &&
	head -n 9 msg >>file &&
	test_tick &&
	git commit -a -m "moved stuff" &&
	echo goodbye >another &&
	git add another &&
	test_tick &&
	git commit -m "added another file" &&
	git format-patch --stdout master >lorem-move.patch
'
++ expr 0 + 1
+ test_count=1
++ expr 0 + 1
+ test_failure=1
+ say_color error 'FAIL 1: setup'
+ TERM=xterm
+ export TERM
+ case "$1" in
+ tput bold
+ tput setaf 1
+ shift
+ echo '* FAIL 1: setup'
+ tput sgr0
+ shift
+ echo '
	echo hello >file &&
	git add file &&
	test_tick &&
	! : &&
	git commit -m first &&
	git tag first &&
	echo world >>file &&
	git add file &&
	test_tick &&
	git commit -s -F msg &&
	git tag second &&
	git format-patch --stdout first >patch1 &&
	sed -n -e "3,\$p" msg >file &&
	git add file &&
	test_tick &&
	git commit -m third &&
	git format-patch --stdout first >patch2	&&
	git checkout -b lorem &&
	sed -n -e "11,\$p" msg >file &&
	head -n 9 msg >>file &&
	test_tick &&
	git commit -a -m "moved stuff" &&
	echo goodbye >another &&
	git add another &&
	test_tick &&
	git commit -m "added another file" &&
	git format-patch --stdout master >lorem-move.patch
'
+ sed -e 's/^/	/'
+ test t = ''
+ trap - exit
+ exit 1
-------------

I want to see that the test failed at "! :" and I can't see that
on this output.

But perhaps I just have to reconfigure something, so that it will show me.

Regards,
  Stephan

-- 
Stephan Beyer <s-beyer@xxxxxxx>, PGP 0x6EDDD207FCC5040F
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux