git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* [PATCH 1/5] t/README: make the 'Skipping tests' section less confusing
@ 2018-11-27 22:54 Ævar Arnfjörð Bjarmason
  2018-11-27 22:54 ` [PATCH 2/5] t/README: modernize description of GIT_SKIP_TESTS Ævar Arnfjörð Bjarmason
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-11-27 22:54 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason

I added this section in b5500d16cd ("t/README: Add a section about
skipping tests", 2010-07-02), but apparently didn't notice that there
was an existing "Skipping Tests" section added in
fbd458a3f6 ("t/README: Add 'Skipping Tests' section below 'Running
Tests'", 2008-06-20).

Then since 20873f45e7 ("t/README: Document the do's and don'ts of
tests", 2010-07-02) and 0445e6f0a1 ("test-lib: '--run' to run only
specific tests", 2014-04-30) we've started to refer to "Skipping
tests" or "Skipping Tests" sections in prose elsewhere.

Let's clean up this confusion by renaming the section, and while we're
at it improve the example. Usually we don't use the PERL prerequisite,
and we should accurately describe why you'd want to use prerequisites,
as opposed to GIT_SKIP_TESTS. So let's say "Tests that depend[...]"
instead of "If you need to skip tests[...]" here.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/README | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/t/README b/t/README
index 28711cc508..b6ec28f634 100644
--- a/t/README
+++ b/t/README
@@ -494,7 +494,7 @@ And here are the "don'ts:"
 
    The harness will catch this as a programming error of the test.
    Use test_done instead if you need to stop the tests early (see
-   "Skipping tests" below).
+   "Using test prerequisites" below).
 
  - Don't use '! git cmd' when you want to make sure the git command
    exits with failure in a controlled way by calling "die()".  Instead,
@@ -587,28 +587,28 @@ And here are the "don'ts:"
    it'll complain if anything is amiss.
 
 
-Skipping tests
---------------
+Using test prerequisites
+------------------------
 
-If you need to skip tests you should do so by using the three-arg form
-of the test_* functions (see the "Test harness library" section
-below), e.g.:
+Tests that depend on something which may not be present on the system
+should use the three-arg form of the test_* functions (see the "Test
+harness library" section below), e.g.:
 
-    test_expect_success PERL 'I need Perl' '
-        perl -e "hlagh() if unf_unf()"
+    test_expect_success SYMLINKS 'setup' '
+        ln -s target link
     '
 
 The advantage of skipping tests like this is that platforms that don't
-have the PERL and other optional dependencies get an indication of how
+have the SYMLINKS and other optional dependencies get an indication of how
 many tests they're missing.
 
 If the test code is too hairy for that (i.e. does a lot of setup work
 outside test assertions) you can also skip all remaining tests by
 setting skip_all and immediately call test_done:
 
-	if ! test_have_prereq PERL
+	if ! test_have_prereq SYMLINKS
 	then
-	    skip_all='skipping perl interface tests, perl not available'
+	    skip_all="skipping symlink tests, the filesystem doesn't support it"
 	    test_done
 	fi
 
-- 
2.20.0.rc1.379.g1dd7ef354c


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

* [PATCH 2/5] t/README: modernize description of GIT_SKIP_TESTS
  2018-11-27 22:54 [PATCH 1/5] t/README: make the 'Skipping tests' section less confusing Ævar Arnfjörð Bjarmason
@ 2018-11-27 22:54 ` Ævar Arnfjörð Bjarmason
  2018-11-27 22:54 ` [PATCH 3/5] t/README: re-flow a paragraph Ævar Arnfjörð Bjarmason
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-11-27 22:54 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason

When the GIT_SKIP_TESTS documentation was added in
fbd458a3f6 ("t/README: Add 'Skipping Tests' section below 'Running
Tests'", 2008-06-20) there was no way to declare test prerequisites,
that came later in a7bb394037 ("test-lib: Infrastructure to test and
check for prerequisites", 2009-03-01).

The docs were newer updated, and have been saying that you might want
to use GIT_SKIP_TESTS for a use-case which we'd never use them for,
skipping tests because 'unzip' isn't there. For that we'd use the
UNZIP prerequisite added in 552a26c8c0 ("Use prerequisites to skip
tests that need unzip", 2009-03-16). Fix the docs accordingly.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/README | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/t/README b/t/README
index b6ec28f634..3139f4330a 100644
--- a/t/README
+++ b/t/README
@@ -202,20 +202,21 @@ GIT_TEST_EXEC_PATH defaults to `$GIT_TEST_INSTALLED/git --exec-path`.
 Skipping Tests
 --------------
 
-In some environments, certain tests have no way of succeeding
-due to platform limitation, such as lack of 'unzip' program, or
-filesystem that do not allow arbitrary sequence of non-NUL bytes
-as pathnames.
+Certain tests may fail intermittently or entirely. These should
+ideally be reported as bugs and fixed, or guarded by a prerequisite
+(see "Using test prerequisites" below). But until then they can be
+skipped.
 
-You should be able to say something like
+To skip tests, set the GIT_SKIP_TESTS variable. Individual tests can
+be skipped:
 
     $ GIT_SKIP_TESTS=t9200.8 sh ./t9200-git-cvsexport-commit.sh
 
-and even:
+Or tests matching a glob:
 
     $ GIT_SKIP_TESTS='t[0-4]??? t91?? t9200.8' make
 
-to omit such tests.  The value of the environment variable is a
+The value of the environment variable is a
 SP separated list of patterns that tells which tests to skip,
 and either can match the "t[0-9]{4}" part to skip the whole
 test, or t[0-9]{4} followed by ".$number" to say which
-- 
2.20.0.rc1.379.g1dd7ef354c


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

* [PATCH 3/5] t/README: re-flow a paragraph
  2018-11-27 22:54 [PATCH 1/5] t/README: make the 'Skipping tests' section less confusing Ævar Arnfjörð Bjarmason
  2018-11-27 22:54 ` [PATCH 2/5] t/README: modernize description of GIT_SKIP_TESTS Ævar Arnfjörð Bjarmason
