]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.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>
Mon, 26 Apr 2021 13:14:27 +0000 (09:14 -0400)
Other tests might use the same file names and expect libcephfs
calls to succeed.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/test/libcephfs/test.cc

index ed4933db27a1bfe647de504aeaeaaa7e42d0ea8b..769670f967b186ec3a79e23336c81019ff54b784 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);
 }