[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 21/21] tests: add /char/console test
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v3 21/21] tests: add /char/console test |
Date: |
Thu, 16 Mar 2017 13:21:21 +0400 |
Signed-off-by: Marc-André Lureau <address@hidden>
---
tests/test-char.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/tests/test-char.c b/tests/test-char.c
index 19707bfcda..773a1c36ba 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
--
2.12.0.191.gc5d8de91d
- [Qemu-devel] [PATCH v3 12/21] char-socket: update local address after listen, (continued)
- [Qemu-devel] [PATCH v3 12/21] char-socket: update local address after listen, Marc-André Lureau, 2017/03/16
- [Qemu-devel] [PATCH v3 11/21] char-socket: introduce update_disconnected_filename(), Marc-André Lureau, 2017/03/16
- [Qemu-devel] [PATCH v3 13/21] char-socket: add 'addr' property, Marc-André Lureau, 2017/03/16
- [Qemu-devel] [PATCH v3 14/21] char-socket: add 'connected' property, Marc-André Lureau, 2017/03/16
- [Qemu-devel] [PATCH v3 15/21] char-udp: flush as much buffer as possible, Marc-André Lureau, 2017/03/16
- [Qemu-devel] [PATCH v3 16/21] tests: add alias check in /char/ringbuf, Marc-André Lureau, 2017/03/16
- [Qemu-devel] [PATCH v3 17/21] tests: add /char/pipe test, Marc-André Lureau, 2017/03/16
- [Qemu-devel] [PATCH v3 18/21] tests: add /char/file test, Marc-André Lureau, 2017/03/16
- [Qemu-devel] [PATCH v3 19/21] tests: add /char/socket test, Marc-André Lureau, 2017/03/16
- [Qemu-devel] [PATCH v3 20/21] tests: add /char/udp test, Marc-André Lureau, 2017/03/16
- [Qemu-devel] [PATCH v3 21/21] tests: add /char/console test,
Marc-André Lureau <=