From: Patrick Donnelly Date: Thu, 6 Feb 2025 15:02:53 +0000 (-0500) Subject: qa: do read checks with non-empty file X-Git-Tag: v20.0.0~163^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e3ed3b302c5165ed29a569073b82f92e8d09efdc;p=ceph.git qa: do read checks with non-empty file Linux will optimize out reads to a file known to be empty. Fixes: https://tracker.ceph.com/issues/53859 Signed-off-by: Patrick Donnelly --- diff --git a/qa/tasks/cephfs/test_pool_perm.py b/qa/tasks/cephfs/test_pool_perm.py index b55052b826e8..d923d5ee3b69 100644 --- a/qa/tasks/cephfs/test_pool_perm.py +++ b/qa/tasks/cephfs/test_pool_perm.py @@ -6,7 +6,7 @@ import os class TestPoolPerm(CephFSTestCase): def test_pool_perm(self): - self.mount_a.run_shell(["touch", "test_file"]) + self.mount_a.run_shell_payload("dd if=/dev/urandom of=test_file bs=4k count=1") file_path = os.path.join(self.mount_a.mountpoint, "test_file") @@ -14,12 +14,12 @@ class TestPoolPerm(CephFSTestCase): import os import errno - fd = os.open("{path}", os.O_RDWR) + fd = os.open("{path}", os.O_RDWR | os.O_SYNC) try: if {check_read}: ret = os.read(fd, 1024) else: - os.write(fd, b'content') + os.pwrite(fd, b'content', 0) except OSError as e: if e.errno != errno.EPERM: raise