Skip to content

Commit 9bb6fa7

Browse files
author
Tor Didriksen
committed
Fix valgrind errors in unit tests.
How to repeat: valgrind --leak-check=full <executable> --gtest_filter="-*DeathTest*" > foo
1 parent 145827c commit 9bb6fa7

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

unittest/gunit/dynarray-t.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -164,6 +164,11 @@ class DynArrayTest : public ::testing::Test
164164
m_keyuse_vec.reserve(num_elements);
165165
}
166166

167+
virtual void TearDown()
168+
{
169+
delete_dynamic(&m_keyuse_dyn);
170+
}
171+
167172
void insert_and_sort_dynamic()
168173
{
169174
reset_dynamic(&m_keyuse_dyn);

unittest/gunit/get_diagnostics-t.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,11 @@ TEST_F(GetDiagnosticsTest, Cmd)
145145

146146

147147
// Verifies death with a DBUG_ASSERT if target item is not settable.
148-
//
149-
// Although Google Test recommends DeathTest suffix for classes used
150-
// in death tests, this is not done to avoid the server being started
151-
// more than once.
148+
// Google Test recommends DeathTest suffix for classes used in death tests.
149+
typedef GetDiagnosticsTest GetDiagnosticsTestDeathTest;
150+
152151
#if GTEST_HAS_DEATH_TEST && !defined(DBUG_OFF)
153-
TEST_F(GetDiagnosticsTest, DieWhenUnsettableItem)
152+
TEST_F(GetDiagnosticsTestDeathTest, DieWhenUnsettableItem)
154153
{
155154
Item *var;
156155
Sql_cmd *cmd;

unittest/gunit/mdl-t.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,7 @@ TEST_F(MDLTest, HogLockTest5)
15761576
mdl_thread3.join();
15771577
mdl_thread4.join();
15781578
mdl_thread5.join();
1579+
mdl_thread6.join();
15791580

15801581
max_write_lock_count= org_max_write_lock_count;
15811582
}

0 commit comments

Comments
 (0)