On 10/9/23 16:51, Richard W.M. Jones wrote:
> 
> So one thing we could do for this test is to require (for the test)
> that /bin/sh is bash, something like the patch below.  I was only able
> to test this in the positive case.
> 
> diff --git a/tests/test-log-script-info.sh b/tests/test-log-script-info.sh
> index fa9b2ed32..d65f6415d 100755
> --- a/tests/test-log-script-info.sh
> +++ b/tests/test-log-script-info.sh
> @@ -38,6 +38,10 @@ requires_run
>  requires_nbdinfo
>  requires_filter log
>  
> +# This test implicitly assumes /bin/sh is bash, see:
> +# https://listman.redhat.com/archives/libguestfs/2023-October/032767.html
> +BASH_VERSION=no requires /bin/sh -c 'test "x$BASH_VERSION" != "xno"'
> +
>  if ! nbdinfo --help | grep -- --map ; then
>      echo "$0: nbdinfo --map option required to run this test"
>      exit 77
> 
> 

Clever!

Reviewed-by: Laszlo Ersek <ler...@redhat.com>

You can test it with "dash" BTW (it must be available in Fedora, because
it is available in EPEL-9):

BASH_VERSION=no /bin/bash -c 'test "x$BASH_VERSION" != "xno"; echo $?'
BASH_VERSION=no /bin/dash -c 'test "x$BASH_VERSION" != "xno"; echo $?'

Laszlo
_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to