All of lore.kernel.org
 help / color / mirror / 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>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v3 00/15] t: replace incorrect test_must_fail usage (part 1)
Date: Fri, 20 Dec 2019 10:15:47 -0800	[thread overview]
Message-ID: <cover.1576865663.git.liu.denton@gmail.com> (raw)
In-Reply-To: <cover.1576794144.git.liu.denton@gmail.com>

The overall scope of these patches is to replace inappropriate uses of
test_must_fail. IOW, we should only allow test_must_fail to run on `git`
and `test-tool`. Ultimately, we will conclude by making test_must_fail
error out on non-git commands. An advance view of the final series can
be found here[1].

This is the first part. It focuses on t[01]*.sh and also t/lib-git-p4.

Changes since v2:

* Drop the inclusion of test_non_git_must_fail() and open code it
  instead

Changes since v1:

* Incorporate review comments by Junio, Eric and J6t

* Further cleanup of t1507 before inlining full_name() (since we didn't
  want to inline full_name() into a bad command substitution)

[1]: (may be rebased at any time) https://github.com/Denton-L/git/tree/ready/cleanup-test-must-fail2

Denton Liu (15):
  t/lib-git-p4: use test_path_is_missing()
  t0000: replace test_must_fail with run_sub_test_lib_test_err()
  t0003: use named parameters in attr_check()
  t0003: use test_must_be_empty()
  t0003: don't use `test_must_fail attr_check`
  t0020: don't use `test_must_fail has_cr`
  t0020: use ! check_packed_refs_marked
  t1306: convert `test_might_fail rm` to `rm -f`
  t1307: reorder `nongit test_must_fail`
  t1409: let sed open its own input file
  t1409: use test_path_is_missing()
  t1501: remove use of `test_might_fail cp`
  t1507: stop losing return codes of git commands
  t1507: run commands within test_expect_success
  t1507: inline full_name()

 t/lib-git-p4.sh               |   2 +-
 t/t0000-basic.sh              |  14 ++---
 t/t0003-attributes.sh         |  47 +++++++--------
 t/t0020-crlf.sh               |  18 +++---
 t/t1306-xdg-files.sh          |   8 +--
 t/t1307-config-blob.sh        |   2 +-
 t/t1409-avoid-packing-refs.sh |  16 +++---
 t/t1501-work-tree.sh          |   2 +-
 t/t1507-rev-parse-upstream.sh | 104 +++++++++++++++++++---------------
 9 files changed, 112 insertions(+), 101 deletions(-)

Range-diff against v2:
 1:  85cee92765 <  -:  ---------- test-lib-functions: introduce test_non_git_might_fail()
 2:  3d64837af1 =  1:  cf3dd04b8a t/lib-git-p4: use test_path_is_missing()
 3:  778ae9052b =  2:  51a2226726 t0000: replace test_must_fail with run_sub_test_lib_test_err()
 4:  dbc82d45c6 =  3:  9374fcd8db t0003: use named parameters in attr_check()
 5:  e06a06cff5 =  4:  7f8808a850 t0003: use test_must_be_empty()
 6:  219011f983 =  5:  b725d53dbe t0003: don't use `test_must_fail attr_check`
 7:  8da6c96b39 =  6:  f6ef6d245c t0020: don't use `test_must_fail has_cr`
 8:  27550eaae6 =  7:  fc32b8d584 t0020: use ! check_packed_refs_marked
 9:  c19f6344a4 =  8:  7e29b0154e t1306: convert `test_might_fail rm` to `rm -f`
