]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test_cephfs.py: add tests for symlinkat()
authorRishabh Dave <ridave@redhat.com>
Wed, 5 Nov 2025 08:56:35 +0000 (14:26 +0530)
committerRishabh Dave <ridave@redhat.com>
Thu, 16 Apr 2026 12:40:07 +0000 (18:10 +0530)
Signed-off-by: Rishabh Dave <ridave@redhat.com>
src/test/pybind/test_cephfs.py

index 21d174cad8f19389acf85f8b9e99f418d6b1d533..b1bc9494a374655b88b8ac41419218ff72fc1b7a 100644 (file)
@@ -304,6 +304,27 @@ def test_symlink(testdir):
     cephfs.close(fd)
     cephfs.unlink(b'file-2')
 
+def test_symlinkat(testdir):
+    cephfs.mkdir(b'dir1', 0o755)
+
+    fd = cephfs.open(b'dir1/file1', 'w', 0o755)
+    cephfs.write(fd, b'abcd', 0)
+    cephfs.close(fd)
+
+    fd = cephfs.open('dir1', os.O_RDONLY | os.O_DIRECTORY, 0o755)
+    cephfs.symlinkat('file1', fd, 'slink1')
+    cephfs.close(fd)
+
+    fd = cephfs.open('dir1/slink1', 'r+', 0o755)
+    data = cephfs.read(fd, 0, 4)
+    assert_equal(data, b'abcd')
+
+    cephfs.write(fd, b'efgh', 4)
+    data = cephfs.read(fd, 0, 8)
+    assert_equal(data, b'abcdefgh')
+
+    cephfs.close(fd)
+
 def test_readlink(testdir):
     fd = cephfs.open(b'/file-1', 'w', 0o755)
     cephfs.write(fd, b"1111", 0)