Re: [PATCH 4/5] iotests: Skip "make check-block" if QEMU does not support virtio-blk
On 11.10.19 16:50, Thomas Huth wrote: > The next patch is going to add some python-based tests to the "auto" > group, and these tests require virtio-blk to work properly. Running > iotests without virtio-blk likely does not make too much sense anyway, > so instead of adding a check for the availability of virtio-blk to each > and every test (which does not sound very appealing), let's rather add > a check for this at the top level in the check-block.sh script instead > (so that it is possible to run "make check" without the "check-block" > part for qemu-system-tricore for example). > > Signed-off-by: Thomas Huth > --- > tests/check-block.sh | 16 +++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/tests/check-block.sh b/tests/check-block.sh > index 679aedec50..7582347ec2 100755 > --- a/tests/check-block.sh > +++ b/tests/check-block.sh > @@ -26,10 +26,24 @@ if grep -q "CFLAGS.*-fsanitize" config-host.mak > 2>/dev/null ; then > exit 0 > fi > > -if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then > +if [ -n "$QEMU_PROG" ]; then > +qemu_prog="$QEMU_PROG" > +else > +for binary in *-softmmu/qemu-system-* ; do > +if [ -x "$binary" ]; then > +qemu_prog="$binary" > +break > +fi > +done > +fi > +if [ -z "$qemu_prog" ]; then > echo "No qemu-system binary available ==> Not running the qemu-iotests." > exit 0 > fi > +if ! "$qemu_prog" -M none -device help | grep virtio-blk >/dev/null 2>&1 ; > then Maybe grep -q? Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature
Re: [PATCH 4/5] iotests: Skip "make check-block" if QEMU does not support virtio-blk
Am 14.10.2019 um 13:27 hat Thomas Huth geschrieben: > On 14/10/2019 13.21, Kevin Wolf wrote: > > Am 11.10.2019 um 16:50 hat Thomas Huth geschrieben: > >> The next patch is going to add some python-based tests to the "auto" > >> group, and these tests require virtio-blk to work properly. Running > >> iotests without virtio-blk likely does not make too much sense anyway, > >> so instead of adding a check for the availability of virtio-blk to each > >> and every test (which does not sound very appealing), let's rather add > >> a check for this at the top level in the check-block.sh script instead > >> (so that it is possible to run "make check" without the "check-block" > >> part for qemu-system-tricore for example). > >> > >> Signed-off-by: Thomas Huth > >> --- > >> tests/check-block.sh | 16 +++- > >> 1 file changed, 15 insertions(+), 1 deletion(-) > >> > >> diff --git a/tests/check-block.sh b/tests/check-block.sh > >> index 679aedec50..7582347ec2 100755 > >> --- a/tests/check-block.sh > >> +++ b/tests/check-block.sh > >> @@ -26,10 +26,24 @@ if grep -q "CFLAGS.*-fsanitize" config-host.mak > >> 2>/dev/null ; then > >> exit 0 > >> fi > >> > >> -if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then > >> +if [ -n "$QEMU_PROG" ]; then > >> +qemu_prog="$QEMU_PROG" > >> +else > >> +for binary in *-softmmu/qemu-system-* ; do > >> +if [ -x "$binary" ]; then > >> +qemu_prog="$binary" > >> +break > >> +fi > > > > Wouldn't it be better to check the availability of virtio-blk here, so > > that if the current binary doesn't support it, we keep searching and > > maybe pick up a different binary that supports it? > > That's a good idea, indeed, but then I also need to adjust the code in > the "check" script accordingly. I see. If this just copies the logic that qemu-iotests already uses, I think I would be okay with taking it as is for now. > > Or actually, should we work with a whitelist? > > I don't think that a hard-coded list will work well: Since we introduced > the Kconfig build system, it's now possible for example to also build an > qemu-system-aarch64 binary that does not contain any of the boards that > support virtio. So while virtio-blk is available by default in > qemu-system-aarch64, some builds might not contain it. Hm, good point. I'm just worried that the default config will end up running the tests on a machine type where it works, but if you use the wrong set of configure options, you end up with a setup where 'make check' fails because it uses a machine type that the iotests don't support. Kevin
Re: [PATCH 4/5] iotests: Skip "make check-block" if QEMU does not support virtio-blk
On 14/10/2019 13.21, Kevin Wolf wrote: > Am 11.10.2019 um 16:50 hat Thomas Huth geschrieben: >> The next patch is going to add some python-based tests to the "auto" >> group, and these tests require virtio-blk to work properly. Running >> iotests without virtio-blk likely does not make too much sense anyway, >> so instead of adding a check for the availability of virtio-blk to each >> and every test (which does not sound very appealing), let's rather add >> a check for this at the top level in the check-block.sh script instead >> (so that it is possible to run "make check" without the "check-block" >> part for qemu-system-tricore for example). >> >> Signed-off-by: Thomas Huth >> --- >> tests/check-block.sh | 16 +++- >> 1 file changed, 15 insertions(+), 1 deletion(-) >> >> diff --git a/tests/check-block.sh b/tests/check-block.sh >> index 679aedec50..7582347ec2 100755 >> --- a/tests/check-block.sh >> +++ b/tests/check-block.sh >> @@ -26,10 +26,24 @@ if grep -q "CFLAGS.*-fsanitize" config-host.mak >> 2>/dev/null ; then >> exit 0 >> fi >> >> -if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then >> +if [ -n "$QEMU_PROG" ]; then >> +qemu_prog="$QEMU_PROG" >> +else >> +for binary in *-softmmu/qemu-system-* ; do >> +if [ -x "$binary" ]; then >> +qemu_prog="$binary" >> +break >> +fi > > Wouldn't it be better to check the availability of virtio-blk here, so > that if the current binary doesn't support it, we keep searching and > maybe pick up a different binary that supports it? That's a good idea, indeed, but then I also need to adjust the code in the "check" script accordingly. > Or actually, should we work with a whitelist? I don't think that a hard-coded list will work well: Since we introduced the Kconfig build system, it's now possible for example to also build an qemu-system-aarch64 binary that does not contain any of the boards that support virtio. So while virtio-blk is available by default in qemu-system-aarch64, some builds might not contain it. Thomas
Re: [PATCH 4/5] iotests: Skip "make check-block" if QEMU does not support virtio-blk
Am 11.10.2019 um 16:50 hat Thomas Huth geschrieben: > The next patch is going to add some python-based tests to the "auto" > group, and these tests require virtio-blk to work properly. Running > iotests without virtio-blk likely does not make too much sense anyway, > so instead of adding a check for the availability of virtio-blk to each > and every test (which does not sound very appealing), let's rather add > a check for this at the top level in the check-block.sh script instead > (so that it is possible to run "make check" without the "check-block" > part for qemu-system-tricore for example). > > Signed-off-by: Thomas Huth > --- > tests/check-block.sh | 16 +++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/tests/check-block.sh b/tests/check-block.sh > index 679aedec50..7582347ec2 100755 > --- a/tests/check-block.sh > +++ b/tests/check-block.sh > @@ -26,10 +26,24 @@ if grep -q "CFLAGS.*-fsanitize" config-host.mak > 2>/dev/null ; then > exit 0 > fi > > -if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then > +if [ -n "$QEMU_PROG" ]; then > +qemu_prog="$QEMU_PROG" > +else > +for binary in *-softmmu/qemu-system-* ; do > +if [ -x "$binary" ]; then > +qemu_prog="$binary" > +break > +fi Wouldn't it be better to check the availability of virtio-blk here, so that if the current binary doesn't support it, we keep searching and maybe pick up a different binary that supports it? Or actually, should we work with a whitelist? We already need separate code for s390 and x86_64 in some places to choose between -pci and -ccw, and the presence of some virtio-blk doesn't mean that we know the specifics of how to add a virtio-blk device for this target. This suggests that blindly using a random binary might not be possible, but tests may have to be adapted before the target can be whitelisted. Kevin > +done > +fi > +if [ -z "$qemu_prog" ]; then > echo "No qemu-system binary available ==> Not running the qemu-iotests." > exit 0 > fi > +if ! "$qemu_prog" -M none -device help | grep virtio-blk >/dev/null 2>&1 ; > then > +echo "$qemu_prog does not support virtio-blk ==> Not running the > qemu-iotests." > +exit 0 > +fi > > if ! command -v bash >/dev/null 2>&1 ; then > echo "bash not available ==> Not running the qemu-iotests." > -- > 2.18.1 >
[PATCH 4/5] iotests: Skip "make check-block" if QEMU does not support virtio-blk
The next patch is going to add some python-based tests to the "auto" group, and these tests require virtio-blk to work properly. Running iotests without virtio-blk likely does not make too much sense anyway, so instead of adding a check for the availability of virtio-blk to each and every test (which does not sound very appealing), let's rather add a check for this at the top level in the check-block.sh script instead (so that it is possible to run "make check" without the "check-block" part for qemu-system-tricore for example). Signed-off-by: Thomas Huth --- tests/check-block.sh | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/check-block.sh b/tests/check-block.sh index 679aedec50..7582347ec2 100755 --- a/tests/check-block.sh +++ b/tests/check-block.sh @@ -26,10 +26,24 @@ if grep -q "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null ; then exit 0 fi -if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then +if [ -n "$QEMU_PROG" ]; then +qemu_prog="$QEMU_PROG" +else +for binary in *-softmmu/qemu-system-* ; do +if [ -x "$binary" ]; then +qemu_prog="$binary" +break +fi +done +fi +if [ -z "$qemu_prog" ]; then echo "No qemu-system binary available ==> Not running the qemu-iotests." exit 0 fi +if ! "$qemu_prog" -M none -device help | grep virtio-blk >/dev/null 2>&1 ; then +echo "$qemu_prog does not support virtio-blk ==> Not running the qemu-iotests." +exit 0 +fi if ! command -v bash >/dev/null 2>&1 ; then echo "bash not available ==> Not running the qemu-iotests." -- 2.18.1