git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: "Eric Sunshine" <sunshine@sunshineco.com>,
	"Johannes Sixt" <j6t@kdbg.org>,
	"SZEDER Gábor" <szeder.dev@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH v6 00/14] t5520: various test cleanup
Date: Tue, 12 Nov 2019 15:07:43 -0800	[thread overview]
Message-ID: <cover.1573595985.git.liu.denton@gmail.com> (raw)
In-Reply-To: <cover.1573517561.git.liu.denton@gmail.com>

Thanks for the comments on the last round, Junio.

Please ignore the fixup patch from earlier, it has been bundled into
this reroll.


Like earlier patchsets, I want to implement a feature that involves
modifications to the test suite. Since that feature will probably take a
while to polish up, however, let's clean up the test suite in a separate
patchset first so it's not blocked by the feature work.

1/15 is a general improvement to test_rev_cmp() that will be used later
in the series.

Changes since v5:

* More test_cmp_rev() cleanup

* Changed instances of "subshell" to "command substitution" where appropriate

* Change instances of "Git" to "git" when we are referring to the command

Changes since v4:

* Cleaned up test_cmp_rev() logic with suggestions from Junio

Changes since v3:

* Rebased and tested on top of v2.24.0

Changes since v2:

* Drop 't7408: replace `test_must_fail test_path_is_file`' since it's
  not a rabbit hole we want to go into right now

* Fix the output of `test_cmp_rev !` when revs are actually equal

* Rebase against the latest master since this topic hasn't been picked
  up yet

Changes since v1:

* Incorporate Eric's feedback

Denton Liu (14):
  t: teach test_cmp_rev to accept ! for not-equals
  t5520: improve test style
  t5520: use sq for test case names
  t5520: let sed open its own input
  t5520: replace test -f with test-lib functions
  t5520: remove spaces after redirect operator
  t5520: use test_line_count where possible
  t5520: replace test -{n,z} with test-lib functions
  t5520: use test_cmp_rev where possible
  t5520: test single-line files by git with test_cmp
  t5520: don't put git in upstream of pipe
  t5520: replace $(cat ...) comparison with test_cmp
  t5520: remove redundant lines in test cases
  t5520: replace `! git` with `test_must_fail git`

 t/t2400-worktree-add.sh             |   4 +-
 t/t3400-rebase.sh                   |   2 +-
 t/t3421-rebase-topology-linear.sh   |   6 +-
 t/t3430-rebase-merges.sh            |   2 +-
 t/t3432-rebase-fast-forward.sh      |   2 +-
 t/t3501-revert-cherry-pick.sh       |   2 +-
 t/t3508-cherry-pick-many-commits.sh |   2 +-
 t/t5520-pull.sh                     | 343 +++++++++++++++++-----------
 t/test-lib-functions.sh             |  20 +-
 9 files changed, 231 insertions(+), 152 deletions(-)

