9ae3a8
From ab193a7368375c73e232f3b64d9c372c70bbf52c Mon Sep 17 00:00:00 2001
9ae3a8
Message-Id: <ab193a7368375c73e232f3b64d9c372c70bbf52c.1383564115.git.minovotn@redhat.com>
9ae3a8
In-Reply-To: <5575e0aec51f40ebec46e98ec085cda053283aba.1383564115.git.minovotn@redhat.com>
9ae3a8
References: <5575e0aec51f40ebec46e98ec085cda053283aba.1383564115.git.minovotn@redhat.com>
9ae3a8
From: Markus Armbruster <armbru@redhat.com>
9ae3a8
Date: Fri, 27 Sep 2013 13:31:18 +0200
9ae3a8
Subject: [PATCH 08/14] libqtest: New qtest_end() to go with qtest_start()
9ae3a8
MIME-Version: 1.0
9ae3a8
Content-Type: text/plain; charset=UTF-8
9ae3a8
Content-Transfer-Encoding: 8bit
9ae3a8
9ae3a8
RH-Author: Markus Armbruster <armbru@redhat.com>
9ae3a8
Message-id: <1380288680-26645-9-git-send-email-armbru@redhat.com>
9ae3a8
Patchwork-id: 54566
9ae3a8
O-Subject: [PATCH 7.0 qemu-kvm 08/10] libqtest: New qtest_end() to go with qtest_start()
9ae3a8
Bugzilla: 997817
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
9ae3a8
9ae3a8
From: Markus Armbruster <armbru@redhat.com>
9ae3a8
9ae3a8
Signed-off-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
Reviewed-by: Andreas Färber <afaerber@suse.de>
9ae3a8
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
9ae3a8
Message-id: 1371711329-9144-3-git-send-email-armbru@redhat.com
9ae3a8
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9ae3a8
(cherry picked from commit 1d9358e686125c125b52529fa68baf36aa2d0d09)
9ae3a8
---
9ae3a8
 tests/fdc-test.c    |  2 +-
9ae3a8
 tests/hd-geo-test.c |  8 ++++----
9ae3a8
 tests/ide-test.c    |  2 +-
9ae3a8
 tests/libqtest.h    | 12 ++++++++++++
9ae3a8
 4 files changed, 18 insertions(+), 6 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Michal Novotny <minovotn@redhat.com>
9ae3a8
---
9ae3a8
 tests/fdc-test.c    |  2 +-
9ae3a8
 tests/hd-geo-test.c |  8 ++++----
9ae3a8
 tests/ide-test.c    |  2 +-
9ae3a8
 tests/libqtest.h    | 12 ++++++++++++
9ae3a8
 4 files changed, 18 insertions(+), 6 deletions(-)
9ae3a8
9ae3a8
diff --git a/tests/fdc-test.c b/tests/fdc-test.c
9ae3a8
index 4b0301d..fd198dc 100644
9ae3a8
--- a/tests/fdc-test.c
9ae3a8
+++ b/tests/fdc-test.c
9ae3a8
@@ -556,7 +556,7 @@ int main(int argc, char **argv)
9ae3a8
     ret = g_test_run();
9ae3a8
 
9ae3a8
     /* Cleanup */
9ae3a8
-    qtest_quit(global_qtest);
9ae3a8
+    qtest_end();
9ae3a8
     unlink(test_image);
9ae3a8
 
9ae3a8
     return ret;
9ae3a8
diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c
9ae3a8
index 9a31e85..b72042e 100644
9ae3a8
--- a/tests/hd-geo-test.c
9ae3a8
+++ b/tests/hd-geo-test.c
9ae3a8
@@ -244,7 +244,7 @@ static void test_ide_none(void)
9ae3a8
     setup_common(argv, ARRAY_SIZE(argv));
9ae3a8
     qtest_start(g_strjoinv(" ", argv));
9ae3a8
     test_cmos();
9ae3a8
-    qtest_quit(global_qtest);
9ae3a8
+    qtest_end();
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void test_ide_mbr(bool use_device, MBRcontents mbr)
9ae3a8
@@ -262,7 +262,7 @@ static void test_ide_mbr(bool use_device, MBRcontents mbr)
9ae3a8
     }
9ae3a8
     qtest_start(g_strjoinv(" ", argv));
9ae3a8
     test_cmos();
9ae3a8
-    qtest_quit(global_qtest);
9ae3a8
+    qtest_end();
9ae3a8
 }
9ae3a8
 
9ae3a8
 /*
9ae3a8
@@ -334,7 +334,7 @@ static void test_ide_drive_user(const char *dev, bool trans)
9ae3a8
     g_free(opts);
9ae3a8
     qtest_start(g_strjoinv(" ", argv));
9ae3a8
     test_cmos();
9ae3a8
-    qtest_quit(global_qtest);
9ae3a8
+    qtest_end();
9ae3a8
 }
9ae3a8
 
9ae3a8
 /*
9ae3a8
@@ -387,7 +387,7 @@ static void test_ide_drive_cd_0(void)
9ae3a8
     }
9ae3a8
     qtest_start(g_strjoinv(" ", argv));
9ae3a8
     test_cmos();
9ae3a8
-    qtest_quit(global_qtest);
9ae3a8
+    qtest_end();
9ae3a8
 }
9ae3a8
 
9ae3a8
 int main(int argc, char **argv)
9ae3a8
diff --git a/tests/ide-test.c b/tests/ide-test.c
9ae3a8
index 365e995..177ab00 100644
9ae3a8
--- a/tests/ide-test.c
9ae3a8
+++ b/tests/ide-test.c
9ae3a8
@@ -120,7 +120,7 @@ static void ide_test_start(const char *cmdline_fmt, ...)
9ae3a8
 
9ae3a8
 static void ide_test_quit(void)
9ae3a8
 {
9ae3a8
-    qtest_quit(global_qtest);
9ae3a8
+    qtest_end();
9ae3a8
 }
9ae3a8
 
9ae3a8
 static QPCIDevice *get_pci_device(uint16_t *bmdma_base)
9ae3a8
diff --git a/tests/libqtest.h b/tests/libqtest.h
9ae3a8
index 437bda3..0f6aade 100644
9ae3a8
--- a/tests/libqtest.h
9ae3a8
+++ b/tests/libqtest.h
9ae3a8
@@ -17,6 +17,7 @@
9ae3a8
 #ifndef LIBQTEST_H
9ae3a8
 #define LIBQTEST_H
9ae3a8
 
9ae3a8
+#include <stddef.h>
9ae3a8
 #include <stdint.h>
9ae3a8
 #include <stdbool.h>
9ae3a8
 #include <stdarg.h>
9ae3a8
@@ -319,6 +320,17 @@ static inline QTestState *qtest_start(const char *args)
9ae3a8
 }
9ae3a8
 
9ae3a8
 /**
9ae3a8
+ * qtest_end:
9ae3a8
+ *
9ae3a8
+ * Shut down the QEMU process started by qtest_start().
9ae3a8
+ */
9ae3a8
+static inline void qtest_end(void)
9ae3a8
+{
9ae3a8
+    qtest_quit(global_qtest);
9ae3a8
+    global_qtest = NULL;
9ae3a8
+}
9ae3a8
+
9ae3a8
+/**
9ae3a8
  * qmp:
9ae3a8
  * @fmt...: QMP message to send to qemu
9ae3a8
  *
9ae3a8
-- 
9ae3a8
1.7.11.7
9ae3a8