10:  d6ea8a6df0 =  9:  cf43579d65 t1307: reorder `nongit test_must_fail`
11:  d57dfe95e2 = 10:  e2fe278bfa t1409: let sed open its own input file
12:  eacf4e0fb4 = 11:  1eef3f4bc5 t1409: use test_path_is_missing()
13:  83e47748bc ! 12:  fddd224225 t1501: remove use of `test_might_fail cp`
    @@ Commit message
     
         The test_must_fail() family of functions (including test_might_fail())
         should only be used on git commands. Replace test_might_fail() with
    -    test_non_git_might_fail().
    +    a compound command wrapping the old cp invocation that always returns 0.
     
         The `test_might_fail cp` line was introduced in 466e8d5d66 (t1501: fix
         test with split index, 2015-03-24). It is necessary because there might
         exist some index files in `repo.git/sharedindex.*` and, if they exist,
         we want to copy them over. However, if they don't exist, we don't want
         to error out because we expect that possibility. As a result, we want to
    -    keep the "might fail" semantics so we use test_non_git_might_fail().
    +    keep the "might fail" semantics so we always return 0, even if the
    +    underlying cp errors out.
     
      ## t/t1501-work-tree.sh ##
     @@ t/t1501-work-tree.sh: test_expect_success 'Multi-worktree setup' '
    @@ t/t1501-work-tree.sh: test_expect_success 'Multi-worktree setup' '
      	mkdir -p repo.git/repos/foo &&
      	cp repo.git/HEAD repo.git/index repo.git/repos/foo &&
     -	test_might_fail cp repo.git/sharedindex.* repo.git/repos/foo &&
    -+	test_non_git_might_fail cp repo.git/sharedindex.* repo.git/repos/foo &&
    ++	{ cp repo.git/sharedindex.* repo.git/repos/foo || :; } &&
      	sane_unset GIT_DIR GIT_CONFIG GIT_WORK_TREE
      '
      
