All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fixup test-lint error in git-p4 t9814 test
@ 2015-04-27 22:20 Luke Diamand
  2015-04-27 22:20 ` [PATCH] git-p4: prevent --chain-lint failure Luke Diamand
  0 siblings, 1 reply; 7+ messages in thread
From: Luke Diamand @ 2015-04-27 22:20 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Luke Diamand

While running the git-p4 tests, I noticed that t9814 has started
failing due to the (very ingenious!) chain-lint detection introduced
in:

   bb79af9 t/test-lib: introduce --chain-lint option

I think that what's going on is that the chain-lint test is
getting itself confused by this test, which is designed to always
succeed, regardless of whether the individual sub-commands succeed
or not, since it's just setting up a pre-requisite for later use.

I've added an additional set of braces, which makes it clearer
to the --chain-lint code what's going on, but I'd be interested to
know if this is the right way to fix this.

Thanks,
Luke

Luke Diamand (1):
  git-p4: prevent --chain-lint failure

 t/t9814-git-p4-rename.sh | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

-- 
2.3.4.48.g223ab37

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

* [PATCH] git-p4: prevent --chain-lint failure
  2015-04-27 22:20 [PATCH] Fixup test-lint error in git-p4 t9814 test Luke Diamand
@ 2015-04-27 22:20 ` Luke Diamand
  2015-04-27 23:02   ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Luke Diamand @ 2015-04-27 22:20 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Luke Diamand

t9814 has a test that simply sets up a pre-requisite for
another test, and as such, always succeeds. The way it was
written doesn't quite work with the test lint checks introduced
with the --chain-lint option.

Add an additional layer of {} to prevent the --chain-lint
code getting confused.

Signed-off-by: Luke Diamand <luke@diamand.org>
---
 t/t9814-git-p4-rename.sh | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh
index 99bb71b..14f9dc3 100755
--- a/t/t9814-git-p4-rename.sh
+++ b/t/t9814-git-p4-rename.sh
@@ -227,13 +227,15 @@ test_expect_success 'detect copies' '
 # See if configurables can be set, and in particular if the run.move.allow
 # variable exists, which allows admins to disable the "p4 move" command.
 test_expect_success 'p4 configure command and run.move.allow are available' '
-	p4 configure show run.move.allow >out ; retval=$? &&
-	test $retval = 0 &&
-	{
-		egrep ^run.move.allow: out &&
-		test_set_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW ||
-		true
-	} || true
+    {
+	    p4 configure show run.move.allow >out ; retval=$? &&
+	    test $retval = 0 &&
+	    {
+		    egrep ^run.move.allow: out &&
+		    test_set_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW ||
+		    true
+	    } || true
+    }
 '
 
 # If move can be disabled, turn it off and test p4 move handling
-- 
2.3.4.48.g223ab37

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

* Re: [PATCH] git-p4: prevent --chain-lint failure
  2015-04-27 22:20 ` [PATCH] git-p4: prevent --chain-lint failure Luke Diamand
@ 2015-04-27 23:02   ` Jeff King
  2015-04-28  6:30     ` [PATCHv2] Fixup test-lint error in git-p4 t9814 test Luke Diamand
  2015-04-28  6:30     ` [PATCHv2] " Luke Diamand
  0 siblings, 2 replies; 7+ messages in thread
From: Jeff King @ 2015-04-27 23:02 UTC (permalink / raw)
  To: Luke Diamand; +Cc: git, Junio C Hamano

On Mon, Apr 27, 2015 at 11:20:28PM +0100, Luke Diamand wrote:

> t9814 has a test that simply sets up a pre-requisite for
> another test, and as such, always succeeds. The way it was
> written doesn't quite work with the test lint checks introduced
> with the --chain-lint option.
> 
> Add an additional layer of {} to prevent the --chain-lint
> code getting confused.

Thanks for looking into this. I tried to fix any existing tests I could,
but I missed ones whose prerequisites aren't met on my system.

Using {} is reasonable in general; that's how the fixes in 9ddc5ac (t:
wrap complicated expect_code users in a block, 2015-03-20) worked.
However, I think your case is somewhat simpler, in that you really just
want a big conditional to set a prereq based on whether or not a command
succeeds.

Would it make sense to convert this whole thing to just:

  test_lazy_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW '
	p4 configure show run.move.allow >out &&
	egrep ^run.move.allow: out
  '

?

-Peff

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

* [PATCHv2] Fixup test-lint error in git-p4 t9814 test
  2015-04-27 23:02   ` Jeff King
@ 2015-04-28  6:30     ` Luke Diamand
  2015-04-28  7:21       ` [PATCHv3] " Luke Diamand
  2015-04-28  7:21       ` [PATCHv3] git-p4: t9814: prevent --chain-lint failure Luke Diamand
  2015-04-28  6:30     ` [PATCHv2] " Luke Diamand
  1 sibling, 2 replies; 7+ messages in thread
From: Luke Diamand @ 2015-04-28  6:30 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Luke Diamand

Using Jeff's suggestion of converting the t9814 test to use
test_lazy_prereq makes the test a lot clearer, and as a bonus,
also fixes the --chain-lint error.

Thanks,
Luke

Luke Diamand (1):
  git-p4: t9814: prevent --chain-lint failure

 t/t9814-git-p4-rename.sh | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

-- 
2.3.4.48.g223ab37

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

* [PATCHv2] git-p4: t9814: prevent --chain-lint failure
  2015-04-27 23:02   ` Jeff King
  2015-04-28  6:30     ` [PATCHv2] Fixup test-lint error in git-p4 t9814 test Luke Diamand
@ 2015-04-28  6:30     ` Luke Diamand
  1 sibling, 0 replies; 7+ messages in thread
