]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: add test_statx for new statx()
authorhuanwen ren <ren.huanwen@zte.com.cn>
Thu, 26 Sep 2019 13:00:38 +0000 (21:00 +0800)
committerRamana Raja <rraja@redhat.com>
Mon, 16 Mar 2020 09:48:58 +0000 (15:18 +0530)
Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
(cherry picked from commit ea8527b5e8a9695050275a6715ebce2798579de2)

src/test/pybind/test_cephfs.py

index 992d066ee094553a4f41029d0084b6ef5c3b4542..505d2a021f4c695bfa39b6704747728e43418510 100644 (file)
@@ -54,6 +54,23 @@ def test_statfs():
     stat = cephfs.statfs(b'/')
     assert(len(stat) == 11)
 
+@with_setup(setup_test)
+def test_statx():
+    stat = cephfs.statx(b'/', libcephfs.CEPH_STATX_MODE, 0)
+    assert('mode' in stat.keys())
+    stat = cephfs.statx(b'/', libcephfs.CEPH_STATX_BTIME, 0)
+    assert('btime' in stat.keys())
+    
+    fd = cephfs.open(b'file-1', 'w', 0o755)
+    cephfs.write(fd, b"1111", 0)
+    cephfs.close(fd)
+    cephfs.symlink(b'file-1', b'file-2')
+    stat = cephfs.statx(b'file-2', libcephfs.CEPH_STATX_MODE | libcephfs.CEPH_STATX_BTIME, libcephfs.AT_SYMLINK_NOFOLLOW)
+    assert('mode' in stat.keys())
+    assert('btime' in stat.keys())
+    cephfs.unlink(b'file-2')
+    cephfs.unlink(b'file-1')
+
 @with_setup(setup_test)
 def test_syncfs():
     stat = cephfs.sync_fs()