Range-diff against v5:
 1:  85fac754e2 !  1:  0532847787 t: teach test_cmp_rev to accept ! for not-equals
    @@ t/test-lib-functions.sh: test_must_be_empty () {
     +# provided first, that its other two parameters refer to different
     +# revisions.
      test_cmp_rev () {
    -+	local op
    ++	local op wrong_result
     +	op='='
    ++	wrong_result='different'
     +	if test $# -ge 1 && test "x$1" = 'x!'
     +	then
     +	    op='!='
    ++	    wrong_result='the same'
     +	    shift
     +	fi
      	if test $# != 2
    @@ t/test-lib-functions.sh: test_must_be_empty () {
     +
     +		if ! test "$r1" "$op" "$r2"
      		then
    -+			local comp_out
    -+			if "x$op" = 'x='
    -+			then
    -+				comp_out='different'
    -+			else
    -+				comp_out='the same'
    -+			fi
      			cat >&4 <<-EOF
     -			error: two revisions point to different objects:
    -+			error: two revisions point to $comp_out objects:
    ++			error: two revisions point to $wrong_result objects:
      			  '$1': $r1
      			  '$2': $r2
      			EOF
 2:  2b1caec3d7 =  2:  aa3f2e3395 t5520: improve test style
 3:  1aa0cdad1c =  3:  99b0fb0e1c t5520: use sq for test case names
 4:  edd4446554 =  4:  0660aa3fff t5520: let sed open its own input
 5:  c5d5966405 =  5:  00b7143b30 t5520: replace test -f with test-lib functions
 6:  6a99400ba4 =  6:  c451940c5b t5520: remove spaces after redirect operator
 7:  b7b66b13f6 =  7:  8e1c90eb70 t5520: use test_line_count where possible
 8:  07517c868c !  8:  8043b230a7 t5520: replace test -{n,z} with test-lib functions
    @@ Metadata
      ## Commit message ##
         t5520: replace test -{n,z} with test-lib functions
     
    -    When wrapping a Git command in a subshell within another command, we
    -    throw away the Git command's exit code. In case the Git command fails,
    -    we would like to know about it rather than the failure being silent.
    -    Extract Git commands so that their exit codes are not lost.
    +    When wrapping a git command in a command substitution within another
    +    command, we throw away the git command's exit code. In case the git
    +    command fails, we would like to know about it rather than the failure
    +    being silent. Extract git commands so that their exit codes are not
    +    lost.
     
         Instead of using `test -n` or `test -z`, replace them respectively with
         invocations of test_file_not_empty() and test_must_be_empty() so that we
 9:  29d9ff3b21 !  9:  7f5347bb40 t5520: use test_cmp_rev where possible
    @@ Metadata
      ## Commit message ##
         t5520: use test_cmp_rev where possible
     
    -    In case an invocation of `git rev-list` fails within the subshell, the
    -    failure will be masked. Remove the subshell and use test_cmp_rev() so
    -    that failures can be discovered.
    +    In case an invocation of `git rev-list` fails within the command
    +    substitution, the failure will be masked. Remove the command
    +    substitution and use test_cmp_rev() so that failures can be discovered.
     
         This change was done with the following sed expressions:
     
10:  aeaa3374a7 ! 10:  73004d6cc3 t5520: test single-line files by git with test_cmp
    @@ Metadata
      ## Commit message ##
         t5520: test single-line files by git with test_cmp
     
    -    In case an invocation of a Git command fails within the subshell, the
    -    failure will be masked. Replace the subshell with a file-redirection and
    -    a call to test_cmp.
    +    In case an invocation of a git command fails within the command
    +    substitution, the failure will be masked. Replace the command
    +    substitution with a file-redirection and a call to test_cmp.
     
         This change was done with the following GNU sed expressions:
     
11:  131609fc5c ! 11:  463f5c11b9 t5520: don't put git in upstream of pipe
    @@ Commit message
     
         Before, if the invocation of git failed, it would be masked by the pipe
         since only the return code of the last element of a pipe is used.
    -    Rewrite the test to put the Git command on its own line so its return
    +    Rewrite the test to put the git command on its own line so its return
         code is not masked.
     
      ## t/t5520-pull.sh ##
12:  c67be3d18c ! 12:  67ea3f0238 t5520: replace subshell cat comparison with test_cmp
    @@ Metadata
     Author: Denton Liu <liu.denton@gmail.com>
     
      ## Commit message ##
    -    t5520: replace subshell cat comparison with test_cmp
    +    t5520: replace $(cat ...) comparison with test_cmp
     
         We currently have many instances of `test <line> = $(cat <file>)` and
         `test $(cat <file>) = <line>`.  In the case where this fails, it will be
13:  04ef898857 = 13:  b45c088d20 t5520: remove redundant lines in test cases
14:  153ff07dc0 ! 14:  c605afa537 t5520: replace `! git` with `test_must_fail git`
    @@ Metadata
      ## Commit message ##
         t5520: replace `! git` with `test_must_fail git`
     
    -    Currently, if a Git command fails in an unexpected way, such as a
    +    Currently, if a git command fails in an unexpected way, such as a
         segfault, it will be masked and ignored. Replace the ! with
         test_must_fail so that only expected failures pass.
     
-- 
2.24.0.346.gee0de6d492


  parent reply	other threads:[~2019-11-12 23:07 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 23:16 [PATCH 00/12] t5520: various test cleanup Denton Liu
2019-10-17 23:16 ` [PATCH 01/12] t5520: improve test style Denton Liu
2019-10-17 23:16 ` [PATCH 02/12] t5520: use sq for test case names Denton Liu
2019-10-17 23:17 ` [PATCH 03/12] t5520: let sed open its own input Denton Liu
2019-10-17 23:17 ` [PATCH 04/12] t5520: replace test -f with test_path_is_file Denton Liu
2019-10-17 23:26   ` Eric Sunshine
2019-10-17 23:35   ` [PATCH 4.5/12] t5520: replace test -f with test-lib functions Denton Liu
2019-10-18  0:11     ` Eric Sunshine
2019-10-17 23:17 ` [PATCH 05/12] t5520: remove spaces after redirect operator Denton Liu
2019-10-17 23:17 ` [PATCH 06/12] t5520: use test_line_count where possible Denton Liu
2019-10-17 23:17 ` [PATCH 07/12] t5520: replace test -{n,z} with test-lib functions Denton Liu
2019-10-17 23:31   ` Eric Sunshine
2019-10-17 23:17 ` [PATCH 08/12] t5520: use test_cmp_rev where possible Denton Liu
2019-10-17 23:41   ` Eric Sunshine
2019-10-18 18:52     ` Denton Liu
2019-10-23 13:53       ` Eric Sunshine
2019-10-17 23:17 ` [PATCH 09/12] t5520: test single-line files by git with test_cmp Denton Liu
2019-10-17 23:49   ` Eric Sunshine
2019-10-17 23:17 ` [PATCH 10/12] t5520: don't put git in upstream of pipe Denton Liu
2019-10-17 23:17 ` [PATCH 11/12] t5520: replace subshell cat comparison with test_cmp Denton Liu
2019-10-17 23:17 ` [PATCH 12/12] t5520: replace `! git` with `test_must_fail git` Denton Liu
2019-10-18 22:10 ` [PATCH v2 00/15] t5520: various test cleanup Denton Liu
2019-10-18 22:04   ` [PATCH v2 01/15] t7408: replace `test_must_fail test_path_is_file` Denton Liu
2019-10-19 11:58     ` Johannes Sixt
2019-10-18 22:04   ` [PATCH v2 09/15] t5520: replace test -{n,z} with test-lib functions Denton Liu
2019-10-18 22:04   ` [PATCH v2 11/15] t5520: test single-line files by git with test_cmp Denton Liu
2019-10-18 22:10   ` [PATCH v2 02/15] t: teach test_cmp_rev to accept ! for not-equals Denton Liu
2019-10-18 22:45     ` SZEDER Gábor
2019-10-18 22:10   ` [PATCH v2 03/15] t5520: improve test style Denton Liu
2019-10-18 22:10   ` [PATCH v2 04/15] t5520: use sq for test case names Denton Liu
2019-10-18 22:10   ` [PATCH v2 05/15] t5520: let sed open its own input Denton Liu
2019-10-18 22:10   ` [PATCH v2 06/15] t5520: replace test -f with test-lib functions Denton Liu
2019-10-18 22:10   ` [PATCH v2 07/15] t5520: remove spaces after redirect operator Denton Liu
2019-10-18 22:10   ` [PATCH v2 08/15] t5520: use test_line_count where possible Denton Liu
2019-10-18 22:10   ` [PATCH v2 10/15] t5520: use test_cmp_rev " Denton Liu
2019-10-18 22:10   ` [PATCH v2 12/15] t5520: don't put git in upstream of pipe Denton Liu
2019-10-18 22:10   ` [PATCH v2 13/15] t5520: replace subshell cat comparison with test_cmp Denton Liu
2019-10-18 22:10   ` [PATCH v2 14/15] t5520: remove redundant lines in test cases Denton Liu
2019-10-18 22:10   ` [PATCH v2 15/15] t5520: replace `! git` with `test_must_fail git` Denton Liu
2019-10-18 22:14   ` [PATCH v2 00/15] t5520: various test cleanup Denton Liu
2019-10-22 10:19   ` [PATCH v3 00/14] " Denton Liu
2019-10-22 10:19     ` [PATCH v3 01/14] t: teach test_cmp_rev to accept ! for not-equals Denton Liu
2019-10-22 10:19     ` [PATCH v3 02/14] t5520: improve test style Denton Liu
2019-10-22 10:19     ` [PATCH v3 03/14] t5520: use sq for test case names Denton Liu
2019-10-22 10:20     ` [PATCH v3 04/14] t5520: let sed open its own input Denton Liu
2019-10-22 10:20     ` [PATCH v3 05/14] t5520: replace test -f with test-lib functions Denton Liu
2019-10-22 10:20     ` [PATCH v3 06/14] t5520: remove spaces after redirect operator Denton Liu
2019-10-22 10:20     ` [PATCH v3 07/14] t5520: use test_line_count where possible Denton Liu
2019-10-22 10:20     ` [PATCH v3 08/14] t5520: replace test -{n,z} with test-lib functions Denton Liu
2019-10-22 10:20     ` [PATCH v3 09/14] t5520: use test_cmp_rev where possible Denton Liu
2019-10-22 10:20     ` [PATCH v3 10/14] t5520: test single-line files by git with test_cmp Denton Liu
2019-10-22 10:20     ` [PATCH v3 11/14] t5520: don't put git in upstream of pipe Denton Liu
2019-10-22 10:20     ` [PATCH v3 12/14] t5520: replace subshell cat comparison with test_cmp Denton Liu
2019-10-22 10:20     ` [PATCH v3 13/14] t5520: remove redundant lines in test cases Denton Liu
2019-10-22 10:20     ` [PATCH v3 14/14] t5520: replace `! git` with `test_must_fail git` Denton Liu
2019-10-24 23:21     ` [PATCH v3 00/14] t5520: various test cleanup Denton Liu
2019-10-25  3:44       ` Junio C Hamano
2019-11-04 19:17         ` Denton Liu
2019-11-06  2:37           ` Junio C Hamano
2019-11-07 18:51     ` [PATCH v4 " Denton Liu
2019-11-07 18:51       ` [PATCH v4 01/14] t: teach test_cmp_rev to accept ! for not-equals Denton Liu
2019-11-08  3:24         ` Junio C Hamano
2019-11-08  8:23           ` Denton Liu
2019-11-08 12:49             ` Junio C Hamano
2019-11-08 21:19               ` Denton Liu
2019-11-10  6:58                 ` Junio C Hamano
2019-11-07 18:51       ` [PATCH v4 02/14] t5520: improve test style Denton Liu
2019-11-07 18:51       ` [PATCH v4 03/14] t5520: use sq for test case names Denton Liu
2019-11-07 18:51       ` [PATCH v4 04/14] t5520: let sed open its own input Denton Liu
2019-11-07 18:51       ` [PATCH v4 05/14] t5520: replace test -f with test-lib functions Denton Liu
2019-11-07 18:51       ` [PATCH v4 06/14] t5520: remove spaces after redirect operator Denton Liu
2019-11-07 18:51       ` [PATCH v4 07/14] t5520: use test_line_count where possible Denton Liu
2019-11-07 18:51       ` [PATCH v4 08/14] t5520: replace test -{n,z} with test-lib functions Denton Liu
2019-11-07 18:51       ` [PATCH v4 09/14] t5520: use test_cmp_rev where possible Denton Liu
2019-11-07 18:51       ` [PATCH v4 10/14] t5520: test single-line files by git with test_cmp Denton Liu
2019-11-07 18:51       ` [PATCH v4 11/14] t5520: don't put git in upstream of pipe Denton Liu
2019-11-07 18:51       ` [PATCH v4 12/14] t5520: replace subshell cat comparison with test_cmp Denton Liu
2019-11-07 18:51       ` [PATCH v4 13/14] t5520: remove redundant lines in test cases Denton Liu
2019-11-07 18:51       ` [PATCH v4 14/14] t5520: replace `! git` with `test_must_fail git` Denton Liu
2019-11-12  0:13       ` [PATCH v5 00/14] t5520: various test cleanup Denton Liu
2019-11-12  0:13         ` [PATCH v5 01/14] t: teach test_cmp_rev to accept ! for not-equals Denton Liu
2019-11-12  6:52           ` Junio C Hamano
2019-11-12 19:38             ` [PATCH] fixup! " Denton Liu
2019-11-12  0:13         ` [PATCH v5 02/14] t5520: improve test style Denton Liu
2019-11-12  0:13         ` [PATCH v5 03/14] t5520: use sq for test case names Denton Liu
2019-11-12  0:13         ` [PATCH v5 04/14] t5520: let sed open its own input Denton Liu
2019-11-12  0:13         ` [PATCH v5 05/14] t5520: replace test -f with test-lib functions Denton Liu
2019-11-12  0:13         ` [PATCH v5 06/14] t5520: remove spaces after redirect operator Denton Liu
2019-11-12  0:13         ` [PATCH v5 07/14] t5520: use test_line_count where possible Denton Liu
2019-11-12  0:13         ` [PATCH v5 08/14] t5520: replace test -{n,z} with test-lib functions Denton Liu
2019-11-12  0:14         ` [PATCH v5 09/14] t5520: use test_cmp_rev where possible Denton Liu
2019-11-12  0:14         ` [PATCH v5 10/14] t5520: test single-line files by git with test_cmp Denton Liu
2019-11-12  5:17           ` Junio C Hamano
2019-11-12 23:06             ` Denton Liu
2019-11-12  0:14         ` [PATCH v5 11/14] t5520: don't put git in upstream of pipe Denton Liu
2019-11-12  0:14         ` [PATCH v5 12/14] t5520: replace subshell cat comparison with test_cmp Denton Liu
2019-11-12  0:14         ` [PATCH v5 13/14] t5520: remove redundant lines in test cases Denton Liu
2019-11-12  0:14         ` [PATCH v5 14/14] t5520: replace `! git` with `test_must_fail git` Denton Liu
2019-11-12 23:07         ` Denton Liu [this message]
2019-11-12 23:07           ` [PATCH v6 01/14] t: teach test_cmp_rev to accept ! for not-equals Denton Liu
2019-11-13  1:57             ` Junio C Hamano
2019-11-14  0:52               ` Denton Liu
2019-11-12 23:07           ` [PATCH v6 02/14] t5520: improve test style Denton Liu
2019-11-12 23:07           ` [PATCH v6 03/14] t5520: use sq for test case names Denton Liu
2019-11-12 23:07           ` [PATCH v6 04/14] t5520: let sed open its own input Denton Liu
2019-11-12 23:07           ` [PATCH v6 05/14] t5520: replace test -f with test-lib functions Denton Liu
2019-11-12 23:07           ` [PATCH v6 06/14] t5520: remove spaces after redirect operator Denton Liu
2019-11-12 23:08           ` [PATCH v6 07/14] t5520: use test_line_count where possible Denton Liu
2019-11-12 23:08           ` [PATCH v6 08/14] t5520: replace test -{n,z} with test-lib functions Denton Liu
2019-11-12 23:08           ` [PATCH v6 09/14] t5520: use test_cmp_rev where possible Denton Liu
2019-11-12 23:08           ` [PATCH v6 10/14] t5520: test single-line files by git with test_cmp Denton Liu
2019-11-12 23:08           ` [PATCH v6 11/14] t5520: don't put git in upstream of pipe Denton Liu
2019-11-12 23:08           ` [PATCH v6 12/14] t5520: replace $(cat ...) comparison with test_cmp Denton Liu
2019-11-12 23:08           ` [PATCH v6 13/14] t5520: remove redundant lines in test cases Denton Liu
2019-11-12 23:08           ` [PATCH v6 14/14] t5520: replace `! git` with `test_must_fail git` Denton Liu
2019-11-13  1:59           ` [PATCH v6 00/14] t5520: various test cleanup Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1573595985.git.liu.denton@gmail.com \
    --to=liu.denton@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=sunshine@sunshineco.com \
    --cc=szeder.dev@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).