@ 2018-11-27 22:54 ` Ævar Arnfjörð Bjarmason
  2018-11-27 22:54 ` [PATCH 4/5] test-lib: add more exhaustive GIT_SKIP_TESTS testing Ævar Arnfjörð Bjarmason
  2018-11-27 22:54 ` [PATCH 5/5] test-lib: add support for GIT_TODO_TESTS Ævar Arnfjörð Bjarmason
  3 siblings, 0 replies; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-11-27 22:54 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason

An earlier change changed this paragraph to make the first line quite
short as to produce a more minimal diff. Let's re-flow it. There's no
changes here if diffed with --word-diff.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/README | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/t/README b/t/README
index 3139f4330a..c03b268813 100644
--- a/t/README
+++ b/t/README
@@ -216,11 +216,10 @@ Or tests matching a glob:
 
     $ GIT_SKIP_TESTS='t[0-4]??? t91?? t9200.8' make
 
-The value of the environment variable is a
-SP separated list of patterns that tells which tests to skip,
-and either can match the "t[0-9]{4}" part to skip the whole
-test, or t[0-9]{4} followed by ".$number" to say which
-particular test to skip.
+The value of the environment variable is a SP separated list of
+patterns that tells which tests to skip, and either can match the
+"t[0-9]{4}" part to skip the whole test, or t[0-9]{4} followed by
+".$number" to say which particular test to skip.
 
 For an individual test suite --run could be used to specify that
 only some tests should be run or that some tests should be
-- 
2.20.0.rc1.379.g1dd7ef354c


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

* [PATCH 4/5] test-lib: add more exhaustive GIT_SKIP_TESTS testing
  2018-11-27 22:54 [PATCH 1/5] t/README: make the 'Skipping tests' section less confusing Ævar Arnfjörð Bjarmason
  2018-11-27 22:54 ` [PATCH 2/5] t/README: modernize description of GIT_SKIP_TESTS Ævar Arnfjörð Bjarmason
  2018-11-27 22:54 ` [PATCH 3/5] t/README: re-flow a paragraph Ævar Arnfjörð Bjarmason
@ 2018-11-27 22:54 ` Ævar Arnfjörð Bjarmason
  2018-11-27 22:54 ` [PATCH 5/5] test-lib: add support for GIT_TODO_TESTS Ævar Arnfjörð Bjarmason
  3 siblings, 0 replies; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-11-27 22:54 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason

Add a test for the when GIT_SKIP_TESTS is used to skip entire test
files. Support for this was added back in 04ece59399 ("GIT_SKIP_TESTS:
allow users to omit tests that are known to break", 2006-12-28), but
never tested for.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t0000-basic.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index b6566003dd..b87a8f18c2 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -393,6 +393,23 @@ test_expect_success 'GIT_SKIP_TESTS sh pattern' "
 	)
 "
 
+test_expect_success 'GIT_SKIP_TESTS entire file' "
+	(
+		GIT_SKIP_TESTS='git' && export GIT_SKIP_TESTS &&
+		run_sub_test_lib_test git-skip-tests-entire-file \
+			'GIT_SKIP_TESTS' <<-\\EOF &&
+		for i in 1 2 3
+		do
+			test_expect_success \"passing test #\$i\" 'true'
+		done
+		test_done
+		EOF
+		check_sub_test_lib_test git-skip-tests-entire-file <<-\\EOF
+		1..0 # SKIP skip all tests in git
+		EOF
+	)
+"
+
 test_expect_success '--run basic' "
 	run_sub_test_lib_test run-basic \
 		'--run basic' --run='1 3 5' <<-\\EOF &&
-- 
2.20.0.rc1.379.g1dd7ef354c


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

* [PATCH 5/5] test-lib: add support for GIT_TODO_TESTS
  2018-11-27 22:54 [PATCH 1/5] t/README: make the 'Skipping tests' section less confusing Ævar Arnfjörð Bjarmason
                   ` (2 preceding siblings ...)
  2018-11-27 22:54 ` [PATCH 4/5] test-lib: add more exhaustive GIT_SKIP_TESTS testing Ævar Arnfjörð Bjarmason
@ 2018-11-27 22:54 ` Ævar Arnfjörð Bjarmason
  2018-11-29  6:42   ` Junio C Hamano
  2018-12-04 14:46   ` SZEDER Gábor
  3 siblings, 2 replies; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2018-11-27 22:54 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason

As noted in the updated t/README documentation being added here
setting this new GIT_TODO_TESTS variable is usually better than
GIT_SKIP_TESTS.

My use-case for this is to get feedback from the CI infrastructure[1]
about which tests are passing due to fixes that have trickled into
git.git.

With the GIT_SKIP_TESTS variable this use-case is painful, you need to
do an occasional manual run without GIT_SKIP_TESTS set. It's much
better to use GIT_TODO_TESTS and get a report of passing TODO tests
from prove(1) at the bottom of the test output. Once those passing
TODO tests have trickled down to 'master' the relevant glob (set for
all of master/next/pu) can be removed.

As seen in the "GIT_TODO_TESTS mixed failure" test the lack of
interaction with existing tests marked as TODO by the test suite
itself is intentional. There's no need to print out something saying
they matched GIT_TODO_TESTS if they're already TODO tests.

1. https://public-inbox.org/git/875zwm15k2.fsf@evledraar.gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 ci/lib-travisci.sh |  2 +-
 t/README           | 18 +++++++++--
 t/t0000-basic.sh   | 81 +++++++++++++++++++++++++++++++++++++++-------
 t/test-lib.sh      | 31 +++++++++++++++---
 4 files changed, 112 insertions(+), 20 deletions(-)

diff --git a/ci/lib-travisci.sh b/ci/lib-travisci.sh
index 69dff4d1ec..ad8290bfdb 100755
--- a/ci/lib-travisci.sh
+++ b/ci/lib-travisci.sh
@@ -121,7 +121,7 @@ osx-clang|osx-gcc)
 	# t9810 occasionally fails on Travis CI OS X
 	# t9816 occasionally fails with "TAP out of sequence errors" on
 	# Travis CI OS X
-	export GIT_SKIP_TESTS="t9810 t9816"
+	export GIT_TODO_TESTS="t9810 t9816"
 	;;
 GIT_TEST_GETTEXT_POISON)
 	export GIT_TEST_GETTEXT_POISON=YesPlease
diff --git a/t/README b/t/README
index c03b268813..922b4fb3bf 100644
--- a/t/README
+++ b/t/README
@@ -207,8 +207,19 @@ ideally be reported as bugs and fixed, or guarded by a prerequisite
 (see "Using test prerequisites" below). But until then they can be
 skipped.
 
