public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests: make kill to go-around when /proc is not available
@ 2014-05-07 17:01 Sami Kerola
  2014-05-07 20:12 ` Ruediger Meier
  0 siblings, 1 reply; 4+ messages in thread
From: Sami Kerola @ 2014-05-07 17:01 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

And change messaging to be easier to debug, if the outcome of the
opportunistic sleep is unsuccessful test.  In such case one could assume
the test_sigreceive was not successful when setting handler.  Maybe
because of load on test server, or some other reason.

Reference: https://travis-ci.org/rudimeier/util-linux/jobs/24561058
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 tests/ts/kill/kill_functions.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/ts/kill/kill_functions.sh b/tests/ts/kill/kill_functions.sh
index 043b4cb..56ad98b 100644
--- a/tests/ts/kill/kill_functions.sh
+++ b/tests/ts/kill/kill_functions.sh
@@ -5,6 +5,16 @@ function check_test_sigreceive {
 	local pid=$1
 
 	for i in 0.01 0.1 1 1 1 1; do
+		if [ ! -f /proc/$pid/status ]; then
+			# This message is visible in tests/run.sh output.
+			# Do not direct to $TS_OUTPUT it would make test
+			# fail, while with a bit of luck this might be
+			# recoverable (after a sleep).
+			echo "kill_functions.sh: /proc/$pid/status: No such file or directory" &&
+			rc=1 &&
+			sleep 2 &&
+			break
+		fi
 		awk 'BEGIN { retval=1 }
 		/^SigCgt/ {
 			lbyte = strtonum("0x" substr($2, 16, 16))
-- 
1.9.2


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

* Re: [PATCH] tests: make kill to go-around when /proc is not available
  2014-05-07 17:01 [PATCH] tests: make kill to go-around when /proc is not available Sami Kerola
@ 2014-05-07 20:12 ` Ruediger Meier
  2014-05-08  9:10   ` Sami Kerola
  0 siblings, 1 reply; 4+ messages in thread
From: Ruediger Meier @ 2014-05-07 20:12 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

Hi Sami,

On Wednesday 07 May 2014, Sami Kerola wrote:
> [PATCH] tests: make kill to go-around when /proc is not available

Do you really want to get it work when whole /proc is not available
or just if /proc/$pid/status is still missing?

> And change messaging to be easier to debug, if the outcome of the
> opportunistic sleep is unsuccessful test.  In such case one could
> assume the test_sigreceive was not successful when setting handler. 
> Maybe because of load on test server, or some other reason.
>
> Reference: https://travis-ci.org/rudimeier/util-linux/jobs/24561058
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
>  tests/ts/kill/kill_functions.sh | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/tests/ts/kill/kill_functions.sh
> b/tests/ts/kill/kill_functions.sh index 043b4cb..56ad98b 100644
> --- a/tests/ts/kill/kill_functions.sh
> +++ b/tests/ts/kill/kill_functions.sh
> @@ -5,6 +5,16 @@ function check_test_sigreceive {
>  	local pid=$1
>
>  	for i in 0.01 0.1 1 1 1 1; do
> +		if [ ! -f /proc/$pid/status ]; then
> +			# This message is visible in tests/run.sh output.
> +			# Do not direct to $TS_OUTPUT it would make test
> +			# fail, while with a bit of luck this might be
> +			# recoverable (after a sleep).

How could the test still succeed if we break the loop and return 1?
In this case the particular tests usually write "helper did not start"
to $TS_OUTPUT.

> +			echo "kill_functions.sh: /proc/$pid/status: No such file or directory" &&
> +			rc=1 && 

Shouldn't we return 0 here ...

> +			sleep 2 &&
> +			break

... or only continue the loop to hope that /proc/$pid/status will be
there next round?

> +		fi
>  		awk 'BEGIN { retval=1 }
>  		/^SigCgt/ {
>  			lbyte = strtonum("0x" substr($2, 16, 16))


cu,
Rudi

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

* Re: [PATCH] tests: make kill to go-around when /proc is not available
  2014-05-07 20:12 ` Ruediger Meier
@ 2014-05-08  9:10   ` Sami Kerola
  2014-05-08 20:29     ` Ruediger Meier
  0 siblings, 1 reply; 4+ messages in thread
From: Sami Kerola @ 2014-05-08  9:10 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On 7 May 2014 21:12, Ruediger Meier <sweet_f_a@gmx.de> wrote:
> On Wednesday 07 May 2014, Sami Kerola wrote:
>> [PATCH] tests: make kill to go-around when /proc is not available
>
> Do you really want to get it work when whole /proc is not available
> or just if /proc/$pid/status is still missing?

Hi Rudi,

Right, sloppy from my side. The title should say 'if /proc/$pid/status
is missing'. Test to check availability of /proc should be in
test/functions.sh, and where /proc is missing should gracefully bail
out before starting signal helper. If /proc/$pid is available, but not
the status file then waiting is unlikely to help, and opportunistic
sleep is most likely the best option.

I'll write new change before Sunday.

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

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

* Re: [PATCH] tests: make kill to go-around when /proc is not available
  2014-05-08  9:10   ` Sami Kerola
@ 2014-05-08 20:29     ` Ruediger Meier
  0 siblings, 0 replies; 4+ messages in thread
From: Ruediger Meier @ 2014-05-08 20:29 UTC (permalink / raw)
  To: kerolasa; +Cc: util-linux

On Thursday 08 May 2014, Sami Kerola wrote:
> On 7 May 2014 21:12, Ruediger Meier <sweet_f_a@gmx.de> wrote:
> > On Wednesday 07 May 2014, Sami Kerola wrote:
> >> [PATCH] tests: make kill to go-around when /proc is not available
> >
> > Do you really want to get it work when whole /proc is not available
> > or just if /proc/$pid/status is still missing?
>
> Hi Rudi,
>
> Right, sloppy from my side. The title should say 'if
> /proc/$pid/status is missing'. Test to check availability of /proc
> should be in test/functions.sh, and where /proc is missing should
> gracefully bail out before starting signal helper. If /proc/$pid is
> available, but not the status file then waiting is unlikely to help,
> and opportunistic sleep is most likely the best option.

Have you also noticed my other comments to the test code?

> I'll write new change before Sunday.

thanks,
Rudi

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

end of thread, other threads:[~2014-05-08 20:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-07 17:01 [PATCH] tests: make kill to go-around when /proc is not available Sami Kerola
2014-05-07 20:12 ` Ruediger Meier
2014-05-08  9:10   ` Sami Kerola
2014-05-08 20:29     ` Ruediger Meier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox