@@ -1137,7 +1137,7 @@ TEST(BlueFS, test_wal_migrate) {
11371137 gen_debugable (70000 , bl1);
11381138 fs.append_try_flush (writer, bl1.c_str (), bl1.length ());
11391139 fs.fsync (writer);
1140-
1140+ fs. close_writer (writer);
11411141 // WAL files don't update internal extents while writing to save memory, only on _replay
11421142 fs.umount ();
11431143 fs.mount ();
@@ -1435,6 +1435,7 @@ TEST(BlueFS, test_wal_read_after_rollback_to_v1) {
14351435 gen_debugable (70000 , bl1);
14361436 fs.append_try_flush (writer, bl1.c_str (), bl1.length ());
14371437 fs.fsync (writer);
1438+ fs.close_writer (writer);
14381439
14391440 g_ceph_context->_conf .set_val (" bluefs_wal_envelope_mode" , " false" );
14401441 fs.umount ();
@@ -1454,6 +1455,7 @@ TEST(BlueFS, test_wal_read_after_rollback_to_v1) {
14541455 ASSERT_EQ (0 , fs.open_for_write (dir_db, wal_file, &writer, false ));
14551456 ASSERT_NE (nullptr , writer);
14561457 ASSERT_EQ (writer->file ->fnode .encoding , bluefs_node_encoding::PLAIN);
1458+ fs.close_writer (writer);
14571459 }
14581460 fs.umount ();
14591461}
@@ -1671,6 +1673,7 @@ TEST(BlueFS, truncate_fsync) {
16711673 fs.fsync (h);
16721674 fs.close_writer (h);
16731675 }
1676+ fs.umount ();
16741677 }
16751678 {
16761679 // this was broken due to https://tracker.ceph.com/issues/55307
@@ -1703,7 +1706,7 @@ TEST(BlueFS, test_shared_alloc) {
17031706 size, shared_alloc_unit, " test shared allocator" ),
17041707 shared_alloc_unit);
17051708 shared_alloc.a ->init_add_free (0 , size);
1706-
1709+ auto sg = make_scope_guard ([&shared_alloc] { delete shared_alloc. a ; });
17071710 BlueFS fs (g_ceph_context);
17081711 // DB device is fully utilized
17091712 ASSERT_EQ (0 , fs.add_block_device (BlueFS::BDEV_DB, bdev_db.path , false ));
@@ -1787,6 +1790,7 @@ TEST(BlueFS, test_shared_alloc_sparse) {
17871790 for (uint64_t i = 5 * bluefs_alloc_unit; i < size; i += 2 * main_unit) {
17881791 shared_alloc.a ->init_add_free (i, main_unit);
17891792 }
1793+ auto sg = make_scope_guard ([&shared_alloc] { delete shared_alloc.a ; });
17901794
17911795 BlueFS fs (g_ceph_context);
17921796 ASSERT_EQ (0 , fs.add_block_device (BlueFS::BDEV_DB, bdev_slow.path , false ,
@@ -1863,6 +1867,7 @@ TEST(BlueFS, test_4k_shared_alloc) {
18631867 size, main_unit, " test shared allocator" ),
18641868 main_unit);
18651869 shared_alloc.a ->init_add_free (bluefs_alloc_unit, size - bluefs_alloc_unit);
1870+ auto sg = make_scope_guard ([&shared_alloc] { delete shared_alloc.a ; });
18661871
18671872 BlueFS fs (g_ceph_context);
18681873 ASSERT_EQ (0 , fs.add_block_device (BlueFS::BDEV_DB, bdev_slow.path , false ,
@@ -2125,6 +2130,7 @@ TEST(BlueFS, test_log_runway) {
21252130 utime_t mtime;
21262131 fs.stat (" dir" , " file" , &file_size, &mtime);
21272132 ASSERT_EQ (file_size, 9 );
2133+ fs.umount ();
21282134}
21292135
21302136TEST (BlueFS, test_log_runway_2) {
@@ -2182,6 +2188,7 @@ TEST(BlueFS, test_log_runway_2) {
21822188 std::vector<std::string> ls_longdir;
21832189 fs.readdir (longdir, &ls_longdir);
21842190 ASSERT_EQ (ls_longdir.front (), longfile);
2191+ fs.umount ();
21852192}
21862193
21872194TEST (BlueFS, test_log_runway_3) {
@@ -2242,6 +2249,7 @@ TEST(BlueFS, test_log_runway_3) {
22422249 fs.stat (longdir, longfile, &file_size, &mtime);
22432250 ASSERT_EQ (file_size, 6 );
22442251 }
2252+ fs.umount ();
22452253}
22462254
22472255TEST (BlueFS, test_log_runway_advance_seq) {
@@ -2266,6 +2274,7 @@ TEST(BlueFS, test_log_runway_advance_seq) {
22662274 std::string longdir (max_log_runway*2 , ' A' );
22672275 ASSERT_EQ (fs.mkdir (longdir), 0 );
22682276 fs.compact_log ();
2277+ fs.umount ();
22692278}
22702279
22712280TEST (BlueFS, test_69481_truncate_corrupts_log) {
0 commit comments