aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-06-12 19:26:49 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-06-12 19:26:49 +0100
commit9bba618f18b1a60a3f2668db82b453f6cd9467c0 (patch)
tree25f0ecb76346ccbe6331c8e38fd74a8b1f30be6f /tests
parent5093f028ce6529034efc8fdc06cec2aa2e2eea63 (diff)
parent27d4c3789ddde40e1c7280150b46eb20a6a892e6 (diff)
Merge remote-tracking branch 'remotes/elmarco/tags/char-pull-request' into staging
# gpg: Signature made Thu 08 Jun 2017 15:12:11 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/char-pull-request: test-char: start a /char/serial test chardev: don't use alias names in parse_compat() char: fix alias devices regression Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-char.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test-char.c b/tests/test-char.c
index dfe856cb85..9e361c8d09 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -450,6 +450,32 @@ static void char_udp_test(void)
g_free(tmp);
}
+#ifdef HAVE_CHARDEV_SERIAL
+static void char_serial_test(void)
+{
+ QemuOpts *opts;
+ Chardev *chr;
+
+ opts = qemu_opts_create(qemu_find_opts("chardev"), "serial-id",
+ 1, &error_abort);
+ qemu_opt_set(opts, "backend", "serial", &error_abort);
+ qemu_opt_set(opts, "path", "/dev/null", &error_abort);
+
+ chr = qemu_chr_new_from_opts(opts, NULL);
+ g_assert_nonnull(chr);
+ /* TODO: add more tests with a pty */
+ object_unparent(OBJECT(chr));
+
+ /* test tty alias */
+ qemu_opt_set(opts, "backend", "tty", &error_abort);
+ chr = qemu_chr_new_from_opts(opts, NULL);
+ g_assert_nonnull(chr);
+ object_unparent(OBJECT(chr));
+
+ qemu_opts_del(opts);
+}
+#endif
+
static void char_file_test(void)
{
char *tmp_path = g_dir_make_tmp("qemu-test-char.XXXXXX", NULL);
@@ -597,6 +623,9 @@ int main(int argc, char **argv)
g_test_add_func("/char/file", char_file_test);
g_test_add_func("/char/socket", char_socket_test);
g_test_add_func("/char/udp", char_udp_test);
+#ifdef HAVE_CHARDEV_SERIAL
+ g_test_add_func("/char/serial", char_serial_test);
+#endif
return g_test_run();
}