]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: cleanup files/dirs before finishing test
authorVenky Shankar <vshankar@redhat.com>
Tue, 20 Apr 2021 09:00:28 +0000 (14:30 +0530)
committerVenky Shankar <vshankar@redhat.com>
Thu, 27 May 2021 13:35:21 +0000 (09:35 -0400)
Other tests might use the same file names and expect libcephfs
calls to succeed.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit 3ad452118760c9e846ab081a013a0dba91119f75)

src/test/libcephfs/test.cc

index 1a1f81ced5d7c035afe13dc3d0b88c4a56fe1f95..f53e3c383572e6a74b34df773b757e8845c0dea0 100644 (file)
@@ -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);
 }