threads / discuss / 14313

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

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

## tl;dr

9 messages between Jul 6, 2008 and Jul 21, 2008.

replies: 8people: 2as markdown or json

Stephan Beyer· Jul 6, 2008, 20:22 UTC · lore

This option realizes a stupid hack that tries to run the test cases line by line (separated by &&). Furthermore it shows the line it is testing. With that information it is easier to find the reason why a test fails.

This hack works as long as there are no multi-line for/while/subshell/... in the test cases.

Note, that the -s option should only be used if a test case failed. It is slow and error-prone.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
Hi,

I wrote that before I started to make the sequencer prototype and then I used this hack more than expected ;-) Today I cherry-picked this commit into another branch and then I thought this could be useful for others, too. (Explicitly not for inclusion!)

So how to use it? When running a test case in t/, add the -s option and then it shows something like this:

--snip--[...]
-------
Testing:
        ! test -d "$SEQDIR"
-------
Testing:
        session_ok
* FAIL 3: "pick", "squash", "ref" from stdin
                next_session squashCE &&
                valgrind git sequencer <todotest1 &&
                ! test -d "$SEQDIR" &&
                session_ok &&
                test -f file2 &&
                test -f file3 &&
                test $(git rev-parse CE) = $(git rev-parse HEAD) &&
                test $(git rev-parse I) = $(git rev-parse HEAD^)
--snap--
Because of the "Testing:" lines you can explicitly see where it failed.
Regards,
  Stephan
 t/test-lib.sh |   45 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index c0c5e0e..6f42106 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -86,6 +86,8 @@ do
 		help=t; shift ;;
 	-v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
 		verbose=t; shift ;;
+	-s|--show-hack)
+		verbose=t; show_hack=t; immediate=t; shift ;;
 	-q|--q|--qu|--qui|--quie|--quiet)
 		quiet=t; shift ;;
 	--no-color)
@@ -225,9 +227,48 @@ test_debug () {
 	test "$debug" = "" || eval "$1"
 }
 
-test_run_ () {
-	eval >&3 2>&4 "$1"
+test_run__ () {
+	eval "$1"
 	eval_ret="$?"
+}
+
+test_run_op_ () {
+	echo "Testing:"
+	printf "%s\n" "$op_"
+	echo
+	eval "$op_"
+	eval_ret="$?"
+}
+
+test_run_hack_ () {
+	i_=1
+	j_=1
+	total_=$(printf '%s' "$1" | wc -l)
+	while test "$j_" -lt $(expr "$total_" + 1)
+	do
+		op_=$(printf '%s' "$1" | sed -n -e "$i_,$j_ p")
+		if test -n "$(printf '%s' "$op_" | sed -n -e '/<<[-\\ A-Za-z]/q;/&& *$/p;')"
+		then
+			i_=$(expr "$j_" + 1)
+			op_=$(printf '%s' "$op_" | sed -e 's/ *&& *$//')
+			test_run_op_
+			test "$eval_ret" -ne 0 && return 0
+			echo -------
+		fi
+		j_=$(expr "$j_" + 1)
+	done
+	op_="$(printf '%s' "$1" | sed -n -e "$i_,$j_ p")"
+	test_run_op_
+	return 0
+}
+
+test_run_ () {
+	if test -z "$show_hack"
+	then
+		test_run__ >&3 2>&4 "$1"
+	else
+		test_run_hack_ >&3 2>&4 "$1"
+	fi
 	return 0
 }
 
-- 
1.5.6.363.g7ba71
Johannes Schindelin· Jul 6, 2008, 20:41 UTC · re: Stephan Beyer · lore

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

Hi,
On Sun, 6 Jul 2008, Stephan Beyer wrote:
> This option realizes a stupid hack that tries to run the test
> cases line by line (separated by &&).
In what way is that better than "sh -x t????-*.sh"?

Ciao, Dscho

Stephan Beyer· Jul 7, 2008, 14:08 UTC · re: Johannes Schindelin · lore

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

Hi,
> > This option realizes a stupid hack that tries to run the test
> > cases line by line (separated by &&).
> 
> In what way is that better than "sh -x t????-*.sh"?

Your suggestion is more like "./t????-*.sh -v" instead of -s, at least on bash and dash here. But I didn't know the -x flag and it seems that this could be used in test-lib.sh to make the hack faster, more robust and less hacky ;-)

Regards,
  Stephan
-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F
Johannes Schindelin· Jul 7, 2008, 14:41 UTC · re: Stephan Beyer · lore

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

Hi,
On Mon, 7 Jul 2008, Stephan Beyer wrote:
Show 7 quoted lines
> > > This option realizes a stupid hack that tries to run the test cases 
> > > line by line (separated by &&).
> > 
> > In what way is that better than "sh -x t????-*.sh"?
> 
> Your suggestion is more like "./t????-*.sh -v" instead of -s, at least
> on bash and dash here.
No, I meant without "-v".
> But I didn't know the -x flag and it seems that this could be used in 
> test-lib.sh to make the hack faster, more robust and less hacky ;-)

