From: Venky Shankar Date: Tue, 20 Apr 2021 09:00:28 +0000 (+0530) Subject: test: cleanup files/dirs before finishing test X-Git-Tag: v16.2.5~85^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=893bc13c8aee8ec4072915d770c2b2a3af5d8a46;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 (cherry picked from commit 3ad452118760c9e846ab081a013a0dba91119f75) --- diff --git a/src/test/libcephfs/test.cc b/src/test/libcephfs/test.cc index 1a1f81ced5d..f53e3c38357 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); }