tst_test.sh: Fix check for $TST_DEVICE
PATCH 1/1 tst_test.sh: Fix check for $TST_DEVICE
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.
---
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(-)
testcases/lib/tst_test.sh +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH 1/1 tst_test.sh: Fix check for $TST_DEVICE
----- Original Message -----
Quoted 7 lines
When
tst_deviceacquire 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 helperSigned-off-by Petr Vorel <[email protected]>
Good find, ACK
Quoted 4 lines
---
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.
PATCH 1/1 tst_test.sh: Fix check for $TST_DEVICE
In reply to Petr VorelHi!
Quoted 5 lines
When
tst_deviceacquire 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.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 tst_test.sh: Fix check for $TST_DEVICE
Hi,
Quoted 9 lines
Hi!
Quoted 5 lines
When
tst_deviceacquire 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 helperGood 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
PATCH 1/1 tst_test.sh: Fix check for $TST_DEVICE
In reply to Petr VorelHi,
Quoted 26 lines
When
tst_deviceacquire 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 helperSigned-off-by Petr Vorel <[email protected]>---
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.cobviously fails.Kind regards,
Petr--- testcases/lib/tst_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/lib/tst_test.sh +0
-0
testcases/lib/tst_test.sh tst_run() · line 369
Quoted 7 lines
testcases/lib/tst_test.sh +1
-1@@ -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