threads / patch / 35723

patch, 2 partssolaris test fixups

Subject: [PATCH 0/2] solaris test fixups

## tl;dr

9 messages between Jan 23, 2014 and Jan 23, 2014. Diffs are folded; open one to read it.

replies: 8people: 2as markdown or json

Jeff King· Jan 23, 2014, 19:54 UTC · lore

Due to the alignment bug in another thread, I had the pleasure of visiting my old friend Solaris 9 today. The tests _almost_ all run out of the box.

This series features two minor fixes:
  [1/2]: t7501: fix "empty commit" test with NO_PERL
  [2/2]: t7700: do not use "touch -r"

I had a few other failures related to encodings; I suspect the problem is simply that the machine in question doesn't have eucJP support at all.

The big one that I did not fix is in t7001-mv. We do this:
  test_must_fail git mv some-file no-such-dir/

and assume that it will fail. It doesn't. Solaris happily renames some-file to a regular file named "no-such-dir". So we fail later during the index-update, complaining about adding the entry "no-such-dir/", but still exit(0) at the end. I'm mostly willing to just call Solaris crazy for allowing the rename (Linux returns ENOTDIR), but I do wonder if the index codepath could be improved (and especially to return an error).

-Peff
Jeff King· Jan 23, 2014, 19:54 UTC · re: Jeff King · lore

[PATCH 1/2] t7501: fix "empty commit" test with NO_PERL

t7501.9 tries to check that "git commit" will fail when the index is unchanged. It relies on previous tests not to have modified the index. When it was originally written, this was always the case. However, commit c65dc35 (t7501: test the right kind of breakage, 2012-03-30) changed earlier tests (4 and 5) to leave a modification in the index.

We never noticed, however, because t7501.7, between the two, clears the index state as a side effect. However, that test depends on the PERL prerequisite, and so it does not always run. Therefore if NO_PERL is set, we do not run the intervening test, the index is left unclean, and t7501.9 fails.

We could fix this by moving t7501.9 up in the script. However, this patch instead leaves it in place and adds a "git reset" before the commit. This makes the test more explicit about its preconditions, and will future-proof it against any other changes in the test state.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t7501-commit.sh | 1 +
 1 file changed, 1 insertion(+)
Show changes to t/t7501-commit.sh +1 −0
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index f04798f..94eec83 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -57,6 +57,7 @@ test_expect_success 'using invalid commit with -C' '
 '
 
 test_expect_success 'nothing to commit' '
+	git reset --hard &&
 	test_must_fail git commit -m initial
 '
 
-- 
1.8.5.2.500.g8060133
Jeff King· Jan 23, 2014, 19:55 UTC · re: Jeff King · lore

[PATCH 2/2] t7700: do not use "touch -r"

Some versions of touch (such as /usr/ucb/touch on Solaris) do not know about the "-r" option. This would make sense as a feature of test-chmtime, but fortunately this fix is even easier. The test does not care about the timestamp of the .keep file it creates at all, only that it exists. So we can simply drop the use of "-r".

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t7700-repack.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to t/t7700-repack.sh +1 −1
diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index d954b84..f9f9014 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -17,7 +17,7 @@ test_expect_success 'objects in packs marked .keep are not repacked' '
 	# The second pack will contain the excluded object
 	packsha1=$(git rev-list --objects --all | grep file2 |
 		git pack-objects pack) &&
-	touch -r pack-$packsha1.pack pack-$packsha1.keep &&
+	touch pack-$packsha1.keep &&
 	objsha1=$(git verify-pack -v pack-$packsha1.idx | head -n 1 |
 		sed -e "s/^\([0-9a-f]\{40\}\).*/\1/") &&
 	mv pack-* .git/objects/pack/ &&
-- 
1.8.5.2.500.g8060133
Junio C Hamano· Jan 23, 2014, 21:12 UTC · re: Jeff King · lore

Re: [PATCH 2/2] t7700: do not use "touch -r"

Jeff King <peff@peff.net> writes:
> ... The test does not care about the timestamp of the
> .keep file it creates at all, only that it exists.

Please refrain from using "touch" for such use cases in the first place. It appears that

	>pack-$packsha1.keep &&
is what the test wants.
Jeff King· Jan 23, 2014, 21:14 UTC · re: Junio C Hamano · lore

Re: [PATCH 2/2] t7700: do not use "touch -r"