-To skip tests, set the GIT_SKIP_TESTS variable. Individual tests can
-be skipped:
+To skip tests, set either the GIT_SKIP_TESTS or GIT_TODO_TESTS
+variables. The difference is that with SKIP the tests won't be run at
+all, whereas they will be run with TODO, but in success or failure
+annotated as a TODO test.
+
+It's usually preferrable to use TODO, since the test suite will report
+those tests that unexpectedly succeed, which may indicate that
+whatever bug broke the test in the past has been fixed, and the test
+should be un-TODO'd. There's no such feedback loop with
+GIT_SKIP_TESTS.
+
+The GIT_SKIP_TESTS and GIT_TODO_TESTS take the same values. Individual
+tests can be skipped:
 
     $ GIT_SKIP_TESTS=t9200.8 sh ./t9200-git-cvsexport-commit.sh
 
@@ -223,7 +234,8 @@ patterns that tells which tests to skip, and either can match the
 
 For an individual test suite --run could be used to specify that
 only some tests should be run or that some tests should be
-excluded from a run.
+excluded from a run. The --run option is a shorthand for setting
+a GIT_SKIP_TESTS pattern.
 
 The argument for --run is a list of individual test numbers or
 ranges with an optional negation prefix that define what tests in
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index b87a8f18c2..34c9c5c2a3 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -324,9 +324,10 @@ test_expect_success 'test --verbose-only' '
 	EOF
 '
 
-test_expect_success 'GIT_SKIP_TESTS' "
+test_expect_success 'GIT_{SKIP,TODO}_TESTS' "
 	(
 		GIT_SKIP_TESTS='git.2' && export GIT_SKIP_TESTS &&
+		GIT_TODO_TESTS='git.3' && export GIT_TODO_TESTS &&
 		run_sub_test_lib_test git-skip-tests-basic \
 			'GIT_SKIP_TESTS' <<-\\EOF &&
 		for i in 1 2 3
@@ -338,16 +339,17 @@ test_expect_success 'GIT_SKIP_TESTS' "
 		check_sub_test_lib_test git-skip-tests-basic <<-\\EOF
 		> ok 1 - passing test #1
 		> ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
-		> ok 3 - passing test #3
-		> # passed all 3 test(s)
+		> ok 3 - passing test #3 # TODO (GIT_TODO_TESTS)
+		> # passed all 3 test(s) (including 1/0 ok/failing TODO test(s))
 		> 1..3
 		EOF
 	)
 "
 
-test_expect_success 'GIT_SKIP_TESTS several tests' "
+test_expect_success 'GIT_{SKIP,TODO}_TESTS several tests' "
 	(
 		GIT_SKIP_TESTS='git.2 git.5' && export GIT_SKIP_TESTS &&
+		GIT_TODO_TESTS='git.3 git.6' && export GIT_TODO_TESTS &&
 		run_sub_test_lib_test git-skip-tests-several \
 			'GIT_SKIP_TESTS several tests' <<-\\EOF &&
 		for i in 1 2 3 4 5 6
@@ -359,22 +361,25 @@ test_expect_success 'GIT_SKIP_TESTS several tests' "
 		check_sub_test_lib_test git-skip-tests-several <<-\\EOF
 		> ok 1 - passing test #1
 		> ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
-		> ok 3 - passing test #3
+		> ok 3 - passing test #3 # TODO (GIT_TODO_TESTS)
 		> ok 4 - passing test #4
 		> ok 5 # skip passing test #5 (GIT_SKIP_TESTS)
-		> ok 6 - passing test #6
-		> # passed all 6 test(s)
+		> ok 6 - passing test #6 # TODO (GIT_TODO_TESTS)
+		> # passed all 6 test(s) (including 2/0 ok/failing TODO test(s))
 		> 1..6
 		EOF
 	)
 "
 
-test_expect_success 'GIT_SKIP_TESTS sh pattern' "
+test_expect_success 'GIT_{SKIP,TODO}_TESTS sh pattern' "
 	(
 		GIT_SKIP_TESTS='git.[2-5]' && export GIT_SKIP_TESTS &&
+		# Overlap between SKIP and TODO. No attempt is made to
+		# be smart about it.
+		GIT_TODO_TESTS='git.[4-8]' && export GIT_TODO_TESTS &&
 		run_sub_test_lib_test git-skip-tests-sh-pattern \
 			'GIT_SKIP_TESTS sh pattern' <<-\\EOF &&
-		for i in 1 2 3 4 5 6
+		for i in 1 2 3 4 5 6 7 8 9
 		do
 			test_expect_success \"passing test #\$i\" 'true'
 		done
@@ -386,9 +391,12 @@ test_expect_success 'GIT_SKIP_TESTS sh pattern' "
 		> ok 3 # skip passing test #3 (GIT_SKIP_TESTS)
 		> ok 4 # skip passing test #4 (GIT_SKIP_TESTS)
 		> ok 5 # skip passing test #5 (GIT_SKIP_TESTS)
-		> ok 6 - passing test #6
-		> # passed all 6 test(s)
-		> 1..6
+		> ok 6 - passing test #6 # TODO (GIT_TODO_TESTS)
+		> ok 7 - passing test #7 # TODO (GIT_TODO_TESTS)
+		> ok 8 - passing test #8 # TODO (GIT_TODO_TESTS)
+		> ok 9 - passing test #9
+		> # passed all 9 test(s) (including 3/0 ok/failing TODO test(s))
+		> 1..9
 		EOF
 	)
 "
