[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/14] tests/test-hmp: Use qtest_init() instead of qt
From: |
Thomas Huth |
Subject: |
[Qemu-devel] [PULL 05/14] tests/test-hmp: Use qtest_init() instead of qtest_start() |
Date: |
Thu, 9 May 2019 10:19:21 +0200 |
qtest_start() + qtest_end() should be avoided, since they use the
global_qtest variable that we want to get rid of in the long run
Use qtest_init() and qtest_quit() instead.
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Thomas Huth <address@hidden>
---
tests/test-hmp.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/tests/test-hmp.c b/tests/test-hmp.c
index e344947f7c..5029c4d2c9 100644
--- a/tests/test-hmp.c
+++ b/tests/test-hmp.c
@@ -73,13 +73,13 @@ static const char *hmp_cmds[] = {
};
/* Run through the list of pre-defined commands */
-static void test_commands(void)
+static void test_commands(QTestState *qts)
{
char *response;
int i;
for (i = 0; hmp_cmds[i] != NULL; i++) {
- response = hmp("%s", hmp_cmds[i]);
+ response = qtest_hmp(qts, "%s", hmp_cmds[i]);
if (verbose) {
fprintf(stderr,
"\texecute HMP command: %s\n"
@@ -92,11 +92,11 @@ static void test_commands(void)
}
/* Run through all info commands and call them blindly (without arguments) */
-static void test_info_commands(void)
+static void test_info_commands(QTestState *qts)
{
char *resp, *info, *info_buf, *endp;
- info_buf = info = hmp("help info");
+ info_buf = info = qtest_hmp(qts, "help info");
while (*info) {
/* Extract the info command, ignore parameters and description */
@@ -108,7 +108,7 @@ static void test_info_commands(void)
if (verbose) {
fprintf(stderr, "\t%s\n", info);
}
- resp = hmp("%s", info);
+ resp = qtest_hmp(qts, "%s", info);
g_free(resp);
/* And move forward to the next line */
info = strchr(endp + 1, '\n');
@@ -125,14 +125,15 @@ static void test_machine(gconstpointer data)
{
const char *machine = data;
char *args;
+ QTestState *qts;
args = g_strdup_printf("-S -M %s", machine);
- qtest_start(args);
+ qts = qtest_init(args);
- test_info_commands();
- test_commands();
+ test_info_commands(qts);
+ test_commands(qts);
- qtest_end();
+ qtest_quit(qts);
g_free(args);
g_free((void *)data);
}
--
2.21.0
- [Qemu-devel] [PULL 00/14] qtests, copyright statement clarifications and misc patches, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 01/14] tests: Force Python I/O encoding for check-qapi-schema, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 02/14] tests/tco: Make test independent of global_qtest, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 03/14] tests/megasas: Make test independent of global_qtest, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 04/14] tests/qmp-cmd-test: Use qtest_init() instead of qtest_start(), Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 05/14] tests/test-hmp: Use qtest_init() instead of qtest_start(),
Thomas Huth <=
- [Qemu-devel] [PULL 07/14] tests/tpm-tests: Use g_test_skip() to mark skipped tests, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 08/14] tests/Makefile: Remove unused test-obj-y variable, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 06/14] tests/ide-test: Make test independent of global_qtest, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 09/14] tests/drive_del-test: Use qtest_init() instead of qtest_start(), Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 10/14] tests: qpci_unplug_acpi_device_test() should not rely on global_qtest, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 13/14] target/sh4: Fix LGPL information in the file headers, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 11/14] hw/i2c/smbus_ich9: Fix the confusing contributions-after-2012 statement, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 12/14] target/openrisc: Fix LGPL information in the file headers, Thomas Huth, 2019/05/09
- [Qemu-devel] [PULL 14/14] include/exec/poison: Mark TARGET_FMT_lu as poisoned, too, Thomas Huth, 2019/05/09
- Re: [Qemu-devel] [PULL 00/14] qtests, copyright statement clarifications and misc patches, Peter Maydell, 2019/05/09