From: Luke Diamand @ 2015-04-28  6:30 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Luke Diamand

Use test_lazy_prereq to setup prerequisites for the p4 move
test. This both makes the test simpler and clearer, and also
means they no longer fail the new --chain-lint tests.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Luke Diamand <luke@diamand.org>
---
 t/t9814-git-p4-rename.sh | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh
index 99bb71b..c89992c 100755
--- a/t/t9814-git-p4-rename.sh
+++ b/t/t9814-git-p4-rename.sh
@@ -226,14 +226,9 @@ test_expect_success 'detect copies' '
 
 # See if configurables can be set, and in particular if the run.move.allow
 # variable exists, which allows admins to disable the "p4 move" command.
-test_expect_success 'p4 configure command and run.move.allow are available' '
-	p4 configure show run.move.allow >out ; retval=$? &&
-	test $retval = 0 &&
-	{
-		egrep ^run.move.allow: out &&
-		test_set_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW ||
-		true
-	} || true
+test_lazy_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW '
+	p4 configure show run.move.allow >out &&
+	egrep ^run.move.allow: out
 '
 
 # If move can be disabled, turn it off and test p4 move handling
-- 
2.3.4.48.g223ab37

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

* [PATCHv3] Fixup test-lint error in git-p4 t9814 test
  2015-04-28  6:30     ` [PATCHv2] Fixup test-lint error in git-p4 t9814 test Luke Diamand
@ 2015-04-28  7:21       ` Luke Diamand
  2015-04-28  7:21       ` [PATCHv3] git-p4: t9814: prevent --chain-lint failure Luke Diamand
  1 sibling, 0 replies; 7+ messages in thread
From: Luke Diamand @ 2015-04-28  7:21 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Luke Diamand

Using Jeff's suggestion of converting the t9814 test to use
test_lazy_prereq makes the test a lot clearer, and as a bonus,
also fixes the --chain-lint error.

Version 3 of the patch corrects a small typo in the commit message
of version 2.

Luke Diamand (1):
  git-p4: t9814: prevent --chain-lint failure

 t/t9814-git-p4-rename.sh | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

-- 
2.3.4.48.g223ab37

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

* [PATCHv3] git-p4: t9814: prevent --chain-lint failure
  2015-04-28  6:30     ` [PATCHv2] Fixup test-lint error in git-p4 t9814 test Luke Diamand
  2015-04-28  7:21       ` [PATCHv3] " Luke Diamand
@ 2015-04-28  7:21       ` Luke Diamand
  1 sibling, 0 replies; 7+ messages in thread
From: Luke Diamand @ 2015-04-28  7:21 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Jeff King, Luke Diamand

Use test_lazy_prereq to setup prerequisites for the p4 move
test. This both makes the test simpler and clearer, and also
means it no longer fails the new --chain-lint tests.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Luke Diamand <luke@diamand.org>
---
 t/t9814-git-p4-rename.sh | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh
index 99bb71b..c89992c 100755
--- a/t/t9814-git-p4-rename.sh
+++ b/t/t9814-git-p4-rename.sh
@@ -226,14 +226,9 @@ test_expect_success 'detect copies' '
 
 # See if configurables can be set, and in particular if the run.move.allow
 # variable exists, which allows admins to disable the "p4 move" command.
-test_expect_success 'p4 configure command and run.move.allow are available' '
-	p4 configure show run.move.allow >out ; retval=$? &&
-	test $retval = 0 &&
-	{
-		egrep ^run.move.allow: out &&
-		test_set_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW ||
-		true
-	} || true
+test_lazy_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW '
+	p4 configure show run.move.allow >out &&
+	egrep ^run.move.allow: out
 '
 
 # If move can be disabled, turn it off and test p4 move handling
-- 
2.3.4.48.g223ab37

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

end of thread, other threads:[~2015-04-28  7:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-27 22:20 [PATCH] Fixup test-lint error in git-p4 t9814 test Luke Diamand
2015-04-27 22:20 ` [PATCH] git-p4: prevent --chain-lint failure Luke Diamand
2015-04-27 23:02   ` Jeff King
2015-04-28  6:30     ` [PATCHv2] Fixup test-lint error in git-p4 t9814 test Luke Diamand
2015-04-28  7:21       ` [PATCHv3] " Luke Diamand
2015-04-28  7:21       ` [PATCHv3] git-p4: t9814: prevent --chain-lint failure Luke Diamand
2015-04-28  6:30     ` [PATCHv2] " Luke Diamand

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.