git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] t6026: ensure that long-running script really is

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 11, 2016, 20:48 UTC
Message-ID
<xmqq60nt3fqc.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<6a421222-a138-5647-4965-8ede24d904b2@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
> Good point. Here is an updated version.

Unfortunately, I already took the version before this one and started my integration cycle today. I'll wiggle this in; it essentially is about adding a big comment to explain what is going on and then moving the when-finished down below it, right?

Thanks.
Show 45 quoted lines
> If the pid file is not created, the kill command receives no
> arguments. Here on Linux, it reports failure in this case.
> This is good. I could have said
>
>    test_when_finished "kill \"\$(cat sleep.pid)\""
>
> but that is a bit too much quoting for my taste when it is
> not strictly necessary.
>
>  t/t6026-merge-attr.sh | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh
> index 7a6e33e673..8f9b48a493 100755
> --- a/t/t6026-merge-attr.sh
> +++ b/t/t6026-merge-attr.sh
> @@ -183,16 +183,24 @@ test_expect_success 'up-to-date merge without common ancestor' '
>  
>  test_expect_success 'custom merge does not lock index' '
>  	git reset --hard anchor &&
> -	write_script sleep-one-second.sh <<-\EOF &&
> -		sleep 1 &
> +	write_script sleep-an-hour.sh <<-\EOF &&
> +		sleep 3600 &
>  		echo $! >sleep.pid
>  	EOF
> -	test_when_finished "kill \$(cat sleep.pid)" &&
>  
>  	test_write_lines >.gitattributes \
> -		"* merge=ours" "text merge=sleep-one-second" &&
> +		"* merge=ours" "text merge=sleep-an-hour" &&
>  	test_config merge.ours.driver true &&
> -	test_config merge.sleep-one-second.driver ./sleep-one-second.sh &&
> +	test_config merge.sleep-an-hour.driver ./sleep-an-hour.sh &&
> +
> +	# We are testing that the custom merge driver does not block
> +	# index.lock on Windows due to an inherited file handle.
> +	# To ensure that the backgrounded process ran sufficiently
> +	# long (and has been started in the first place), we do not
> +	# ignore the result of the kill command.
> +	# By packaging the command in test_when_finished, we get both
> +	# the correctness check and the clean-up.
> +	test_when_finished "kill \$(cat sleep.pid)" &&
>  	git merge master
>  '
Previous: Johannes SixtNext: Johannes Sixt
Message 6 of 9 in “t6026: ensure that long-running script really is”
  1. t6026: ensure that long-running script really isJohannes Schindelin, Nov 9, 2016
  2. Junio C HamanoNov 10, 2016
  3. Johannes SixtNov 11, 2016
  4. Jeff KingNov 11, 2016
  5. t6026: ensure that long-running script really isJohannes Sixt, Nov 11, 2016
  6. Junio C HamanoNov 11, 2016
  7. Johannes SixtNov 11, 2016
  8. Junio C HamanoNov 11, 2016
  9. Johannes SixtNov 11, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.