Skip to content

Commit

Permalink
libqtest: New qtest_end() to go with qtest_start()
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1371711329-9144-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information
Markus Armbruster authored and Anthony Liguori committed Jul 18, 2013
1 parent fdd26fc commit 1d9358e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/fdc-test.c
Expand Up @@ -556,7 +556,7 @@ int main(int argc, char **argv)
ret = g_test_run();

/* Cleanup */
qtest_quit(global_qtest);
qtest_end();
unlink(test_image);

return ret;
Expand Down
8 changes: 4 additions & 4 deletions tests/hd-geo-test.c
Expand Up @@ -244,7 +244,7 @@ static void test_ide_none(void)
setup_common(argv, ARRAY_SIZE(argv));
qtest_start(g_strjoinv(" ", argv));
test_cmos();
qtest_quit(global_qtest);
qtest_end();
}

static void test_ide_mbr(bool use_device, MBRcontents mbr)
Expand All @@ -262,7 +262,7 @@ static void test_ide_mbr(bool use_device, MBRcontents mbr)
}
qtest_start(g_strjoinv(" ", argv));
test_cmos();
qtest_quit(global_qtest);
qtest_end();
}

/*
Expand Down Expand Up @@ -334,7 +334,7 @@ static void test_ide_drive_user(const char *dev, bool trans)
g_free(opts);
qtest_start(g_strjoinv(" ", argv));
test_cmos();
qtest_quit(global_qtest);
qtest_end();
}

/*
Expand Down Expand Up @@ -387,7 +387,7 @@ static void test_ide_drive_cd_0(void)
}
qtest_start(g_strjoinv(" ", argv));
test_cmos();
qtest_quit(global_qtest);
qtest_end();
}

int main(int argc, char **argv)
Expand Down
2 changes: 1 addition & 1 deletion tests/ide-test.c
Expand Up @@ -122,7 +122,7 @@ static void ide_test_start(const char *cmdline_fmt, ...)

static void ide_test_quit(void)
{
qtest_quit(global_qtest);
qtest_end();
}

static QPCIDevice *get_pci_device(uint16_t *bmdma_base)
Expand Down
12 changes: 12 additions & 0 deletions tests/libqtest.h
Expand Up @@ -17,6 +17,7 @@
#ifndef LIBQTEST_H
#define LIBQTEST_H

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
Expand Down Expand Up @@ -318,6 +319,17 @@ static inline QTestState *qtest_start(const char *args)
return global_qtest;
}

/**
* qtest_end:
*
* Shut down the QEMU process started by qtest_start().
*/
static inline void qtest_end(void)
{
qtest_quit(global_qtest);
global_qtest = NULL;
}

/**
* qmp:
* @fmt...: QMP message to send to qemu
Expand Down

0 comments on commit 1d9358e

Please sign in to comment.