[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 08/10] iotests.py: add verify_o_direct helper
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v5 08/10] iotests.py: add verify_o_direct helper |
Date: |
Fri, 21 Aug 2020 17:11:21 +0300 |
Add python notrun-helper similar to _check_o_direct for bash tests.
To be used in the following commit.
Suggested-by: Nir Soffer <nsoffer@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
tests/qemu-iotests/iotests.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 717b5b652c..7f1aa187a9 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -29,6 +29,7 @@ import struct
import subprocess
import sys
import time
+import errno
from typing import (Any, Callable, Dict, Iterable,
List, Optional, Sequence, Tuple, TypeVar)
import unittest
@@ -1083,6 +1084,17 @@ def _verify_aio_mode(supported_aio_modes: Sequence[str]
= ()) -> None:
if supported_aio_modes and (aiomode not in supported_aio_modes):
notrun('not suitable for this aio mode: %s' % aiomode)
+def verify_o_direct() -> None:
+ with FilePath('test_o_direct') as f:
+ try:
+ fd = os.open(f, os.O_DIRECT | os.O_CREAT | os.O_RDWR)
+ except OSError as e:
+ if e.errno != errno.EINVAL:
+ raise
+ notrun(f'file system at {test_dir} does not support O_DIRECT')
+ else:
+ os.close(fd)
+
def supports_quorum():
return 'quorum' in qemu_img_pipe('--help')
--
2.21.3
- Re: [PATCH v5 07/10] block: introduce preallocate filter, (continued)
- Re: [PATCH v5 07/10] block: introduce preallocate filter, Vladimir Sementsov-Ogievskiy, 2020/08/24
- Re: [PATCH v5 07/10] block: introduce preallocate filter, Max Reitz, 2020/08/25
- Re: [PATCH v5 07/10] block: introduce preallocate filter, Vladimir Sementsov-Ogievskiy, 2020/08/26
- Re: [PATCH v5 07/10] block: introduce preallocate filter, Max Reitz, 2020/08/26
- Re: [PATCH v5 07/10] block: introduce preallocate filter, Vladimir Sementsov-Ogievskiy, 2020/08/26
- Re: [PATCH v5 07/10] block: introduce preallocate filter, Max Reitz, 2020/08/26
- Re: [PATCH v5 07/10] block: introduce preallocate filter, Vladimir Sementsov-Ogievskiy, 2020/08/26
- Re: [PATCH v5 07/10] block: introduce preallocate filter, David Edmondson, 2020/08/26
- Re: [PATCH v5 07/10] block: introduce preallocate filter, Vladimir Sementsov-Ogievskiy, 2020/08/27
[PATCH v5 08/10] iotests.py: add verify_o_direct helper,
Vladimir Sementsov-Ogievskiy <=
[PATCH v5 09/10] iotests.py: add filter_img_check, Vladimir Sementsov-Ogievskiy, 2020/08/21
[PATCH v5 10/10] iotests: add 298 to test new preallocate filter driver, Vladimir Sementsov-Ogievskiy, 2020/08/21
Re: [PATCH v5 00/10] preallocate filter, Vladimir Sementsov-Ogievskiy, 2020/08/27