On Thu, Jan 23, 2014 at 01:12:55PM -0800, Junio C Hamano wrote:
Show 11 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > ... The test does not care about the timestamp of the
> > .keep file it creates at all, only that it exists.
> 
> Please refrain from using "touch" for such use cases in the first
> place.  It appears that
> 
> 	>pack-$packsha1.keep &&
> 
> is what the test wants.

Agreed. I was making the minimal change, but I think there is no reason not to fix both while we are there. Do you want to just mark up the patch in transit?

-Peff
Junio C Hamano· Jan 23, 2014, 21:24 UTC · re: Jeff King · lore

Re: [PATCH 2/2] t7700: do not use "touch -r"

Jeff King <peff@peff.net> writes:
> Agreed. I was making the minimal change, but I think there is no reason
> not to fix both while we are there. Do you want to just mark up the
> patch in transit?
Let's just queue this instead.
-- >8 --
From: Jeff King <peff@peff.net>
Date: Thu, 23 Jan 2014 14:55:18 -0500
Subject: [PATCH] t7700: do not use "touch" unnecessarily

Some versions of touch (such as /usr/ucb/touch on Solaris) do not know about the "-r" option. This would make sense as a feature of test-chmtime, but fortunately this fix is even easier.

The test does not care about the timestamp of the .keep file it creates at all, only that it exists. For such a use case, with or without portability issues around "-r", "touch" should not be used in the first place.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t7700-repack.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to t/t7700-repack.sh +1 −1
diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index d954b84..b45bd1e 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -17,7 +17,7 @@ test_expect_success 'objects in packs marked .keep are not repacked' '
 	# The second pack will contain the excluded object
 	packsha1=$(git rev-list --objects --all | grep file2 |
 		git pack-objects pack) &&
-	touch -r pack-$packsha1.pack pack-$packsha1.keep &&
+	>pack-$packsha1.keep &&
 	objsha1=$(git verify-pack -v pack-$packsha1.idx | head -n 1 |
 		sed -e "s/^\([0-9a-f]\{40\}\).*/\1/") &&
 	mv pack-* .git/objects/pack/ &&
-- 
1.9-rc0-234-g8e6341d
Jeff King· Jan 23, 2014, 21:28 UTC · re: Junio C Hamano · lore

Re: [PATCH 2/2] t7700: do not use "touch -r"

On Thu, Jan 23, 2014 at 01:24:44PM -0800, Junio C Hamano wrote:
Show 7 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > Agreed. I was making the minimal change, but I think there is no reason
> > not to fix both while we are there. Do you want to just mark up the
> > patch in transit?
> 
> Let's just queue this instead.
That's what I meant. :)
Thanks, looks good to me.
-Peff
Junio C Hamano· Jan 23, 2014, 20:52 UTC · re: Jeff King · lore

Re: [PATCH 0/2] solaris test fixups

Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> and assume that it will fail. It doesn't. Solaris happily renames
> some-file to a regular file named "no-such-dir". So we fail later during
> the index-update, complaining about adding the entry "no-such-dir/", but
> still exit(0) at the end. I'm mostly willing to just call Solaris crazy
> for allowing the rename (Linux returns ENOTDIR), but I do wonder if
> the index codepath could be improved (and especially to return an
> error).

I think j6t has a patch for that, a8933469 (mv: let 'git mv file no-such-dir/' error out on Windows, too, 2014-01-08).

Jeff King· Jan 23, 2014, 20:54 UTC · re: Junio C Hamano · lore

Re: [PATCH 0/2] solaris test fixups

On Thu, Jan 23, 2014 at 12:52:30PM -0800, Junio C Hamano wrote:
Show 12 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > and assume that it will fail. It doesn't. Solaris happily renames
> > some-file to a regular file named "no-such-dir". So we fail later during
> > the index-update, complaining about adding the entry "no-such-dir/", but
> > still exit(0) at the end. I'm mostly willing to just call Solaris crazy
> > for allowing the rename (Linux returns ENOTDIR), but I do wonder if
> > the index codepath could be improved (and especially to return an
> > error).
> 
> I think j6t has a patch for that, a8933469 (mv: let 'git mv file
> no-such-dir/' error out on Windows, too, 2014-01-08).

Ah yeah, that looks like exactly the same issue (and the fix looks sane from my cursory investigation). Thanks for the pointer. I wasn't planning to look further into it, but now I can do so without feeling guilty. :)

-Peff

← back to recent threads