It would obsolete your hack, I suggest. Obviously, you haven't tried it yet.

Hth, Dscho

Stephan Beyer· Jul 12, 2008, 22:22 UTC · re: Johannes Schindelin · lore

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

Hi,

I'm just cleaning up my inbox and I've seen I've not yet replied to your mail.

Johannes Schindelin wrote:
Show 13 quoted lines
> Hi,
> 
> On Mon, 7 Jul 2008, Stephan Beyer wrote:
> 
> > > > This option realizes a stupid hack that tries to run the test cases 
> > > > line by line (separated by &&).
> > > 
> > > In what way is that better than "sh -x t????-*.sh"?
> > 
> > Your suggestion is more like "./t????-*.sh -v" instead of -s, at least
> > on bash and dash here.
> 
> No, I meant without "-v".
Me, too.

I've written something different: "sh -x" is a great thing and does exactly what it should on simple scripts containing:

	foo &&
	bar &&
	baz

But for a test case in the git test suite it does not work, unfortunately. (Tested on bash, dash and zsh.)

The information I get from
	sh -x ./t????-*.sh
is like the information I get from invoking
	./t????-*.sh -v
but less eye-pleasing.
And ./t????-*.sh -s (using this patch) shows me something like:
	Testing:
		foo
	Testing:
		bar
	* FAIL: blabla
So that I what *command* of the test case fails.
But perhaps I am just doing something wrong.
Show 5 quoted lines
> > But I didn't know the -x flag and it seems that this could be used in 
> > test-lib.sh to make the hack faster, more robust and less hacky ;-)
> 
> It would obsolete your hack, I suggest.  Obviously, you haven't tried it 
> yet.
The obvious is wrong.

I would be very happy to obsolete my slow and error-prone hack, but currently I have not seen a good alternative.

Regards,
  Stephan
-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F
Johannes Schindelin· Jul 13, 2008, 00:25 UTC · re: Stephan Beyer · lore

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

Hi,
On Sun, 13 Jul 2008, Stephan Beyer wrote:
Show 24 quoted lines
> Johannes Schindelin wrote:
> 
> > On Mon, 7 Jul 2008, Stephan Beyer wrote:
> > 
> > > > > This option realizes a stupid hack that tries to run the test 
> > > > > cases line by line (separated by &&).
> > > > 
> > > > In what way is that better than "sh -x t????-*.sh"?
> > > 
> > > Your suggestion is more like "./t????-*.sh -v" instead of -s, at 
> > > least on bash and dash here.
> > 
> > No, I meant without "-v".
> 
> Me, too.
> 
> I've written something different: "sh -x" is a great thing and does 
> exactly what it should on simple scripts containing:
> 
> 	foo &&
> 	bar &&
> 	baz
> 
> But for a test case in the git test suite it does not work, unfortunately.
Huh?

When I run "sh -x t*.sh", it lists _every_ command that was executed in the script, and even more: it shows me the result, too! If there was a function that was called, it prefixes an additional "+" so that I can follow recursion better.

All in all, "sh -x" is a very versatile tool.

As far as I undertood your commit message, your HACK would have done the first part: list what commands were executed. This is less than what "sh -x" does.

Please clarify, Dscho

Stephan Beyer· Jul 13, 2008, 11:09 UTC · re: Johannes Schindelin · lore

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

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@example.com
++ GIT_AUTHOR_NAME='A U Thor'
++ unset GIT_COMMITTER_DATE
++ GIT_COMMITTER_EMAIL=committer@example.com
++ 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@example.com>'
+ 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@gmx.net>, PGP 0x6EDDD207FCC5040F
Johannes Schindelin· Jul 13, 2008, 13:21 UTC · re: Stephan Beyer · lore

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

Hi,
On Sun, 13 Jul 2008, Stephan Beyer wrote:
Show 5 quoted lines
> 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.

Ah, I implicitely assumed that you would also pass the "-i -v" flags to the test script, as my fingers are already trained to do so whenever I call a test script:

$ sh -x t4150-am.sh -i -v

You will have to scroll back a few lines to see exactly what failed, but you will see the exact commands (also of functions that were called), together with their return values (i.e. what the function output, and what was assigned to variables).

All that using the screen estate much more cautiously than your output.

I use "sh -x t* -i -v" all the time, Dscho

Stephan Beyer· Jul 21, 2008, 01:24 UTC · re: Johannes Schindelin · lore

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

Hi,
Johannes Schindelin wrote:
> You will have to scroll back a few lines to see exactly what failed, but 
> you will see the exact commands (also of functions that were called), 
> together with their return values (i.e. what the function output, and what 
> was assigned to variables).
I've tested again and found it now. Thanks!

It's a littler harder to see, but now I know that I should look for the last "+ eval_ret=" line, ...that makes it easier ;)

Puh, now I can finally move this thread to the archives :)
Regards.
-- 
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F

← back to recent threads