@@ -410,6 +418,55 @@ test_expect_success 'GIT_SKIP_TESTS entire file' "
 	)
 "
 
+test_expect_success 'GIT_TODO_TESTS entire file' "
+	(
+		GIT_TODO_TESTS='git' && export GIT_TODO_TESTS &&
+		run_sub_test_lib_test git-todo-tests-entire-file \
+			'GIT_TODO_TESTS' <<-\\EOF &&
+		for i in 1 2 3
+		do
+			test_expect_success \"failing test #\$i\" 'fail'
+		done
+		test_done
+		EOF
+		check_sub_test_lib_test git-todo-tests-entire-file <<-\\EOF
+		not ok 1 - failing test #1 # TODO (GIT_TODO_TESTS)
+		#	fail
+		not ok 2 - failing test #2 # TODO (GIT_TODO_TESTS)
+		#	fail
+		not ok 3 - failing test #3 # TODO (GIT_TODO_TESTS)
+		#	fail
+		# passed all 3 test(s) (including 0/3 ok/failing TODO test(s))
+		1..3
+		EOF
+	)
+"
+
+test_expect_success 'GIT_TODO_TESTS mixed failure' "
+	(
+		GIT_TODO_TESTS='git' && export GIT_TODO_TESTS &&
+		run_sub_test_lib_test git-todo-tests-mixed \
+			'GIT_TODO_TESTS' <<-\\EOF &&
+		test_expect_success \"success\" 'true'
+		test_expect_success \"success\" 'false'
+		test_expect_failure \"success\" 'true'
+		test_expect_failure \"success\" 'false'
+		test_done
+		EOF
+		check_sub_test_lib_test git-todo-tests-mixed <<-\\EOF
+		ok 1 - success # TODO (GIT_TODO_TESTS)
+		not ok 2 - success # TODO (GIT_TODO_TESTS)
+		#	false
+		ok 3 - success # TODO known breakage vanished
+		not ok 4 - success # TODO known breakage
+		# 1 known breakage(s) vanished; please update test(s)
+		# still have 1 known breakage(s)
+		# passed all remaining 2 test(s) (including 1/1 ok/failing TODO test(s))
+		1..4
+		EOF
+	)
+"
+
 test_expect_success '--run basic' "
 	run_sub_test_lib_test run-basic \
 		'--run basic' --run='1 3 5' <<-\\EOF &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 6c6c0af7a1..ccd316e7bd 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -456,6 +456,8 @@ test_count=0
 test_fixed=0
 test_broken=0
 test_success=0
+test_todo_success=0
+test_todo_failure=0
 
 test_external_has_tap=0
 
@@ -482,13 +484,29 @@ trap 'exit $?' INT
 # the test_expect_* functions instead.
 
 test_ok_ () {
+	todo_blurb=
+	if match_pattern_list $this_test.$test_count $GIT_TODO_TESTS ||
+		    match_pattern_list $this_test $GIT_TODO_TESTS
+	then
+		todo_blurb=' # TODO (GIT_TODO_TESTS)'
+		test_todo_success=$(($test_todo_success + 1))
+	fi
 	test_success=$(($test_success + 1))
-	say_color "" "ok $test_count - $@"
+	say_color "" "ok $test_count - $@$todo_blurb"
 }
 
 test_failure_ () {
-	test_failure=$(($test_failure + 1))
-	say_color error "not ok $test_count - $1"
+	todo_blurb=
+	if match_pattern_list $this_test.$test_count $GIT_TODO_TESTS ||
+		    match_pattern_list $this_test $GIT_TODO_TESTS
+	then
+		test_success=$(($test_success + 1))
+		test_todo_failure=$(($test_todo_failure + 1))
+		todo_blurb=' # TODO (GIT_TODO_TESTS)'
+	else
+		test_failure=$(($test_failure + 1))
+	fi
+	say_color error "not ok $test_count - $1$todo_blurb"
 	shift
 	printf '%s\n' "$*" | sed -e 's/^/#	/'
 	test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }
