[PATCH v1 13/18] tests/docker: check for an parameters not empty string

Alex Bennée posted 18 patches 5 years, 7 months ago
[PATCH v1 13/18] tests/docker: check for an parameters not empty string
Posted by Alex Bennée 5 years, 7 months ago
Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/docker/common.rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/docker/common.rc b/tests/docker/common.rc
index 02cd67a8c5e..b27ce17e333 100755
--- a/tests/docker/common.rc
+++ b/tests/docker/common.rc
@@ -47,7 +47,7 @@ build_qemu()
 check_qemu()
 {
     # default to make check unless the caller specifies
-    if test -z "$@"; then
+    if [ $# == 0 ]; then
         INVOCATION="check"
     else
         INVOCATION="$@"
-- 
2.20.1


Re: [PATCH v1 13/18] tests/docker: check for an parameters not empty string
Posted by Philippe Mathieu-Daudé 5 years, 7 months ago
On 6/22/20 4:31 PM, Alex Bennée wrote:
> Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/docker/common.rc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/docker/common.rc b/tests/docker/common.rc
> index 02cd67a8c5e..b27ce17e333 100755
> --- a/tests/docker/common.rc
> +++ b/tests/docker/common.rc
> @@ -47,7 +47,7 @@ build_qemu()
>  check_qemu()
>  {
>      # default to make check unless the caller specifies
> -    if test -z "$@"; then
> +    if [ $# == 0 ]; then
>          INVOCATION="check"
>      else
>          INVOCATION="$@"
> 

Re: [PATCH v1 13/18] tests/docker: check for an parameters not empty string
Posted by Eric Blake 5 years, 7 months ago
On 6/22/20 9:31 AM, Alex Bennée wrote:
> Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   tests/docker/common.rc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/docker/common.rc b/tests/docker/common.rc
> index 02cd67a8c5e..b27ce17e333 100755
> --- a/tests/docker/common.rc
> +++ b/tests/docker/common.rc
> @@ -47,7 +47,7 @@ build_qemu()
>   check_qemu()
>   {
>       # default to make check unless the caller specifies
> -    if test -z "$@"; then
> +    if [ $# == 0 ]; then

This is a bashism, but in a file marked #!/bin/sh.  You need to spell it 
= instead of ==.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org