From: Venky Shankar Date: Tue, 20 Apr 2021 09:00:28 +0000 (+0530) Subject: test: cleanup files/dirs before finishing test X-Git-Tag: v17.1.0~2137^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3ad452118760c9e846ab081a013a0dba91119f75;p=ceph.git test: cleanup files/dirs before finishing test Other tests might use the same file names and expect libcephfs calls to succeed. Signed-off-by: Venky Shankar --- diff --git a/src/test/libcephfs/test.cc b/src/test/libcephfs/test.cc index ed4933db27a1..769670f967b1 100644 --- a/src/test/libcephfs/test.cc +++ b/src/test/libcephfs/test.cc @@ -77,8 +77,12 @@ TEST(LibCephFS, OpenEmptyComponent) { fd = ceph_open(cmount, c_path, O_RDONLY, 0666); ASSERT_LT(0, fd); - ASSERT_EQ(0, ceph_close(cmount, fd)); + + // cleanup + ASSERT_EQ(0, ceph_unlink(cmount, c_path)); + ASSERT_EQ(0, ceph_rmdir(cmount, c_dir)); + ceph_shutdown(cmount); } @@ -480,6 +484,13 @@ TEST(LibCephFS, DirLs) { ASSERT_EQ(ceph_closedir(cmount, ls_dir), 0); + // cleanup + for(i = 0; i < r; ++i) { + sprintf(bazstr, "%s/dirf%d", foostr, i); + ASSERT_EQ(0, ceph_unlink(cmount, bazstr)); + } + ASSERT_EQ(0, ceph_rmdir(cmount, foostr)); + ceph_shutdown(cmount); }