threads / patch / 41047

patch, 2 partsgit-p4: kill watchdog and suppress irrelevant output

Subject: [PATCH v1 0/2] git-p4: kill watchdog and suppress irrelevant output

## tl;dr

8 messages between Dec 20, 2015 and Dec 24, 2015. Diffs are folded; open one to read it.

replies: 7people: 3as markdown or json

larsxschneider@gmail.com· Dec 20, 2015, 16:44 UTC · lore
From: Lars Schneider <larsxschneider@gmail.com>
Hi,

these patches extend "git-p4: add trap to kill p4d on test exit" (dfe90e8) and therefore should be applied on master.

Thanks, Lars

Lars Schneider (2):
  git-p4: kill p4d watchdog on cleanup
  git-p4: suppress non test relevant output
 t/lib-git-p4.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 2.5.1

larsxschneider@gmail.com· Dec 20, 2015, 16:44 UTC · re: larsxschneider@gmail.com · lore

[PATCH v1 1/2] git-p4: kill p4d watchdog on cleanup

From: Lars Schneider <larsxschneider@gmail.com>

If failing tests are executed with the "immediate" flag then "kill_p4d" is not called and consequently the watchdog process, which is supposed to detect a hanging p4d, is not killed. Kill the watchdog always in the "on exit" cleanup trap.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---
 t/lib-git-p4.sh | 1 +
 1 file changed, 1 insertion(+)
