All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] tst_test.sh: Fix check for $TST_DEVICE
@ 2018-06-28 12:29 Petr Vorel
  2018-06-28 19:59 ` Jan Stancek
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Petr Vorel @ 2018-06-28 12:29 UTC (permalink / raw)
  To: ltp

When tst_device acquire call fails, it outputs into stdout,
therefore the content is actually help message.
=> Check for file presence rather than variable not being empty.

Fixes: c5ac5d712 tst_test.sh: Make use of tst_device helper

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,

other option would be to check $?.

BTW found while testing on TMPDIR being tmpfs with small size (300M).
Test lib/newlib_tests/tst_device.c obviously fails.

Kind regards,
Petr
---
 testcases/lib/tst_test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index d27b4afd6..799045b03 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -364,7 +364,7 @@ tst_run()
 
 		TST_DEVICE=$(tst_device acquire)
 
-		if [ -z "$TST_DEVICE" ]; then
+		if [ ! -b "$TST_DEVICE" ]; then
 			tst_brk TBROK "Failed to acquire device"
 		fi
 
-- 
2.17.1


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

* [LTP] [PATCH 1/1] tst_test.sh: Fix check for $TST_DEVICE
  2018-06-28 12:29 [LTP] [PATCH 1/1] tst_test.sh: Fix check for $TST_DEVICE Petr Vorel
@ 2018-06-28 19:59 ` Jan Stancek
  2018-06-29 13:49 ` Cyril Hrubis
  2018-06-29 14:58 ` Petr Vorel
  2 siblings, 0 replies; 5+ messages in thread
From: Jan Stancek @ 2018-06-28 19:59 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> When tst_device acquire call fails, it outputs into stdout,
> therefore the content is actually help message.
> => Check for file presence rather than variable not being empty.
> 
> Fixes: c5ac5d712 tst_test.sh: Make use of tst_device helper
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>

Good find, ACK

> ---
> Hi,
> 
> other option would be to check $?.

Or both. Attach is very last call to ioctl(), so I think
we can't end up with valid block device and non-zero retcode.

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

* [LTP] [PATCH 1/1] tst_test.sh: Fix check for $TST_DEVICE
  2018-06-28 12:29 [LTP] [PATCH 1/1] tst_test.sh: Fix check for $TST_DEVICE Petr Vorel
  2018-06-28 19:59 ` Jan Stancek
@ 2018-06-29 13:49 ` Cyril Hrubis
  2018-06-29 15:22   ` Petr Vorel
  2018-06-29 14:58 ` Petr Vorel
  2 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2018-06-29 13:49 UTC (permalink / raw)
  To: ltp

Hi!
> When tst_device acquire call fails, it outputs into stdout,
> therefore the content is actually help message.
> => Check for file presence rather than variable not being empty.
> 
> Fixes: c5ac5d712 tst_test.sh: Make use of tst_device helper

Good catch, I guess that it also wouldn't harm if we changed the helper
to print the help message to stderr as well.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH 1/1] tst_test.sh: Fix check for $TST_DEVICE
  2018-06-28 12:29 [LTP] [PATCH 1/1] tst_test.sh: Fix check for $TST_DEVICE Petr Vorel
  2018-06-28 19:59 ` Jan Stancek
  2018-06-29 13:49 ` Cyril Hrubis
@ 2018-06-29 14:58 ` Petr Vorel
  2 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2018-06-29 14:58 UTC (permalink / raw)
  To: ltp

Hi,

> When tst_device acquire call fails, it outputs into stdout,
> therefore the content is actually help message.
> => Check for file presence rather than variable not being empty.

> Fixes: c5ac5d712 tst_test.sh: Make use of tst_device helper

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi,

> other option would be to check $?.

> BTW found while testing on TMPDIR being tmpfs with small size (300M).
> Test lib/newlib_tests/tst_device.c obviously fails.

> Kind regards,
> Petr
> ---
>  testcases/lib/tst_test.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index d27b4afd6..799045b03 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -364,7 +364,7 @@ tst_run()

>  		TST_DEVICE=$(tst_device acquire)

> -		if [ -z "$TST_DEVICE" ]; then
> +		if [ ! -b "$TST_DEVICE" ]; then
>  			tst_brk TBROK "Failed to acquire device"
>  		fi
Pushed with Jan's ack and as 
-               if [ -z "$TST_DEVICE" ]; then
+               if [ ! -b "$TST_DEVICE" -o $? -ne 0 ]; then


Kind regards,
Petr

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

* [LTP] [PATCH 1/1] tst_test.sh: Fix check for $TST_DEVICE
  2018-06-29 13:49 ` Cyril Hrubis
@ 2018-06-29 15:22   ` Petr Vorel
  0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2018-06-29 15:22 UTC (permalink / raw)
  To: ltp

Hi, 
> Hi!
> > When tst_device acquire call fails, it outputs into stdout,
> > therefore the content is actually help message.
> > => Check for file presence rather than variable not being empty.

> > Fixes: c5ac5d712 tst_test.sh: Make use of tst_device helper

> Good catch, I guess that it also wouldn't harm if we changed the helper
> to print the help message to stderr as well.

Pushed, with your Suggested-by:


Kind regards,
Petr

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

end of thread, other threads:[~2018-06-29 15:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-28 12:29 [LTP] [PATCH 1/1] tst_test.sh: Fix check for $TST_DEVICE Petr Vorel
2018-06-28 19:59 ` Jan Stancek
2018-06-29 13:49 ` Cyril Hrubis
2018-06-29 15:22   ` Petr Vorel
2018-06-29 14:58 ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.