Commit a6862418 authored by Andrey Shinkevich's avatar Andrey Shinkevich Committed by Kevin Wolf
Browse files

iotests: Set read-zeroes on in null block driver for Valgrind



The Valgrind tool reports about the uninitialised buffer 'buf'
instantiated on the stack of the function guess_disk_lchs().
Pass 'read-zeroes=on' to the null block driver to make it deterministic.
The output of the tests 051, 186 and 227 now includes the parameter
'read-zeroes'. So, the benchmark output files are being changed too.

Suggested-by: default avatarKevin Wolf <kwolf@redhat.com>
Signed-off-by: default avatarAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 0274f45b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -251,11 +251,11 @@ echo
# Cannot use the test image because cache=none might not work on the host FS
# Use cdrom so that we won't get errors about missing media

run_qemu -drive driver=null-co,cache=none
run_qemu -drive driver=null-co,cache=directsync
run_qemu -drive driver=null-co,cache=writeback
run_qemu -drive driver=null-co,cache=writethrough
run_qemu -drive driver=null-co,cache=unsafe
run_qemu -drive driver=null-co,read-zeroes=on,cache=none
run_qemu -drive driver=null-co,read-zeroes=on,cache=directsync
run_qemu -drive driver=null-co,read-zeroes=on,cache=writeback
run_qemu -drive driver=null-co,read-zeroes=on,cache=writethrough
run_qemu -drive driver=null-co,read-zeroes=on,cache=unsafe
run_qemu -drive driver=null-co,cache=invalid_value

# Can't test direct=on here because O_DIRECT might not be supported on this FS
+5 −5
Original line number Diff line number Diff line
@@ -245,23 +245,23 @@ QEMU X.Y.Z monitor - type 'help' for more information

=== Cache modes ===

Testing: -drive driver=null-co,cache=none
Testing: -drive driver=null-co,read-zeroes=on,cache=none
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) quit

Testing: -drive driver=null-co,cache=directsync
Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) quit

Testing: -drive driver=null-co,cache=writeback
Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) quit

Testing: -drive driver=null-co,cache=writethrough
Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) quit

Testing: -drive driver=null-co,cache=unsafe
Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
QEMU X.Y.Z monitor - type 'help' for more information
(qemu) quit

+5 −4
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ class ThrottleTestCase(iotests.QMPTestCase):
    def setUp(self):
        self.vm = iotests.VM()
        for i in range(0, self.max_drives):
            self.vm.add_drive(self.test_img)
            self.vm.add_drive(self.test_img, "file.read-zeroes=on")
        self.vm.launch()

    def tearDown(self):
@@ -273,7 +273,8 @@ class ThrottleTestGroupNames(iotests.QMPTestCase):
    def setUp(self):
        self.vm = iotests.VM()
        for i in range(0, self.max_drives):
            self.vm.add_drive(self.test_img, "throttling.iops-total=100")
            self.vm.add_drive(self.test_img,
                              "throttling.iops-total=100,file.read-zeroes=on")
        self.vm.launch()

    def tearDown(self):
@@ -378,10 +379,10 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase):
    def test_removable_media(self):
        # Add a couple of dummy nodes named cd0 and cd1
        result = self.vm.qmp("blockdev-add", driver="null-aio",
                             node_name="cd0")
                             read_zeroes=True, node_name="cd0")
        self.assert_qmp(result, 'return', {})
        result = self.vm.qmp("blockdev-add", driver="null-aio",
                             node_name="cd1")
                             read_zeroes=True, node_name="cd1")
        self.assert_qmp(result, 'return', {})

        # Attach a CD drive with cd0 inserted
+1 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ sector = "%d"
                          (self.account_invalid and "on" or "off"))
        drive_args.append("stats-account-failed=%s" %
                          (self.account_failed and "on" or "off"))
        drive_args.append("file.image.read-zeroes=on")
        self.create_blkdebug_file()
        self.vm = iotests.VM().add_drive('blkdebug:%s:%s' %
                                         (blkdebug_file, self.test_img),
+10 −10
Original line number Diff line number Diff line
@@ -86,8 +86,8 @@ echo "=== -blockdev/-device=<node-name> ==="
echo

for dev in $fixed $removable; do
    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null
    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null
    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
done

echo
@@ -97,7 +97,7 @@ echo
# This creates two BlockBackends that will show up in 'info block'!
# A monitor-owned one from -drive, and anonymous one from -device
for dev in $fixed $removable; do
    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
done

echo
@@ -105,8 +105,8 @@ echo "=== -drive if=none/-device=<bb-name> (with medium) ==="
echo

for dev in $fixed $removable; do
    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0
    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0,id=qdev_id
    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0
    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0,id=qdev_id
done

echo
@@ -125,15 +125,15 @@ echo "=== -drive if=... ==="
echo

check_info_block -drive if=floppy
check_info_block -drive if=floppy,driver=null-co
check_info_block -drive if=floppy,driver=null-co,read-zeroes=on

check_info_block -drive if=ide,driver=null-co
check_info_block -drive if=ide,driver=null-co,read-zeroes=on
check_info_block -drive if=ide,media=cdrom
check_info_block -drive if=ide,driver=null-co,media=cdrom
check_info_block -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom

check_info_block -drive if=virtio,driver=null-co
check_info_block -drive if=virtio,driver=null-co,read-zeroes=on

check_info_block -drive if=pflash,driver=null-co,size=1M
check_info_block -drive if=pflash,driver=null-co,read-zeroes=on,size=1M

# success, all done
echo "*** done"
Loading