All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: Eric Sunshine <sunshine@sunshineco.com>,
	Karthik Nayak <karthik.188@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: t6392 broken on pu (Mac OS X)
Date: Mon, 9 May 2016 12:07:25 -0400	[thread overview]
Message-ID: <20160509160725.GA11861@sigill.intra.peff.net> (raw)
In-Reply-To: <dea0877d-fe83-fb47-4df3-21fd69d8421d@web.de>

On Sat, May 07, 2016 at 06:15:19PM +0200, Torsten Bögershausen wrote:

> These tests fail here under Mac OS,
> they pass under Linux:
> commit ff3d9b660a4b6e9d3eeb664ce1febe717adff737
> I haven't had a chance to dig further.

I assume you mean t6302. It looks like the difference is not Mac OS, but
rather that the GPG prerequisite is not fulfilled, so we are missing a
few of the tags.

Commit 618310a introduced a helper to munge the "expect" output. Using
that fixes some of the cases, but not test 34. That one is expecting
blank lines for tags, so test_prepare_expect doesn't know which lines
are related to GPG.

We could fix it by tweaking the test like this:

diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
index 7420e48..04042e1 100755
--- a/t/t6302-for-each-ref-filter.sh
+++ b/t/t6302-for-each-ref-filter.sh
@@ -343,29 +343,27 @@ test_expect_success 'improper usage of %(if), %(then), %(else) and %(end) atoms'
 '
 
 test_expect_success 'check %(if)...%(then)...%(end) atoms' '
-	git for-each-ref --format="%(if)%(authorname)%(then)%(authorname): %(refname)%(end)" >actual &&
-	cat >expect <<-\EOF &&
-	A U Thor: refs/heads/master
-	A U Thor: refs/heads/side
-	A U Thor: refs/odd/spot
-
-
-
-	A U Thor: refs/tags/foo1.10
-	A U Thor: refs/tags/foo1.3
-	A U Thor: refs/tags/foo1.6
-	A U Thor: refs/tags/four
-	A U Thor: refs/tags/one
-
-	A U Thor: refs/tags/three
-	A U Thor: refs/tags/two
+	git for-each-ref --format="%(refname):%(if)%(authorname)%(then) author=%(authorname)%(end)" >actual &&
+	test_prepare_expect >expect <<-\EOF &&
+	refs/heads/master: author=A U Thor
+	refs/heads/side: author=A U Thor
+	refs/odd/spot: author=A U Thor
+	refs/tags/annotated-tag:
+	refs/tags/doubly-annotated-tag:
+	refs/tags/foo1.10: author=A U Thor
+	refs/tags/foo1.3: author=A U Thor
+	refs/tags/foo1.6: author=A U Thor
+	refs/tags/four: author=A U Thor
+	refs/tags/one: author=A U Thor
+	refs/tags/three: author=A U Thor
+	refs/tags/two: author=A U Thor
 	EOF
 	test_cmp expect actual
 '
 
 test_expect_success 'check %(if)...%(then)...%(else)...%(end) atoms' '
 	git for-each-ref --format="%(if)%(authorname)%(then)%(authorname)%(else)No author%(end): %(refname)" >actual &&
-	cat >expect <<-\EOF &&
+	test_prepare_expect >expect <<-\EOF &&
 	A U Thor: refs/heads/master
 	A U Thor: refs/heads/side
 	A U Thor: refs/odd/spot
@@ -385,7 +383,7 @@ test_expect_success 'check %(if)...%(then)...%(else)...%(end) atoms' '
 '
 test_expect_success 'ignore spaces in %(if) atom usage' '
 	git for-each-ref --format="%(refname:short): %(if)%(HEAD)%(then)Head ref%(else)Not Head ref%(end)" >actual &&
-	cat >expect <<-\EOF &&
+	test_prepare_expect >expect <<-\EOF &&
 	master: Head ref
 	side: Not Head ref
 	odd/spot: Not Head ref


Though we'd perhaps want to tweak the subsequent tests to use the same
format, just to make things easier to read later.

However, I wonder if we could improve on the strategy in 618310a, and
simply create non-signed versions of the "signed" tags when GPG is not
available. That would make tests looking at the whole ref namespace
more consistent. And any tests which wanted to look specifically at the
signed attributes should be protected with the GPG prereq anyway (it
doesn't look like there are any currently, though).

I.e., something like:

diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
index 7420e48..a3df472 100755
--- a/t/t6302-for-each-ref-filter.sh
+++ b/t/t6302-for-each-ref-filter.sh
@@ -6,12 +6,8 @@ test_description='test for-each-refs usage of ref-filter APIs'
 . "$TEST_DIRECTORY"/lib-gpg.sh
 
 test_prepare_expect () {
-	if test_have_prereq GPG
-	then
-		cat
-	else
-		sed '/signed/d'
-	fi
+	# XXX this could now go away entirely, and just use cat in each test
+	cat
 }
 
 test_expect_success 'setup some history and refs' '
@@ -24,9 +20,12 @@ test_expect_success 'setup some history and refs' '
 	git tag -m "Annonated doubly" doubly-annotated-tag annotated-tag &&
 	if test_have_prereq GPG
 	then
-		git tag -s -m "A signed tag" signed-tag &&
-		git tag -s -m "Signed doubly" doubly-signed-tag signed-tag
+		sign=-s
+	else
+		sign=
 	fi &&
+	git tag $sign -m "A signed tag" signed-tag &&
+	git tag $sign -m "Signed doubly" doubly-signed-tag signed-tag &&
 	git checkout master &&
 	git update-ref refs/odd/spot master
 '

-Peff

  reply	other threads:[~2016-05-09 16:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-07 16:15 t6392 broken on pu (Mac OS X) Torsten Bögershausen
2016-05-09 16:07 ` Jeff King [this message]
2016-05-09 16:30   ` Eric Sunshine
2016-05-09 16:49     ` [PATCH] t6302: simplify non-gpg cases Jeff King
2016-05-09 17:47       ` Eric Sunshine
     [not found]         ` <CAOLa=ZSZqs=++Hf8CF3pWEnJqmOA9ajuX03hzLMkuQ+ehXXCVQ@mail.gmail.com>
2016-05-09 21:37           ` Eric Sunshine
2016-05-10  2:40         ` [PATCH v2] " Jeff King
2016-05-10  2:49           ` Eric Sunshine
2016-05-10  6:03           ` 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

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

  git send-email \
    --in-reply-to=20160509160725.GA11861@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=sunshine@sunshineco.com \
    --cc=tboegi@web.de \
    /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.