Stefan Hajnoczi <stefa...@redhat.com> 于2022年6月28日周二 16:20写道: > > On Mon, Jun 27, 2022 at 08:19:17AM +0800, Sam Li wrote: > > diff --git a/tests/qemu-iotests/tests/zoned.sh > > b/tests/qemu-iotests/tests/zoned.sh > > new file mode 100755 > > index 0000000000..262c0b5427 > > --- /dev/null > > +++ b/tests/qemu-iotests/tests/zoned.sh > > @@ -0,0 +1,49 @@ > > +#!/usr/bin/env bash > > +# > > +# Test zone management operations. > > +# > > + > > +QEMU_IO="build/qemu-io" > > +IMG="--image-opts driver=zoned_host_device,filename=/dev/nullb0" > > +QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT > > + > > +echo "Testing a null_blk device" > > +echo "Simple cases: if the operations work" > > +sudo modprobe null_blk nr_devices=1 zoned=1 > > Please use bash's "trap" command to remove null_blk on exit. That way > cleanup happens whether the script exits successfully or not. See > tests/qemu-iotests/108 for an example.
Noted. Should I just include "rmmod null_blk" in _cleanup()? I'm a little confused about the normal way to write qemu-iotests. > > > +# success, all done > > +sudo rmmod null_blk > > +echo "*** done" > > +#rm -f $seq.full > > Why is this commented out? I should just remove it. seq is not used.