From: Ilya Bobyr <ilya.bobyr@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Thomas Rast <trast@inf.ethz.ch>,
Eric Sunshine <sunshine@sunshineco.com>,
Ramsay Jones <ramsay@ramsay1.demon.co.uk>,
Ilya Bobyr <ilya.bobyr@gmail.com>
Subject: [PATCH 2/3] test-lib: tests skipped by GIT_SKIP_TESTS say so
Date: Tue, 22 Apr 2014 01:19:26 -0700 [thread overview]
Message-ID: <1398154767-1276-3-git-send-email-ilya.bobyr@gmail.com> (raw)
In-Reply-To: <1398154767-1276-1-git-send-email-ilya.bobyr@gmail.com>
We used to show "(missing )" next to tests skipped because they are
specified in GIT_SKIP_TESTS. Use "(GIT_SKIP_TESTS)" instead.
Plus tests that check basic GIT_SKIP_TESTS functions.
Signed-off-by: Ilya Bobyr <ilya.bobyr@gmail.com>
---
t/t0000-basic.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
t/test-lib.sh | 13 ++++++----
2 files changed, 71 insertions(+), 5 deletions(-)
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index a2bb63c..ae8874e 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -270,6 +270,69 @@ test_expect_success 'test --verbose-only' '
EOF
'
+test_expect_success 'GIT_SKIP_TESTS' "
+ GIT_SKIP_TESTS='git.2' \
+ run_sub_test_lib_test git-skip-tests-basic \
+ '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-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)
+ > 1..3
+ EOF
+"
+
+test_expect_success 'GIT_SKIP_TESTS several tests' "
+ GIT_SKIP_TESTS='git.2 git.5' \
+ run_sub_test_lib_test git-skip-tests-several \
+ 'GIT_SKIP_TESTS several tests' <<-\\EOF &&
+ for i in 1 2 3 4 5 6
+ do
+ test_expect_success \"passing test #\$i\" 'true'
+ done
+ test_done
+ EOF
+ 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 4 - passing test #4
+ > ok 5 # skip passing test #5 (GIT_SKIP_TESTS)
+ > ok 6 - passing test #6
+ > # passed all 6 test(s)
+ > 1..6
+ EOF
+"
+
+test_expect_success 'GIT_SKIP_TESTS sh pattern' "
+ GIT_SKIP_TESTS='git.[2-5]' \
+ 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
+ do
+ test_expect_success \"passing test #\$i\" 'true'
+ done
+ test_done
+ EOF
+ check_sub_test_lib_test git-skip-tests-sh-pattern <<-\\EOF
+ > ok 1 - passing test #1
+ > ok 2 # skip passing test #2 (GIT_SKIP_TESTS)
+ > 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
+ EOF
+"
+
test_set_prereq HAVEIT
haveit=no
test_expect_success HAVEIT 'test runs if prerequisite is satisfied' '
diff --git a/t/test-lib.sh b/t/test-lib.sh
index c081668..e7d9c51 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -452,25 +452,28 @@ test_finish_ () {
test_skip () {
to_skip=
+ skipped_reason=
if match_pattern_list $this_test.$test_count $GIT_SKIP_TESTS
then
to_skip=t
+ skipped_reason="GIT_SKIP_TESTS"
fi
if test -z "$to_skip" && test -n "$test_prereq" &&
! test_have_prereq "$test_prereq"
then
to_skip=t
- fi
- case "$to_skip" in
- t)
+
of_prereq=
if test "$missing_prereq" != "$test_prereq"
then
of_prereq=" of $test_prereq"
fi
-
+ skipped_reason="missing $missing_prereq${of_prereq}"
+ fi
+ case "$to_skip" in
+ t)
say_color skip >&3 "skipping test: $@"
- say_color skip "ok $test_count # skip $1 (missing $missing_prereq${of_prereq})"
+ say_color skip "ok $test_count # skip $1 ($skipped_reason)"
: true
;;
*)
--
1.7.9
next prev parent reply other threads:[~2014-04-22 8:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-22 8:19 [RFC/PATCH v3] Better control of the tests run by a test suite Ilya Bobyr
2014-04-22 8:19 ` [PATCH 1/3] test-lib: Document short options in t/README Ilya Bobyr
2014-04-23 18:24 ` Junio C Hamano
2014-04-30 9:38 ` Ilya Bobyr
2014-04-22 8:19 ` Ilya Bobyr [this message]
2014-04-22 8:19 ` [PATCH 3/3] test-lib: '--run' to run only specific tests Ilya Bobyr
2014-04-23 18:40 ` Junio C Hamano
2014-04-30 9:40 ` Ilya Bobyr
2014-04-30 14:17 ` Junio C Hamano
2014-04-23 19:51 ` Eric Sunshine
2014-04-30 9:41 ` Ilya Bobyr
2014-04-30 9:50 ` [RFC/PATCH v4] Better control of the tests run by a test suite Ilya Bobyr
2014-04-30 9:50 ` [PATCH 1/3] test-lib: Document short options in t/README Ilya Bobyr
2014-04-30 9:50 ` [PATCH 2/3] test-lib: tests skipped by GIT_SKIP_TESTS say so Ilya Bobyr
2014-04-30 9:50 ` [PATCH 3/3] test-lib: '--run' to run only specific tests Ilya Bobyr
2014-05-06 20:53 ` Junio C Hamano
2014-05-06 21:02 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2014-03-24 8:49 [RFC/PATCH] Better control of the tests run by a test suite Ilya Bobyr
2014-03-24 8:49 ` [PATCH 2/3] test-lib: tests skipped by GIT_SKIP_TESTS say so Ilya Bobyr
2014-03-27 10:32 ` [RFC/PATCH v2] Better control of the tests run by a test suite Ilya Bobyr
2014-03-27 10:32 ` [PATCH 2/3] test-lib: tests skipped by GIT_SKIP_TESTS say so Ilya Bobyr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1398154767-1276-3-git-send-email-ilya.bobyr@gmail.com \
--to=ilya.bobyr@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ramsay@ramsay1.demon.co.uk \
--cc=sunshine@sunshineco.com \
--cc=trast@inf.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).