[Qemu-devel] [PATCH v2 1/4] tests/qemu-iotests/check: Allow tests without groups

Thomas Huth posted 4 patches 6 years, 6 months ago
Maintainers: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>, Thomas Huth <thuth@redhat.com>
There is a newer version of this series
[Qemu-devel] [PATCH v2 1/4] tests/qemu-iotests/check: Allow tests without groups
Posted by Thomas Huth 6 years, 6 months ago
The regular expressions in the "check" script currently expect that there
is always a space after the test number in the group file, so you can't
have a test in there without a group unless the line still ends with a
space - which is quite error prone since some editors might remove spaces
at the end of lines automatically.
Thus let's fix the regular expressions so that it is also possible to
have lines with one test number only in the group file.

Suggested-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/qemu-iotests/check | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index f925606cc5..c24874ff4a 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -488,7 +488,7 @@ testlist options
 BEGIN        { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
         | while read id
         do
-            if grep -s "^$id " "$source_iotests/group" >/dev/null
+            if grep -s "^$id\( \|\$\)" "$source_iotests/group" >/dev/null
             then
                 # in group file ... OK
                 echo $id >>$tmp.list
@@ -547,7 +547,7 @@ else
         touch $tmp.list
     else
         # no test numbers, do everything from group file
-        sed -n -e '/^[0-9][0-9][0-9]*/s/[         ].*//p' <"$source_iotests/group" >$tmp.list
+        sed -n -e '/^[0-9][0-9][0-9]*/s/^\([0-9]*\).*/\1/p' <"$source_iotests/group" >$tmp.list
     fi
 fi
 
-- 
2.21.0


Re: [Qemu-devel] [PATCH v2 1/4] tests/qemu-iotests/check: Allow tests without groups
Posted by Alex Bennée 6 years, 6 months ago
Thomas Huth <thuth@redhat.com> writes:

> The regular expressions in the "check" script currently expect that there
> is always a space after the test number in the group file, so you can't
> have a test in there without a group unless the line still ends with a
> space - which is quite error prone since some editors might remove spaces
> at the end of lines automatically.
> Thus let's fix the regular expressions so that it is also possible to
> have lines with one test number only in the group file.
>
> Suggested-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  tests/qemu-iotests/check | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index f925606cc5..c24874ff4a 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -488,7 +488,7 @@ testlist options
>  BEGIN        { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
>          | while read id
>          do
> -            if grep -s "^$id " "$source_iotests/group" >/dev/null
> +            if grep -s "^$id\( \|\$\)" "$source_iotests/group" >/dev/null
>              then
>                  # in group file ... OK
>                  echo $id >>$tmp.list
> @@ -547,7 +547,7 @@ else
>          touch $tmp.list
>      else
>          # no test numbers, do everything from group file
> -        sed -n -e '/^[0-9][0-9][0-9]*/s/[         ].*//p' <"$source_iotests/group" >$tmp.list
> +        sed -n -e '/^[0-9][0-9][0-9]*/s/^\([0-9]*\).*/\1/p' <"$source_iotests/group" >$tmp.list
>      fi
>  fi


--
Alex Bennée

Re: [Qemu-devel] [PATCH v2 1/4] tests/qemu-iotests/check: Allow tests without groups
Posted by Max Reitz 6 years, 6 months ago
On 16.07.19 14:28, Thomas Huth wrote:
> The regular expressions in the "check" script currently expect that there
> is always a space after the test number in the group file, so you can't
> have a test in there without a group unless the line still ends with a
> space - which is quite error prone since some editors might remove spaces
> at the end of lines automatically.
> Thus let's fix the regular expressions so that it is also possible to
> have lines with one test number only in the group file.
> 
> Suggested-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  tests/qemu-iotests/check | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

FWIW

Reviewed-by: Max Reitz <mreitz@redhat.com>