14:  9e20865f94 = 13:  63ca18207d t1507: stop losing return codes of git commands
15:  7c61ac6b67 = 14:  44a410d57a t1507: run commands within test_expect_success
16:  d09370455f = 15:  4fe445279b t1507: inline full_name()
-- 
2.24.1.703.g2f499f1283


  parent reply	other threads:[~2019-12-20 18:14 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-17 12:01 [PATCH 00/15] t: replace incorrect test_must_fail usage (part 1) Denton Liu
2019-12-17 12:01 ` [PATCH 01/15] test-lib-functions: introduce test_non_git_might_fail() Denton Liu
2019-12-17 12:01 ` [PATCH 02/15] t/lib-git-p4: use test_path_is_missing() Denton Liu
2019-12-17 12:01 ` [PATCH 03/15] t0000: replace test_must_fail with ! for run_sub_test_lib_test() Denton Liu
2019-12-17 20:23   ` Johannes Sixt
2019-12-17 12:01 ` [PATCH 04/15] t0003: use named parameters in attr_check() Denton Liu
2019-12-17 18:35   ` Junio C Hamano
2019-12-17 18:43   ` Eric Sunshine
2019-12-17 12:01 ` [PATCH 05/15] t0003: use test_must_be_empty() Denton Liu
2019-12-17 12:01 ` [PATCH 06/15] t0003: don't use `test_must_fail attr_check` Denton Liu
2019-12-17 18:44   ` Junio C Hamano
2019-12-17 12:01 ` [PATCH 07/15] t0020: drop redirections to /dev/null Denton Liu
2019-12-17 19:32   ` Eric Sunshine
2019-12-17 12:01 ` [PATCH 08/15] t0020: s/test_must_fail has_cr/! has_cr/ Denton Liu
2019-12-17 19:36   ` Eric Sunshine
2019-12-17 12:01 ` [PATCH 09/15] t0020: use ! check_packed_refs_marked Denton Liu
2019-12-17 12:01 ` [PATCH 10/15] t1306: convert `test_might_fail rm` to `rm -f` Denton Liu
2019-12-17 18:55   ` Junio C Hamano
2019-12-17 12:01 ` [PATCH 11/15] t1307: reorder `nongit test_must_fail` Denton Liu
2019-12-17 12:01 ` [PATCH 12/15] t1409: let sed open its own files Denton Liu
2019-12-17 18:57   ` Junio C Hamano
2019-12-17 12:01 ` [PATCH 13/15] t1409: use test_path_is_missing() Denton Liu
2019-12-17 19:01   ` Junio C Hamano
2019-12-17 12:01 ` [PATCH 14/15] t1501: remove use of `test_might_fail cp` Denton Liu
2019-12-17 19:46   ` Eric Sunshine
2019-12-17 12:01 ` [PATCH 15/15] t1507: teach full_name() to accept `!` arg Denton Liu
2019-12-17 19:54   ` Eric Sunshine
2019-12-17 18:28 ` [PATCH 00/15] t: replace incorrect test_must_fail usage (part 1) Junio C Hamano
2019-12-19 22:22 ` [PATCH v2 00/16] " Denton Liu
2019-12-19 22:22   ` [PATCH v2 01/16] test-lib-functions: introduce test_non_git_might_fail() Denton Liu
2019-12-19 22:22   ` [PATCH v2 02/16] t/lib-git-p4: use test_path_is_missing() Denton Liu
2019-12-19 22:22   ` [PATCH v2 03/16] t0000: replace test_must_fail with run_sub_test_lib_test_err() Denton Liu
2019-12-19 22:22   ` [PATCH v2 04/16] t0003: use named parameters in attr_check() Denton Liu
2019-12-19 22:22   ` [PATCH v2 05/16] t0003: use test_must_be_empty() Denton Liu
2019-12-19 22:22   ` [PATCH v2 06/16] t0003: don't use `test_must_fail attr_check` Denton Liu
2019-12-19 22:22   ` [PATCH v2 07/16] t0020: don't use `test_must_fail has_cr` Denton Liu
2019-12-19 22:22   ` [PATCH v2 08/16] t0020: use ! check_packed_refs_marked Denton Liu
2019-12-19 22:22   ` [PATCH v2 09/16] t1306: convert `test_might_fail rm` to `rm -f` Denton Liu
2019-12-19 22:22   ` [PATCH v2 10/16] t1307: reorder `nongit test_must_fail` Denton Liu
2019-12-19 22:22   ` [PATCH v2 11/16] t1409: let sed open its own input file Denton Liu
2019-12-19 22:22   ` [PATCH v2 12/16] t1409: use test_path_is_missing() Denton Liu
2019-12-19 22:22   ` [PATCH v2 13/16] t1501: remove use of `test_might_fail cp` Denton Liu
2019-12-19 22:52     ` Eric Sunshine
2019-12-19 23:19       ` Denton Liu
2019-12-20 17:32         ` Eric Sunshine
2019-12-19 22:22   ` [PATCH v2 14/16] t1507: stop losing return codes of git commands Denton Liu
2019-12-19 22:22   ` [PATCH v2 15/16] t1507: run commands within test_expect_success Denton Liu
2019-12-19 22:22   ` [PATCH v2 16/16] t1507: inline full_name() Denton Liu
2019-12-20 18:15   ` Denton Liu [this message]
2019-12-20 18:15     ` [PATCH v3 01/15] t/lib-git-p4: use test_path_is_missing() Denton Liu
2019-12-20 18:15     ` [PATCH v3 02/15] t0000: replace test_must_fail with run_sub_test_lib_test_err() Denton Liu
2019-12-20 18:15     ` [PATCH v3 03/15] t0003: use named parameters in attr_check() Denton Liu
2019-12-20 18:15     ` [PATCH v3 04/15] t0003: use test_must_be_empty() Denton Liu
2019-12-20 18:15     ` [PATCH v3 05/15] t0003: don't use `test_must_fail attr_check` Denton Liu
2019-12-20 18:15     ` [PATCH v3 06/15] t0020: don't use `test_must_fail has_cr` Denton Liu
2019-12-20 18:15     ` [PATCH v3 07/15] t0020: use ! check_packed_refs_marked Denton Liu
2019-12-20 18:15     ` [PATCH v3 08/15] t1306: convert `test_might_fail rm` to `rm -f` Denton Liu
2019-12-20 18:15     ` [PATCH v3 09/15] t1307: reorder `nongit test_must_fail` Denton Liu
2019-12-20 18:15     ` [PATCH v3 10/15] t1409: let sed open its own input file Denton Liu
2019-12-20 18:15     ` [PATCH v3 11/15] t1409: use test_path_is_missing() Denton Liu
2019-12-20 18:15     ` [PATCH v3 12/15] t1501: remove use of `test_might_fail cp` Denton Liu
2019-12-20 18:16     ` [PATCH v3 13/15] t1507: stop losing return codes of git commands Denton Liu
2019-12-20 18:16     ` [PATCH v3 14/15] t1507: run commands within test_expect_success Denton Liu
2019-12-20 18:16     ` [PATCH v3 15/15] t1507: inline full_name() Denton Liu

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=cover.1576865663.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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.