@@ -845,13 +863,18 @@ test_done () {
 		test_remaining=$test_count
 		msg="$test_count test(s)"
 	fi
+	msg_todo=
+	if test "$test_todo_success" != 0 || test "$test_todo_failure" != 0
+	then
+		msg_todo=" (including $test_todo_success/$test_todo_failure ok/failing TODO test(s))"
+	fi
 	case "$test_failure" in
 	0)
 		if test $test_external_has_tap -eq 0
 		then
 			if test $test_remaining -gt 0
 			then
-				say_color pass "# passed all $msg"
+				say_color pass "# passed all $msg$msg_todo"
 			fi
 
 			# Maybe print SKIP message
-- 
2.20.0.rc1.379.g1dd7ef354c


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

* Re: [PATCH 5/5] test-lib: add support for GIT_TODO_TESTS
  2018-11-27 22:54 ` [PATCH 5/5] test-lib: add support for GIT_TODO_TESTS Ævar Arnfjörð Bjarmason
@ 2018-11-29  6:42   ` Junio C Hamano
  2018-12-04 14:46   ` SZEDER Gábor
  1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2018-11-29  6:42 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: git

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> -To skip tests, set the GIT_SKIP_TESTS variable. Individual tests can
> -be skipped:
> +To skip tests, set either the GIT_SKIP_TESTS or GIT_TODO_TESTS
> +variables. The difference is that with SKIP the tests won't be run at
> +all, whereas they will be run with TODO, but in success or failure
> +annotated as a TODO test.

It is entirely unclear what "They will be run with TODO" means.

I know what you want to achieve from the code change; instead of
just skipping, you want to cause as much side effect the skipped
test piece wants to make until it fails and dies, without taking
the remainder of the test down.  And I kind of agree that sometimes
such a mode would be very useful (i.e. when you do not want to
bother separating such a failing test properly into the setup part
that would affect later tests and the one-thing-it-wants-to-test
part that can now be safely skipped).  From the cursory look, the
code change in this patch is sensible realization of that idea.

Having said all that, I won't picking this up until next month ;-) I
really want to see that everybody is concentrating on making sure
that 2.20 is solid before playing with shiny new toys.

Thanks.


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

* Re: [PATCH 5/5] test-lib: add support for GIT_TODO_TESTS
  2018-11-27 22:54 ` [PATCH 5/5] test-lib: add support for GIT_TODO_TESTS Ævar Arnfjörð Bjarmason
  2018-11-29  6:42   ` Junio C Hamano
@ 2018-12-04 14:46   ` SZEDER Gábor
  1 sibling, 0 replies; 7+ messages in thread
From: SZEDER Gábor @ 2018-12-04 14:46 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: git, Junio C Hamano

On Tue, Nov 27, 2018 at 11:54:45PM +0100, Ævar Arnfjörð Bjarmason wrote:
> As noted in the updated t/README documentation being added here
> setting this new GIT_TODO_TESTS variable is usually better than
> GIT_SKIP_TESTS.

I don't see why this is "usually better".  I get how it can help your
particular use-case described below, but that doesn't mean that it's
"usually better".

> My use-case for this is to get feedback from the CI infrastructure[1]
> about which tests are passing due to fixes that have trickled into
> git.git.
> 
> With the GIT_SKIP_TESTS variable this use-case is painful, you need to
> do an occasional manual run without GIT_SKIP_TESTS set. It's much
> better to use GIT_TODO_TESTS and get a report of passing TODO tests
> from prove(1) at the bottom of the test output. Once those passing
> TODO tests have trickled down to 'master' the relevant glob (set for
> all of master/next/pu) can be removed.

Neither from the commit message nor from the documentation is it clear
to me what the result of 'make test' will be when a test listed in
GIT_TODO_TESTS fails.

