aboutsummaryrefslogtreecommitdiff
path: root/tests/test-char.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-01-03 19:55:55 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-05-04 15:34:42 +0400
commit79c8db5a13c0f4b73f930be0fcff9bbc1237c258 (patch)
tree96850e1cce9ef0bd70409554a3d50cdbfe986201 /tests/test-char.c
parentbb1490486df2ea60c57a1d72c6a779ab1652b429 (diff)
downloadqemu-79c8db5a13c0f4b73f930be0fcff9bbc1237c258.zip
qemu-79c8db5a13c0f4b73f930be0fcff9bbc1237c258.tar.gz
qemu-79c8db5a13c0f4b73f930be0fcff9bbc1237c258.tar.bz2
tests: add /char/console test
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'tests/test-char.c')
-rw-r--r--tests/test-char.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/test-char.c b/tests/test-char.c
index 19707bf..773a1c3 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -57,6 +57,32 @@ static void fe_event(void *opaque, int event)
}
#ifdef CONFIG_HAS_GLIB_SUBPROCESS_TESTS
+#ifdef _WIN32
+static void char_console_test_subprocess(void)
+{
+ QemuOpts *opts;
+ Chardev *chr;
+
+ opts = qemu_opts_create(qemu_find_opts("chardev"), "console-label",
+ 1, &error_abort);
+ qemu_opt_set(opts, "backend", "console", &error_abort);
+
+ chr = qemu_chr_new_from_opts(opts, NULL);
+ g_assert_nonnull(chr);
+
+ qemu_chr_write_all(chr, (const uint8_t *)"CONSOLE", 7);
+
+ qemu_opts_del(opts);
+ object_unparent(OBJECT(chr));
+}
+
+static void char_console_test(void)
+{
+ g_test_trap_subprocess("/char/console/subprocess", 0, 0);
+ g_test_trap_assert_passed();
+ g_test_trap_assert_stdout("CONSOLE");
+}
+#endif
static void char_stdio_test_subprocess(void)
{
Chardev *chr;
@@ -83,7 +109,6 @@ static void char_stdio_test(void)
}
#endif
-
static void char_ringbuf_test(void)
{
QemuOpts *opts;
@@ -566,6 +591,10 @@ int main(int argc, char **argv)
g_test_add_func("/char/ringbuf", char_ringbuf_test);
g_test_add_func("/char/mux", char_mux_test);
#ifdef CONFIG_HAS_GLIB_SUBPROCESS_TESTS
+#ifdef _WIN32
+ g_test_add_func("/char/console/subprocess", char_console_test_subprocess);
+ g_test_add_func("/char/console", char_console_test);
+#endif
g_test_add_func("/char/stdio/subprocess", char_stdio_test_subprocess);
g_test_add_func("/char/stdio", char_stdio_test);
#endif