Message ID | 20200912121412.10999-1-thuth@redhat.com |
---|---|
State | New |
Headers | show |
Series | tests/check-block: Do not run the iotests with old versions of bash | expand |
On 12.09.20 14:14, Thomas Huth wrote: > macOS is shipped with a very old version of the bash (3.2), which > is currently not suitable for running the iotests anymore. Add > a check to skip the iotests in this case - if someone still wants > to run the iotests on macOS, they can install a newer version from > homebrew, for example. > > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > tests/check-block.sh | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/tests/check-block.sh b/tests/check-block.sh > index 8e29c868e5..bfe1630c1e 100755 > --- a/tests/check-block.sh > +++ b/tests/check-block.sh > @@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then > exit 0 > fi > > +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then grep -q instead of the redirections, perhaps? But more importantly, I think this needs a LANG=C prefix. (If I expand the rejected major versions to [12345], it doesn’t skip without a prefix, because the string reads “GNU bash, Version 5...” here in LANG=de_DE.UTF-8.) Max > + echo "bash version too old ==> Not running the qemu-iotests." > + exit 0 > +fi > + > if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then > if ! command -v gsed >/dev/null 2>&1; then > echo "GNU sed not available ==> Not running the qemu-iotests." >
On Sat, Sep 12, 2020 at 8:16 PM Thomas Huth <thuth@redhat.com> wrote: > > macOS is shipped with a very old version of the bash (3.2), which > is currently not suitable for running the iotests anymore. Add > a check to skip the iotests in this case - if someone still wants > to run the iotests on macOS, they can install a newer version from > homebrew, for example. > > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > tests/check-block.sh | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/tests/check-block.sh b/tests/check-block.sh > index 8e29c868e5..bfe1630c1e 100755 > --- a/tests/check-block.sh > +++ b/tests/check-block.sh > @@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then > exit 0 > fi > > +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then > + echo "bash version too old ==> Not running the qemu-iotests." > + exit 0 > +fi > + > if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then > if ! command -v gsed >/dev/null 2>&1; then > echo "GNU sed not available ==> Not running the qemu-iotests." > -- > 2.18.2 > > Is that worth to convert the check-block.sh script to python script? so it can even running under msys2/mingw? -- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo
On 14/09/2020 11.36, 罗勇刚(Yonggang Luo) wrote: > > > On Sat, Sep 12, 2020 at 8:16 PM Thomas Huth <thuth@redhat.com > <mailto:thuth@redhat.com>> wrote: >> >> macOS is shipped with a very old version of the bash (3.2), which >> is currently not suitable for running the iotests anymore. Add >> a check to skip the iotests in this case - if someone still wants >> to run the iotests on macOS, they can install a newer version from >> homebrew, for example. >> >> Signed-off-by: Thomas Huth <thuth@redhat.com <mailto:thuth@redhat.com>> >> --- >> tests/check-block.sh | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/tests/check-block.sh b/tests/check-block.sh >> index 8e29c868e5..bfe1630c1e 100755 >> --- a/tests/check-block.sh >> +++ b/tests/check-block.sh >> @@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then >> exit 0 >> fi >> >> +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; > then >> + echo "bash version too old ==> Not running the qemu-iotests." >> + exit 0 >> +fi >> + >> if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then >> if ! command -v gsed >/dev/null 2>&1; then >> echo "GNU sed not available ==> Not running the qemu-iotests." >> -- >> 2.18.2 >> >> > Is that worth to convert the check-block.sh script to python script? so > it can even running under msys2/mingw? No, you need bash for the various iotest anyway. Thomas
On 14/09/2020 11.19, Max Reitz wrote: > On 12.09.20 14:14, Thomas Huth wrote: >> macOS is shipped with a very old version of the bash (3.2), which >> is currently not suitable for running the iotests anymore. Add >> a check to skip the iotests in this case - if someone still wants >> to run the iotests on macOS, they can install a newer version from >> homebrew, for example. >> >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> --- >> tests/check-block.sh | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/tests/check-block.sh b/tests/check-block.sh >> index 8e29c868e5..bfe1630c1e 100755 >> --- a/tests/check-block.sh >> +++ b/tests/check-block.sh >> @@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then >> exit 0 >> fi >> >> +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then > > grep -q instead of the redirections, perhaps? > > But more importantly, I think this needs a LANG=C prefix. (If I expand > the rejected major versions to [12345], it doesn’t skip without a > prefix, because the string reads “GNU bash, Version 5...” here in > LANG=de_DE.UTF-8.) Ouch, ok. But actually, I'm not quite sure anymore whether the patch is really required. I ran into the "readlink -f" problem and thought that it occurred due to the ancient version of bash on macOS, but as a I now know, readlink is a separate program and not a bash built-in, so it's a different issue... thus let's skip this patch here for now until we hit a real issue with bash again. Thomas
On 14.09.20 12:50, Thomas Huth wrote: > On 14/09/2020 11.19, Max Reitz wrote: >> On 12.09.20 14:14, Thomas Huth wrote: >>> macOS is shipped with a very old version of the bash (3.2), which >>> is currently not suitable for running the iotests anymore. Add >>> a check to skip the iotests in this case - if someone still wants >>> to run the iotests on macOS, they can install a newer version from >>> homebrew, for example. >>> >>> Signed-off-by: Thomas Huth <thuth@redhat.com> >>> --- >>> tests/check-block.sh | 5 +++++ >>> 1 file changed, 5 insertions(+) >>> >>> diff --git a/tests/check-block.sh b/tests/check-block.sh >>> index 8e29c868e5..bfe1630c1e 100755 >>> --- a/tests/check-block.sh >>> +++ b/tests/check-block.sh >>> @@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then >>> exit 0 >>> fi >>> >>> +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then >> >> grep -q instead of the redirections, perhaps? >> >> But more importantly, I think this needs a LANG=C prefix. (If I expand >> the rejected major versions to [12345], it doesn’t skip without a >> prefix, because the string reads “GNU bash, Version 5...” here in >> LANG=de_DE.UTF-8.) > > Ouch, ok. But actually, I'm not quite sure anymore whether the patch is > really required. I ran into the "readlink -f" problem and thought that > it occurred due to the ancient version of bash on macOS, but as a I now > know, readlink is a separate program and not a bash built-in, so it's a > different issue... thus let's skip this patch here for now until we hit > a real issue with bash again. Yes, I had hoped this patch would fix that issue. Or perhaps at least hide it, because if you have a newer bash, chances are your readlink has -f, too. So should we just effectively revert b1cbc33a397 if readlink -f didn’t work, i.e. check "$?" and on failure use $PWD as it was before b1cbc33a397? Max
On 14/09/2020 13.13, Max Reitz wrote: > On 14.09.20 12:50, Thomas Huth wrote: >> On 14/09/2020 11.19, Max Reitz wrote: >>> On 12.09.20 14:14, Thomas Huth wrote: >>>> macOS is shipped with a very old version of the bash (3.2), which >>>> is currently not suitable for running the iotests anymore. Add >>>> a check to skip the iotests in this case - if someone still wants >>>> to run the iotests on macOS, they can install a newer version from >>>> homebrew, for example. >>>> >>>> Signed-off-by: Thomas Huth <thuth@redhat.com> >>>> --- >>>> tests/check-block.sh | 5 +++++ >>>> 1 file changed, 5 insertions(+) >>>> >>>> diff --git a/tests/check-block.sh b/tests/check-block.sh >>>> index 8e29c868e5..bfe1630c1e 100755 >>>> --- a/tests/check-block.sh >>>> +++ b/tests/check-block.sh >>>> @@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then >>>> exit 0 >>>> fi >>>> >>>> +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then >>> >>> grep -q instead of the redirections, perhaps? >>> >>> But more importantly, I think this needs a LANG=C prefix. (If I expand >>> the rejected major versions to [12345], it doesn’t skip without a >>> prefix, because the string reads “GNU bash, Version 5...” here in >>> LANG=de_DE.UTF-8.) >> >> Ouch, ok. But actually, I'm not quite sure anymore whether the patch is >> really required. I ran into the "readlink -f" problem and thought that >> it occurred due to the ancient version of bash on macOS, but as a I now >> know, readlink is a separate program and not a bash built-in, so it's a >> different issue... thus let's skip this patch here for now until we hit >> a real issue with bash again. > > Yes, I had hoped this patch would fix that issue. Or perhaps at least > hide it, because if you have a newer bash, chances are your readlink has > -f, too. > > So should we just effectively revert b1cbc33a397 if readlink -f didn’t > work, i.e. check "$?" and on failure use $PWD as it was before b1cbc33a397? Sounds like the best option that I currently can see, indeed. Want me to send a patch, or will you provide one? Thomas
On 9/12/20 7:14 AM, Thomas Huth wrote: > macOS is shipped with a very old version of the bash (3.2), which > is currently not suitable for running the iotests anymore. Add > a check to skip the iotests in this case - if someone still wants > to run the iotests on macOS, they can install a newer version from > homebrew, for example. > > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > tests/check-block.sh | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/tests/check-block.sh b/tests/check-block.sh > index 8e29c868e5..bfe1630c1e 100755 > --- a/tests/check-block.sh > +++ b/tests/check-block.sh > @@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then > exit 0 > fi > > +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then We're already running bash - why do we need to spawn another bash and a grep, when we can just check $BASH_VERSION?
On 14/09/2020 17.03, Eric Blake wrote: > On 9/12/20 7:14 AM, Thomas Huth wrote: >> macOS is shipped with a very old version of the bash (3.2), which >> is currently not suitable for running the iotests anymore. Add >> a check to skip the iotests in this case - if someone still wants >> to run the iotests on macOS, they can install a newer version from >> homebrew, for example. >> >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> --- >> tests/check-block.sh | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/tests/check-block.sh b/tests/check-block.sh >> index 8e29c868e5..bfe1630c1e 100755 >> --- a/tests/check-block.sh >> +++ b/tests/check-block.sh >> @@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then >> exit 0 >> fi >> +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 >> ; then > > We're already running bash - why do we need to spawn another bash and a > grep, when we can just check $BASH_VERSION? tests/check-block.sh uses "#!/bin/sh", so it could be running with a different kind of shell, I think. Thomas
On 9/14/20 10:33 AM, Thomas Huth wrote: > On 14/09/2020 17.03, Eric Blake wrote: >> On 9/12/20 7:14 AM, Thomas Huth wrote: >>> macOS is shipped with a very old version of the bash (3.2), which >>> is currently not suitable for running the iotests anymore. Add >>> a check to skip the iotests in this case - if someone still wants >>> to run the iotests on macOS, they can install a newer version from >>> homebrew, for example. >>> >>> Signed-off-by: Thomas Huth <thuth@redhat.com> >>> --- >>> tests/check-block.sh | 5 +++++ >>> 1 file changed, 5 insertions(+) >>> >>> diff --git a/tests/check-block.sh b/tests/check-block.sh >>> index 8e29c868e5..bfe1630c1e 100755 >>> --- a/tests/check-block.sh >>> +++ b/tests/check-block.sh >>> @@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then >>> exit 0 >>> fi >>> +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 >>> ; then >> >> We're already running bash - why do we need to spawn another bash and a >> grep, when we can just check $BASH_VERSION? > > tests/check-block.sh uses "#!/bin/sh", so it could be running with a > different kind of shell, I think. Ah, right; I'm so used to most of our testsuite demanding bash that I forgot to check that this script sticks to the smaller subset of /bin/sh portability.
diff --git a/tests/check-block.sh b/tests/check-block.sh index 8e29c868e5..bfe1630c1e 100755 --- a/tests/check-block.sh +++ b/tests/check-block.sh @@ -46,6 +46,11 @@ if ! command -v bash >/dev/null 2>&1 ; then exit 0 fi +if bash --version | grep 'GNU bash, version [123]' > /dev/null 2>&1 ; then + echo "bash version too old ==> Not running the qemu-iotests." + exit 0 +fi + if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then if ! command -v gsed >/dev/null 2>&1; then echo "GNU sed not available ==> Not running the qemu-iotests."
macOS is shipped with a very old version of the bash (3.2), which is currently not suitable for running the iotests anymore. Add a check to skip the iotests in this case - if someone still wants to run the iotests on macOS, they can install a newer version from homebrew, for example. Signed-off-by: Thomas Huth <thuth@redhat.com> --- tests/check-block.sh | 5 +++++ 1 file changed, 5 insertions(+)