diff mbox series

[v4,6/7] iotests: Test driver whitelisting in 136

Message ID 20190917092004.999-7-mreitz@redhat.com
State New
Headers show
Series iotests: Selfish patches | expand

Commit Message

Max Reitz Sept. 17, 2019, 9:20 a.m. UTC
null-aio may not be whitelisted.  Skip all test cases that require it.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/136 | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Andrey Shinkevich Sept. 17, 2019, 3:14 p.m. UTC | #1
On 17/09/2019 12:20, Max Reitz wrote:
> null-aio may not be whitelisted.  Skip all test cases that require it.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>   tests/qemu-iotests/136 | 14 ++++++++++----
>   1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136
> index a46a7b7630..012ea111ac 100755
> --- a/tests/qemu-iotests/136
> +++ b/tests/qemu-iotests/136
> @@ -30,7 +30,7 @@ bad_offset = bad_sector * 512
>   blkdebug_file = os.path.join(iotests.test_dir, 'blkdebug.conf')
>   
>   class BlockDeviceStatsTestCase(iotests.QMPTestCase):
> -    test_img = "null-aio://"
> +    test_driver = "null-aio"
>       total_rd_bytes = 0
>       total_rd_ops = 0
>       total_wr_bytes = 0
> @@ -67,6 +67,10 @@ sector = "%d"
>   ''' % (bad_sector, bad_sector))
>           file.close()
>   
> +    def required_drivers(self):
> +        return [self.test_driver]
> +
> +    @iotests.skip_if_unsupported(required_drivers)
>       def setUp(self):
>           drive_args = []
>           drive_args.append("stats-intervals.0=%d" % interval_length)
> @@ -76,8 +80,8 @@ sector = "%d"
>                             (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),
> +        self.vm = iotests.VM().add_drive('blkdebug:%s:%s://' %
> +                                         (blkdebug_file, self.test_driver),
>                                            ','.join(drive_args))
>           self.vm.launch()
>           # Set an initial value for the clock
> @@ -337,7 +341,9 @@ class BlockDeviceStatsTestAccountBoth(BlockDeviceStatsTestCase):
>       account_failed = True
>   
>   class BlockDeviceStatsTestCoroutine(BlockDeviceStatsTestCase):
> -    test_img = "null-co://"
> +    test_driver = "null-co"
>   
>   if __name__ == '__main__':
> +    if 'null-co' not in iotests.supported_formats():
> +        iotests.notrun('null-co driver support missing')
>       iotests.main(supported_fmts=["raw"])
> 

Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
John Snow Sept. 18, 2019, 6:39 p.m. UTC | #2
On 9/17/19 5:20 AM, Max Reitz wrote:
> null-aio may not be whitelisted.  Skip all test cases that require it.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>

Reviewed-by: John Snow <jsnow@redhat.com>

> ---
>   tests/qemu-iotests/136 | 14 ++++++++++----
>   1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136
> index a46a7b7630..012ea111ac 100755
> --- a/tests/qemu-iotests/136
> +++ b/tests/qemu-iotests/136
> @@ -30,7 +30,7 @@ bad_offset = bad_sector * 512
>   blkdebug_file = os.path.join(iotests.test_dir, 'blkdebug.conf')
>   
>   class BlockDeviceStatsTestCase(iotests.QMPTestCase):
> -    test_img = "null-aio://"
> +    test_driver = "null-aio"
>       total_rd_bytes = 0
>       total_rd_ops = 0
>       total_wr_bytes = 0
> @@ -67,6 +67,10 @@ sector = "%d"
>   ''' % (bad_sector, bad_sector))
>           file.close()
>   
> +    def required_drivers(self):
> +        return [self.test_driver]
> +
> +    @iotests.skip_if_unsupported(required_drivers)
>       def setUp(self):
>           drive_args = []
>           drive_args.append("stats-intervals.0=%d" % interval_length)
> @@ -76,8 +80,8 @@ sector = "%d"
>                             (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),
> +        self.vm = iotests.VM().add_drive('blkdebug:%s:%s://' %
> +                                         (blkdebug_file, self.test_driver),
>                                            ','.join(drive_args))
>           self.vm.launch()
>           # Set an initial value for the clock
> @@ -337,7 +341,9 @@ class BlockDeviceStatsTestAccountBoth(BlockDeviceStatsTestCase):
>       account_failed = True
>   
>   class BlockDeviceStatsTestCoroutine(BlockDeviceStatsTestCase):
> -    test_img = "null-co://"
> +    test_driver = "null-co"
>   
>   if __name__ == '__main__':
> +    if 'null-co' not in iotests.supported_formats():
> +        iotests.notrun('null-co driver support missing')
>       iotests.main(supported_fmts=["raw"])
>
diff mbox series

Patch

diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136
index a46a7b7630..012ea111ac 100755
--- a/tests/qemu-iotests/136
+++ b/tests/qemu-iotests/136
@@ -30,7 +30,7 @@  bad_offset = bad_sector * 512
 blkdebug_file = os.path.join(iotests.test_dir, 'blkdebug.conf')
 
 class BlockDeviceStatsTestCase(iotests.QMPTestCase):
-    test_img = "null-aio://"
+    test_driver = "null-aio"
     total_rd_bytes = 0
     total_rd_ops = 0
     total_wr_bytes = 0
@@ -67,6 +67,10 @@  sector = "%d"
 ''' % (bad_sector, bad_sector))
         file.close()
 
+    def required_drivers(self):
+        return [self.test_driver]
+
+    @iotests.skip_if_unsupported(required_drivers)
     def setUp(self):
         drive_args = []
         drive_args.append("stats-intervals.0=%d" % interval_length)
@@ -76,8 +80,8 @@  sector = "%d"
                           (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),
+        self.vm = iotests.VM().add_drive('blkdebug:%s:%s://' %
+                                         (blkdebug_file, self.test_driver),
                                          ','.join(drive_args))
         self.vm.launch()
         # Set an initial value for the clock
@@ -337,7 +341,9 @@  class BlockDeviceStatsTestAccountBoth(BlockDeviceStatsTestCase):
     account_failed = True
 
 class BlockDeviceStatsTestCoroutine(BlockDeviceStatsTestCase):
-    test_img = "null-co://"
+    test_driver = "null-co"
 
 if __name__ == '__main__':
+    if 'null-co' not in iotests.supported_formats():
+        iotests.notrun('null-co driver support missing')
     iotests.main(supported_fmts=["raw"])