> As seen in the "GIT_TODO_TESTS mixed failure" test the lack of
> interaction with existing tests marked as TODO by the test suite
> itself is intentional. There's no need to print out something saying
> they matched GIT_TODO_TESTS if they're already TODO tests.
> 
> 1. https://public-inbox.org/git/875zwm15k2.fsf@evledraar.gmail.com/
> 
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  ci/lib-travisci.sh |  2 +-
>  t/README           | 18 +++++++++--
>  t/t0000-basic.sh   | 81 +++++++++++++++++++++++++++++++++++++++-------
>  t/test-lib.sh      | 31 +++++++++++++++---
>  4 files changed, 112 insertions(+), 20 deletions(-)
> 
> diff --git a/ci/lib-travisci.sh b/ci/lib-travisci.sh
> index 69dff4d1ec..ad8290bfdb 100755
> --- a/ci/lib-travisci.sh
> +++ b/ci/lib-travisci.sh
> @@ -121,7 +121,7 @@ osx-clang|osx-gcc)
>  	# t9810 occasionally fails on Travis CI OS X
>  	# t9816 occasionally fails with "TAP out of sequence errors" on
>  	# Travis CI OS X
> -	export GIT_SKIP_TESTS="t9810 t9816"
> +	export GIT_TODO_TESTS="t9810 t9816"

This change is not mentioned in the commit message.

As noted in the hunk's context, these test scripts are not skipped
because they don't work on OSX at all, but because they are flaky.
Consequently, reporting them as "maybe should be un-TODO'd" when they
happen to succeed is pointless and will just lead to confusion, so
this seems to be a case when GIT_TODO_TESTS is actually worse than
GIT_SKIP_TESTS.

If a failing test in GIT_TODO_TESTS makes the whole 'make test' fail,
then this should be most definitely left as GIT_SKIP_TESTS.

>  	;;
>  GIT_TEST_GETTEXT_POISON)
>  	export GIT_TEST_GETTEXT_POISON=YesPlease
> diff --git a/t/README b/t/README
> index c03b268813..922b4fb3bf 100644
> --- a/t/README
> +++ b/t/README
> @@ -207,8 +207,19 @@ ideally be reported as bugs and fixed, or guarded by a prerequisite
>  (see "Using test prerequisites" below). But until then they can be
>  skipped.
>  
> -To skip tests, set the GIT_SKIP_TESTS variable. Individual tests can
> -be skipped:
> +To skip tests, set either the GIT_SKIP_TESTS or GIT_TODO_TESTS
> +variables. The difference is that with SKIP the tests won't be run at
> +all, whereas they will be run with TODO, but in success or failure
> +annotated as a TODO test.

This is confusing.  "To skip" a test means that the test is not run at
all.  Now, if GIT_TODO_TESTS were to run the listed tests, then it
definitely won't skip them, so this sentence contradicts the previous
one.

What does "annotated as a TODO test" mean?  Something similar to how
'test_expect_failure' works?

> +It's usually preferrable to use TODO, since the test suite will report
> +those tests that unexpectedly succeed, which may indicate that
> +whatever bug broke the test in the past has been fixed, and the test
> +should be un-TODO'd. There's no such feedback loop with
> +GIT_SKIP_TESTS.
> +
> +The GIT_SKIP_TESTS and GIT_TODO_TESTS take the same values. Individual
> +tests can be skipped:
>  
>      $ GIT_SKIP_TESTS=t9200.8 sh ./t9200-git-cvsexport-commit.sh
>  
> @@ -223,7 +234,8 @@ patterns that tells which tests to skip, and either can match the
>  
>  For an individual test suite --run could be used to specify that
>  only some tests should be run or that some tests should be
> -excluded from a run.
> +excluded from a run. The --run option is a shorthand for setting
> +a GIT_SKIP_TESTS pattern.
>  
>  The argument for --run is a list of individual test numbers or
>  ranges with an optional negation prefix that define what tests in

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27 22:54 [PATCH 1/5] t/README: make the 'Skipping tests' section less confusing Ævar Arnfjörð Bjarmason
2018-11-27 22:54 ` [PATCH 2/5] t/README: modernize description of GIT_SKIP_TESTS Ævar Arnfjörð Bjarmason
2018-11-27 22:54 ` [PATCH 3/5] t/README: re-flow a paragraph Ævar Arnfjörð Bjarmason
2018-11-27 22:54 ` [PATCH 4/5] test-lib: add more exhaustive GIT_SKIP_TESTS testing Ævar Arnfjörð Bjarmason
2018-11-27 22:54 ` [PATCH 5/5] test-lib: add support for GIT_TODO_TESTS Ævar Arnfjörð Bjarmason
2018-11-29  6:42   ` Junio C Hamano
2018-12-04 14:46   ` SZEDER Gábor

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox