diff mbox

[1/4] iotests: fix exclusion option

Message ID 1432325832-12887-2-git-send-email-jsnow@redhat.com
State New
Headers show

Commit Message

John Snow May 22, 2015, 8:17 p.m. UTC
If you are running out-of-tree, the -x option to exclude
a certain iotest is broken.

Replace porcelain usage of ls with a sturdier grep command.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 tests/qemu-iotests/common | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Eric Blake May 22, 2015, 8:31 p.m. UTC | #1
On 05/22/2015 02:17 PM, John Snow wrote:
> If you are running out-of-tree, the -x option to exclude
> a certain iotest is broken.
> 
> Replace porcelain usage of ls with a sturdier grep command.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  tests/qemu-iotests/common | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
> index 1e556bb..c4d0742 100644
> --- a/tests/qemu-iotests/common
> +++ b/tests/qemu-iotests/common
> @@ -82,7 +82,8 @@ s/ .*//p
>      elif $xgroup
>      then
>          # arg after -x
> -        [ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list 2>/dev/null
> +        # Populate $tmp.list with all tests
> +        grep -oh -E "^([0-9]{3,})" "${source_iotests}/group" > $tmp.list 2>/dev/null

'grep -oh' is a GNU-ism; is it going to cause grief on BSD platforms?
John Snow May 22, 2015, 8:32 p.m. UTC | #2
On 05/22/2015 04:31 PM, Eric Blake wrote:
> On 05/22/2015 02:17 PM, John Snow wrote:
>> If you are running out-of-tree, the -x option to exclude a
>> certain iotest is broken.
>> 
>> Replace porcelain usage of ls with a sturdier grep command.
>> 
>> Signed-off-by: John Snow <jsnow@redhat.com> --- 
>> tests/qemu-iotests/common | 3 ++- 1 file changed, 2
>> insertions(+), 1 deletion(-)
>> 
>> diff --git a/tests/qemu-iotests/common
>> b/tests/qemu-iotests/common index 1e556bb..c4d0742 100644 ---
>> a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@
>> -82,7 +82,8 @@ s/ .*//p elif $xgroup then # arg after -x -
>> [ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9]
>> >$tmp.list 2>/dev/null +        # Populate $tmp.list with all
>> tests +        grep -oh -E "^([0-9]{3,})"
>> "${source_iotests}/group" > $tmp.list 2>/dev/null
> 
> 'grep -oh' is a GNU-ism; is it going to cause grief on BSD
> platforms?
> 

It might...  I'll look at other options. awk is probably fine here for
printing column 1.

--js
John Snow May 22, 2015, 10:48 p.m. UTC | #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256



On 05/22/2015 04:31 PM, Eric Blake wrote:
> On 05/22/2015 02:17 PM, John Snow wrote:
>> If you are running out-of-tree, the -x option to exclude a
>> certain iotest is broken.
>> 
>> Replace porcelain usage of ls with a sturdier grep command.
>> 
>> Signed-off-by: John Snow <jsnow@redhat.com> --- 
>> tests/qemu-iotests/common | 3 ++- 1 file changed, 2
>> insertions(+), 1 deletion(-)
>> 
>> diff --git a/tests/qemu-iotests/common
>> b/tests/qemu-iotests/common index 1e556bb..c4d0742 100644 ---
>> a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@
>> -82,7 +82,8 @@ s/ .*//p elif $xgroup then # arg after -x -
>> [ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9]
>> >$tmp.list 2>/dev/null +        # Populate $tmp.list with all
>> tests +        grep -oh -E "^([0-9]{3,})"
>> "${source_iotests}/group" > $tmp.list 2>/dev/null
> 
> 'grep -oh' is a GNU-ism; is it going to cause grief on BSD
> platforms?
> 

I'll fix this in v2 (but I'll wait for more reviews), but I will
replace this line with:

awk '/^[0-9]{3,}/ {print $1}' "${source_iotests}/group"	> $tmp.list
2>/dev/null

Which should be more friendly, I hope.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVX7JBAAoJEH3vgQaq/DkOhckP/0bvrjpbSnmjCnyk3Ku/PhAB
pD7jI87UiTUP3OYvR9cFtp3kukWYntfgIGLnNPq5QVL0ciaL52NYqt7yt5FaZEZh
hTpNYDb4HOeO/WuWYPxRjC/uxnhp+v6KlQOrQZ040wGrB6FbH+JJTrB53JtoDRTZ
1k4dn3EeK3wE0F6BRtr977+n+LCe4HMSwhL6qR6+k5HszX960Zpjc7YsvG4JIusm
arBAcQYglXhAV976QXGf/2TiZmIeChU2k1LAErueD7cpMIm1BcWoL+TYf1cFrKWU
n1hFjPaAZpw5WTnIYeLdPD95R2pIxcIB7huApw6YRCz+EZe5G6C1015D10mczB4K
Yz+p2t52IeCYp4qlwWPZuzOstHmyK6LsIRs4upiObw9eKRyt2NRi5GBXmqfTKSDY
nqoHvrFhyrTmUTfsqPmtGvA/dg7m8JAoh2kVxKXvmXE0Hq4mj/DqNwTGRFK933ux
DAtp5JY691aopj8Th1dxT7QerYqNB0WXQJrQRgWRmnPQgXx1o4CivNiTZ852f3Ux
EZHfsx/KN8Uc0fmbdNhOAxzwwlFaCSL100pR0q7vv7ddczqdjaVVqf25IrdrNZ0n
9oZNYe8Q4PrGSjz3Mmo+DgWH0Znn9p+lzHL8TEFu+OtRzSbHEAbJeSxN0RoLkOl8
M4O9Yh8fn1JnIWfnKUUZ
=8NHL
-----END PGP SIGNATURE-----
diff mbox

Patch

diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 1e556bb..c4d0742 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -82,7 +82,8 @@  s/ .*//p
     elif $xgroup
     then
         # arg after -x
-        [ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list 2>/dev/null
+        # Populate $tmp.list with all tests
+        grep -oh -E "^([0-9]{3,})" "${source_iotests}/group" > $tmp.list 2>/dev/null
         group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
 s/ .*//p
 }'`