Show changes to t/lib-git-p4.sh +1 −1
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index f9ae1d7..30bf7ae 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -76,6 +76,7 @@ pidfile="$TRASH_DIRECTORY/p4d.pid"

 # Sometimes "prove" seems to hang on exit because p4d is still running
 cleanup() {
+	kill -9 $watchdog_pid 2>/dev/null
 	if test -f "$pidfile"
 	then
 		kill -9 $(cat "$pidfile") 2>/dev/null && exit 255
--
2.5.1
larsxschneider@gmail.com· Dec 20, 2015, 16:44 UTC · re: larsxschneider@gmail.com · lore

[PATCH v1 2/2] git-p4: suppress non test relevant output

From: Lars Schneider <larsxschneider@gmail.com>

If tests are executed in verbose mode then the retry logic clutters the test output. Suppress that clutter.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---
 t/lib-git-p4.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to t/lib-git-p4.sh +1 −2
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index 30bf7ae..03f29c1 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -174,7 +174,7 @@ retry_until_fail() {
 	until ! "$@" 2>/dev/null || test $(time_in_seconds) -gt $timeout
 	do
 		sleep 1
-	done
+	done >/dev/null 2>&1
 }

 kill_p4d() {
--
2.5.1
Junio C Hamano· Dec 21, 2015, 20:38 UTC · re: larsxschneider@gmail.com · lore

Re: [PATCH v1 2/2] git-p4: suppress non test relevant output

larsxschneider@gmail.com writes:
Show 20 quoted lines
> From: Lars Schneider <larsxschneider@gmail.com>
>
> If tests are executed in verbose mode then the retry logic clutters the
> test output. Suppress that clutter.
>
> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
> ---
>  t/lib-git-p4.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
> index 30bf7ae..03f29c1 100644
> --- a/t/lib-git-p4.sh
> +++ b/t/lib-git-p4.sh
> @@ -174,7 +174,7 @@ retry_until_fail() {
>  	until ! "$@" 2>/dev/null || test $(time_in_seconds) -gt $timeout
>  	do
>  		sleep 1
> -	done
> +	done >/dev/null 2>&1

Eh, what does this squelch? The sleep in the body of the loop is silent, "test A -gt B" on the loop condition would be silent too, so you are squelching the invocation of "$@" whose standard error stream is already sent to 2>/dev/null?

If so, why not do it there instead? You seem to run only "kill" to send some signal to a process using this helper function, and it would be silent on its standard output stream (even though it may say "no such process" etc. on its standard error), so it is not clear to me what you are doing with this change here...

Lars Schneider· Dec 22, 2015, 08:47 UTC · re: Junio C Hamano · lore

Re: [PATCH v1 2/2] git-p4: suppress non test relevant output

On 21 Dec 2015, at 21:38, Junio C Hamano <gitster@pobox.com> wrote:
Show 33 quoted lines
> larsxschneider@gmail.com writes:
> 
>> From: Lars Schneider <larsxschneider@gmail.com>
>> 
>> If tests are executed in verbose mode then the retry logic clutters the
>> test output. Suppress that clutter.
>> 
>> Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
>> ---
>> t/lib-git-p4.sh | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
>> index 30bf7ae..03f29c1 100644
>> --- a/t/lib-git-p4.sh
>> +++ b/t/lib-git-p4.sh
>> @@ -174,7 +174,7 @@ retry_until_fail() {
>> 	until ! "$@" 2>/dev/null || test $(time_in_seconds) -gt $timeout
>> 	do
>> 		sleep 1
>> -	done
>> +	done >/dev/null 2>&1
> 
> Eh, what does this squelch?  The sleep in the body of the loop is
> silent, "test A -gt B" on the loop condition would be silent too, so
> you are squelching the invocation of "$@" whose standard error
> stream is already sent to 2>/dev/null?
> 
> If so, why not do it there instead?  You seem to run only "kill" to
> send some signal to a process using this helper function, and it
> would be silent on its standard output stream (even though it may
> say "no such process" etc. on its standard error), so it is not
> clear to me what you are doing with this change here...
If I run git-p4 tests in verbose mode (e.g. "./t9823-git-p4-mock-lfs.sh -v") without this patch then the last lines of the output look like this:
>>> Output Start >>>
expecting success:
	kill_p4d
./lib-git-p4.sh: line 172: 26289 Killed: 9               while true; do
    if test $(time_in_seconds) -gt $timeout; then
        kill -9 $pid; exit 1;
    fi; sleep 1;
done
ok 8 - kill p4d

# passed all 8 test(s) 1..8 <<< Output end <<<

However, I want them to look like this:
>>> Output Start >>>
expecting success:
	kill_p4d
ok 8 - kill p4d

# passed all 8 test(s) 1..8 <<< Output end <<<

This is achieved with the patch. I am no shell expert ... is there a nicer way to achieve the same?

Thanks, Lars

Luke Diamand· Dec 24, 2015, 11:09 UTC · re: Lars Schneider · lore

Re: [PATCH v1 2/2] git-p4: suppress non test relevant output

On 22/12/15 08:47, Lars Schneider wrote:
>
> On 21 Dec 2015, at 21:38, Junio C Hamano <gitster@pobox.com> wrote:
>
Show 37 quoted lines
>>
>> If so, why not do it there instead?  You seem to run only "kill" to
>> send some signal to a process using this helper function, and it
>> would be silent on its standard output stream (even though it may
>> say "no such process" etc. on its standard error), so it is not
>> clear to me what you are doing with this change here...
>
> If I run git-p4 tests in verbose mode (e.g. "./t9823-git-p4-mock-lfs.sh -v") without this patch then the last lines of the output look like this:
>
>>>> Output Start >>>
> expecting success:
> 	kill_p4d
>
> ./lib-git-p4.sh: line 172: 26289 Killed: 9               while true; do
>      if test $(time_in_seconds) -gt $timeout; then
>          kill -9 $pid; exit 1;
>      fi; sleep 1;
> done
> ok 8 - kill p4d
>
> # passed all 8 test(s)
> 1..8
> <<< Output end <<<
>
> However, I want them to look like this:
>
>>>> Output Start >>>
> expecting success:
> 	kill_p4d
>
> ok 8 - kill p4d
>
> # passed all 8 test(s)
> 1..8
> <<< Output end <<<
>
> This is achieved with the patch. I am no shell expert ... is there a nicer way to achieve the same?
I get your desired output with the unmodified code from origin/next:
$ ./t9823-git-p4-mock-lfs.sh -v
expecting success:
	kill_p4d
ok 8 - kill p4d

# passed all 8 test(s) 1..8

But that's because my shell is symlinked to /bin/dash. I suspect you are using bash - when I run this with bash I get your command output. Possibly a bash bug?

As Junio says, it seems a bit weird that we have to redirect the stderr of that entire expression.

Luke
Junio C Hamano· Dec 21, 2015, 20:31 UTC · re: larsxschneider@gmail.com · lore

Re: [PATCH v1 0/2] git-p4: kill watchdog and suppress irrelevant output

larsxschneider@gmail.com writes:
Show 6 quoted lines
> From: Lars Schneider <larsxschneider@gmail.com>
>
> Hi,
>
> these patches extend "git-p4: add trap to kill p4d on test exit" (dfe90e8)
> and therefore should be applied on master.

Wait, wait. Please be a bit more careful when you use such a phrasing. Did somebody review these and said that these are trivially correct improvements?

This depends on what you exactly meant "extend" and "improve" (for the other one); if the "improvement" were to make something that used to be unusable to usable, then the more sensible way forward during the -rc stabilization period might be to revert the earlier merges to 'master' that brought in undercooked topic.

Thanks.
Show 13 quoted lines
>
> Thanks,
> Lars
>
> Lars Schneider (2):
>   git-p4: kill p4d watchdog on cleanup
>   git-p4: suppress non test relevant output
>
>  t/lib-git-p4.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> --
> 2.5.1
Lars Schneider· Dec 22, 2015, 09:12 UTC · re: Junio C Hamano · lore

Re: [PATCH v1 0/2] git-p4: kill watchdog and suppress irrelevant output

On 21 Dec 2015, at 21:31, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> larsxschneider@gmail.com writes:
> 
>> From: Lars Schneider <larsxschneider@gmail.com>
>> 
>> Hi,
>> 
>> these patches extend "git-p4: add trap to kill p4d on test exit" (dfe90e8)
>> and therefore should be applied on master.
> 
> Wait, wait.  Please be a bit more careful when you use such a
> phrasing.  Did somebody review these and said that these are
> trivially correct improvements?
> 
> This depends on what you exactly meant "extend" and "improve" (for
> the other one); if the "improvement" were to make something that
> used to be unusable to usable, then the more sensible way forward
> during the -rc stabilization period might be to revert the earlier
> merges to 'master' that brought in undercooked topic.

Oh. Thanks or making me aware of the inappropriate phrases! Nobody reviewed these patches, yet!

My intention was to let the reviewer know that this patch series is based on "master" and not on "maint". Sorry for the confusion!

The patch series "git-p4: kill watchdog and suppress irrelevant output" fixes something annoying that I did not spot earlier. In other words it changes "usable but a bit annoying (dfe90e8)" to "usable".

The patch series "git-p4: ignore P4 changelists that only touch files" changes "usable (4ae048e)" to "maybe even better" depending on the reviewers opinion.

Thanks, Lars

← back to recent threads