]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: do read checks with non-empty file 61675/head
authorPatrick Donnelly <pdonnell@ibm.com>
Thu, 6 Feb 2025 15:02:53 +0000 (10:02 -0500)
committerPatrick Donnelly <pdonnell@ibm.com>
Thu, 6 Feb 2025 17:56:24 +0000 (12:56 -0500)
Linux will optimize out reads to a file known to be empty.

Fixes: https://tracker.ceph.com/issues/53859
Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
qa/tasks/cephfs/test_pool_perm.py

index b55052b826e8ce66a4cfd7f84481df95bd268ca2..d923d5ee3b69e6616943da4bb1f204e303a30f1f 100644 (file)
@@ -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