git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* t4111 fails under valgrind
@ 2010-07-30 10:18 Thomas Rast
  2010-07-30 18:31 ` Jonathan Nieder
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Rast @ 2010-07-30 10:18 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git

Hi Jonathan

t4111 never worked under valgrind on my machine, building 9f41a91 and
then running it with --valgrind results in:

  expecting success: 
          cp postimage expected &&
          reset_subdir preimage other &&
          (
                  cd sub/dir &&
                  test_must_fail git apply --index "$patch"
          ) &&
          reset_subdir other preimage &&
          (
                  cd sub/dir &&
                  test_must_fail git apply --index "$patch"
          ) &&
          reset_subdir preimage preimage &&
          (
                  cd sub/dir &&
                  git apply --index "$patch"
          ) &&
          git show :sub/dir/file >actual &&
          test_cmp expected actual &&
          test_cmp expected sub/dir/file

  error: sub/dir/file: does not match index
  error: sub/dir/file: does not match index
  error: sub/dir/file: does not match index
  not ok - 5 apply --index from subdir of toplevel
  #
  #               cp postimage expected &&
  #               reset_subdir preimage other &&
  #               (
  #                       cd sub/dir &&
  #                       test_must_fail git apply --index "$patch"
  #               ) &&
  #               reset_subdir other preimage &&
  #               (
  #                       cd sub/dir &&
  #                       test_must_fail git apply --index "$patch"
  #               ) &&
  #               reset_subdir preimage preimage &&
  #               (
  #                       cd sub/dir &&
  #                       git apply --index "$patch"
  #               ) &&
  #               git show :sub/dir/file >actual &&
  #               test_cmp expected actual &&
  #               test_cmp expected sub/dir/file
  #

Any ideas what might be going wrong?

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

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

* Re: t4111 fails under valgrind
  2010-07-30 10:18 t4111 fails under valgrind Thomas Rast
@ 2010-07-30 18:31 ` Jonathan Nieder
  2010-07-30 18:39   ` Thomas Rast
  2010-08-04 10:06   ` Thomas Rast
  0 siblings, 2 replies; 4+ messages in thread
From: Jonathan Nieder @ 2010-07-30 18:31 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git

Thomas Rast wrote:

>   error: sub/dir/file: does not match index
>   error: sub/dir/file: does not match index
>   error: sub/dir/file: does not match index
>   not ok - 5 apply --index from subdir of toplevel

Thanks for reporting.  Does this patch work for you?

-- 8< --
Subject: t4111 (apply): refresh index before applying patches to it

"git apply", like most plumbing, does not automatically refresh the
index file even if it is only stat-dirty.  So unless the two "cp"
commands in reset_preimage() for a given file happen to have the same
time stamp, there will be a spurious

	error: sub/dir/file: does not match index

Refresh the index to eliminate this timing dependency.  Noticed by
running the test with --valgrind (which slows things down a lot).

Reported-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
diff --git a/t/t4111-apply-subdir.sh b/t/t4111-apply-subdir.sh
index 57cae50..a52d94a 100755
--- a/t/t4111-apply-subdir.sh
+++ b/t/t4111-apply-subdir.sh
@@ -36,7 +36,8 @@ test_expect_success 'setup: subdir' '
 		cp "$2" file &&
 		cp "$2" sub/dir/file &&
 		cp "$2" sub/dir/b/file &&
-		cp "$2" objects/file
+		cp "$2" objects/file &&
+		test_might_fail git update-index --refresh -q
 	}
 '
 
-- 

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

* Re: t4111 fails under valgrind
  2010-07-30 18:31 ` Jonathan Nieder
@ 2010-07-30 18:39   ` Thomas Rast
  2010-08-04 10:06   ` Thomas Rast
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Rast @ 2010-07-30 18:39 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git

Jonathan Nieder wrote:
> Thanks for reporting.  Does this patch work for you?
[...]
> -		cp "$2" objects/file
> +		cp "$2" objects/file &&
> +		test_might_fail git update-index --refresh -q

Yes, that solves it.  Thanks!

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

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

* Re: t4111 fails under valgrind
  2010-07-30 18:31 ` Jonathan Nieder
  2010-07-30 18:39   ` Thomas Rast
@ 2010-08-04 10:06   ` Thomas Rast
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Rast @ 2010-08-04 10:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonathan Nieder, git

Jonathan Nieder wrote:
> -- 8< --
> Subject: t4111 (apply): refresh index before applying patches to it
> 
> "git apply", like most plumbing, does not automatically refresh the
> index file even if it is only stat-dirty.  So unless the two "cp"
> commands in reset_preimage() for a given file happen to have the same
> time stamp, there will be a spurious
> 
> 	error: sub/dir/file: does not match index
> 
> Refresh the index to eliminate this timing dependency.  Noticed by
> running the test with --valgrind (which slows things down a lot).
> 
> Reported-by: Thomas Rast <trast@student.ethz.ch>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
> diff --git a/t/t4111-apply-subdir.sh b/t/t4111-apply-subdir.sh
> index 57cae50..a52d94a 100755
> --- a/t/t4111-apply-subdir.sh
> +++ b/t/t4111-apply-subdir.sh
> @@ -36,7 +36,8 @@ test_expect_success 'setup: subdir' '
>  		cp "$2" file &&
>  		cp "$2" sub/dir/file &&
>  		cp "$2" sub/dir/b/file &&
> -		cp "$2" objects/file
> +		cp "$2" objects/file &&
> +		test_might_fail git update-index --refresh -q
>  	}
>  '

Junio, can you pick this up?  t4111 consistently fails for me without
it.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

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

end of thread, other threads:[~2010-08-04 10:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-30 10:18 t4111 fails under valgrind Thomas Rast
2010-07-30 18:31 ` Jonathan Nieder
2010-07-30 18:39   ` Thomas Rast
2010-08-04 10:06   ` Thomas Rast

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 NNTP newsgroup(s).