aboutsummaryrefslogtreecommitdiff
path: root/tests/ahci-test.c
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2015-02-05 12:41:28 -0500
committerStefan Hajnoczi <stefanha@redhat.com>2015-02-16 15:07:17 +0000
commit259342d34dbdfb304374f569feec26317edd97c9 (patch)
tree38487465cbf6252fe1ee0b8214471184d932c78d /tests/ahci-test.c
parentae029620173239f3643925299790ecc5e1d72db1 (diff)
libqos/ahci: Add ahci_clean_mem
Clean up guest memory being used in ahci_clean_mem, to be called during ahci_shutdown. With all guest memory leaks removed, add an option to the allocator to throw an assertion if a leak occurs. This test adds some sanity to both the AHCI library and the allocator. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423158090-25580-18-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/ahci-test.c')
-rw-r--r--tests/ahci-test.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index 47491fe96c..3a0131aa66 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -86,6 +86,7 @@ static AHCIQState *ahci_boot(void)
"-device ide-hd,drive=drive0 "
"-global ide-hd.ver=%s";
s->parent = qtest_pc_boot(cli, tmp_path, "testdisk", "version");
+ alloc_set_flags(s->parent->alloc, ALLOC_LEAK_ASSERT);
/* Verify that we have an AHCI device present. */
s->dev = get_ahci_device(&s->fingerprint);
@@ -99,6 +100,8 @@ static AHCIQState *ahci_boot(void)
static void ahci_shutdown(AHCIQState *ahci)
{
QOSState *qs = ahci->parent;
+
+ ahci_clean_mem(ahci);
free_ahci_device(ahci->dev);
g_free(ahci);
qtest_shutdown(qs);