summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell2017-06-05 11:09:14 +0200
committerPeter Maydell2017-06-05 11:09:14 +0200
commitcb8b8ef4578dc17c350fd4b27700a9f178e2dad0 (patch)
tree6bd382062ac77cc25bece492b78e15fec2a313e5 /tests
parentMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (diff)
parentchar: move char devices to chardev/ (diff)
downloadqemu-cb8b8ef4578dc17c350fd4b27700a9f178e2dad0.tar.gz
qemu-cb8b8ef4578dc17c350fd4b27700a9f178e2dad0.tar.xz
qemu-cb8b8ef4578dc17c350fd4b27700a9f178e2dad0.zip
Merge remote-tracking branch 'remotes/elmarco/tags/chrfe-pull-request' into staging
# gpg: Signature made Fri 02 Jun 2017 20:12:48 BST # gpg: using RSA key 0xDAE8E10975969CE5 # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * remotes/elmarco/tags/chrfe-pull-request: char: move char devices to chardev/ char: make chr_fe_deinit() optionaly delete backend char: rename functions that are not part of fe char: move CharBackend handling in char-fe unit char: generalize qemu_chr_write_all() be-hci: use backend functions chardev: serial & parallel declaration to own headers chardev: move headers to include/chardev Remove/replace sysemu/char.h inclusion char-win: close file handle except with console char-win: rename hcom->file char-win: rename win_chr_init/poll win_chr_serial_init/poll char-win: remove WinChardev.len char-win: simplify win_chr_read() char: cast ARRAY_SIZE() as signed to silent warning on empty array Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/postcopy-test.c2
-rw-r--r--tests/test-char.c24
-rw-r--r--tests/vhost-user-test.c6
3 files changed, 12 insertions, 20 deletions
diff --git a/tests/postcopy-test.c b/tests/postcopy-test.c
index e86f87656a..8142f2ab90 100644
--- a/tests/postcopy-test.c
+++ b/tests/postcopy-test.c
@@ -16,7 +16,7 @@
#include "qemu/option.h"
#include "qemu/range.h"
#include "qemu/sockets.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
#include "sysemu/sysemu.h"
#include "hw/nvram/chrp_nvram.h"
diff --git a/tests/test-char.c b/tests/test-char.c
index 124d0c5439..dfe856cb85 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -4,7 +4,7 @@
#include "qemu-common.h"
#include "qemu/config-file.h"
#include "qemu/sockets.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "sysemu/sysemu.h"
#include "qapi/error.h"
#include "qom/qom-qobject.h"
@@ -97,8 +97,7 @@ static void char_stdio_test_subprocess(void)
ret = qemu_chr_fe_write(&be, (void *)"buf", 4);
g_assert_cmpint(ret, ==, 4);
- qemu_chr_fe_deinit(&be);
- object_unparent(OBJECT(chr));
+ qemu_chr_fe_deinit(&be, true);
}
static void char_stdio_test(void)
@@ -146,8 +145,7 @@ static void char_ringbuf_test(void)
g_assert_cmpstr(data, ==, "");
g_free(data);
- qemu_chr_fe_deinit(&be);
- object_unparent(OBJECT(chr));
+ qemu_chr_fe_deinit(&be, true);
/* check alias */
opts = qemu_opts_create(qemu_find_opts("chardev"), "memory-label",
@@ -231,9 +229,8 @@ static void char_mux_test(void)
g_assert_cmpint(strlen(data), !=, 0);
g_free(data);
- qemu_chr_fe_deinit(&chr_be1);
- qemu_chr_fe_deinit(&chr_be2);
- object_unparent(OBJECT(chr));
+ qemu_chr_fe_deinit(&chr_be1, false);
+ qemu_chr_fe_deinit(&chr_be2, true);
}
typedef struct SocketIdleData {
@@ -396,8 +393,7 @@ static void char_pipe_test(void)
g_assert_cmpint(fe.read_count, ==, 8);
g_assert_cmpstr(fe.read_buf, ==, "pipe-in");
- qemu_chr_fe_deinit(&be);
- object_unparent(OBJECT(chr));
+ qemu_chr_fe_deinit(&be, true);
g_assert(g_unlink(in) == 0);
g_assert(g_unlink(out) == 0);
@@ -511,8 +507,7 @@ static void char_file_test(void)
g_assert_cmpint(fe.read_count, ==, 8);
g_assert_cmpstr(fe.read_buf, ==, "fifo-in");
- qemu_chr_fe_deinit(&be);
- object_unref(OBJECT(chr));
+ qemu_chr_fe_deinit(&be, true);
g_unlink(fifo);
g_free(fifo);
}
@@ -549,7 +544,7 @@ static void char_null_test(void)
error_free_or_abort(&err);
/* deinit & reinit */
- qemu_chr_fe_deinit(&be);
+ qemu_chr_fe_deinit(&be, false);
qemu_chr_fe_init(&be, chr, &error_abort);
qemu_chr_fe_set_open(&be, true);
@@ -563,8 +558,7 @@ static void char_null_test(void)
ret = qemu_chr_fe_write(&be, (void *)"buf", 4);
g_assert_cmpint(ret, ==, 4);
- qemu_chr_fe_deinit(&be);
- object_unparent(OBJECT(chr));
+ qemu_chr_fe_deinit(&be, true);
}
static void char_invalid_test(void)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 9095af267e..b3cc045765 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -16,7 +16,7 @@
#include "qemu/option.h"
#include "qemu/range.h"
#include "qemu/sockets.h"
-#include "sysemu/char.h"
+#include "chardev/char-fe.h"
#include "sysemu/sysemu.h"
#include "libqos/libqos.h"
#include "libqos/pci-pc.h"
@@ -488,10 +488,8 @@ static inline void test_server_connect(TestServer *server)
static gboolean _test_server_free(TestServer *server)
{
int i;
- Chardev *chr = qemu_chr_fe_get_driver(&server->chr);
- qemu_chr_fe_deinit(&server->chr);
- object_unparent(OBJECT(chr));
+ qemu_chr_fe_deinit(&server->chr, true);
for (i = 0; i < server->fds_num; i++) {
close(server->fds[i]);