]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: cleanup test memory leaks
authorLoic Dachary <ldachary@redhat.com>
Tue, 18 Apr 2017 07:33:41 +0000 (09:33 +0200)
committerLoic Dachary <ldachary@redhat.com>
Tue, 18 Apr 2017 07:39:38 +0000 (09:39 +0200)
Signed-off-by: Loic Dachary <loic@dachary.org>
src/test/crush/CrushWrapper.cc

index aa3ed040b7a87e8a8a461dc139b3d9048f66606a..1d73fea5f16d0bfdcc921851f1039632cd69ecda 100644 (file)
@@ -477,6 +477,8 @@ TEST(CrushWrapper, adjust_item_weight) {
   EXPECT_EQ(1, c->adjust_item_weightf_in_loc(g_ceph_context, item, modified_weight, loc_two));
   EXPECT_EQ(original_weight, c->get_item_weightf_in_loc(item, loc_one));
   EXPECT_EQ(modified_weight, c->get_item_weightf_in_loc(item, loc_two));
+
+  delete c;
 }
 
 TEST(CrushWrapper, adjust_subtree_weight) {
@@ -570,6 +572,8 @@ TEST(CrushWrapper, adjust_subtree_weight) {
   ASSERT_EQ(c->get_bucket_weight(host0), 262144);
   ASSERT_EQ(c->get_item_weight(host0), 262144);
   ASSERT_EQ(c->get_bucket_weight(rootno), 262144 + 131072);
+
+  delete c;
 }
 
 TEST(CrushWrapper, insert_item) {
@@ -748,6 +752,8 @@ TEST(CrushWrapper, remove_item) {
   ASSERT_EQ(0, c->remove_item(g_ceph_context, item_to_remove, true));
   float weight;
   EXPECT_FALSE(c->check_item_loc(g_ceph_context, item_to_remove, loc, &weight));
+
+  delete c;
 }
 
 TEST(CrushWrapper, item_bucket_names) {
@@ -1314,5 +1320,5 @@ int main(int argc, char **argv) {
   return RUN_ALL_TESTS();
 }
 // Local Variables:
-// compile-command: "cd ../../../build ; make -j4 unittest_crush_wrapper && bin/unittest_crush_wrapper"
+// compile-command: "cd ../../../build ; make -j4 unittest_crush_wrapper && valgrind --tool=memcheck bin/unittest_crush_wrapper"
 // End: