[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/26] tests/libqtest: Introduce qtest_init_with_seri
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 13/26] tests/libqtest: Introduce qtest_init_with_serial() |
Date: |
Mon, 28 Jan 2019 18:10:34 +0000 |
From: Julia Suvorova <address@hidden>
Run qtest with a socket that connects QEMU chardev and test code.
Signed-off-by: Julia Suvorova <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
tests/libqtest.h | 11 +++++++++++
tests/libqtest.c | 25 +++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/tests/libqtest.h b/tests/libqtest.h
index 7ea94139b0c..5937f919123 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -62,6 +62,17 @@ QTestState *qtest_init(const char *extra_args);
*/
QTestState *qtest_init_without_qmp_handshake(const char *extra_args);
+/**
+ * qtest_init_with_serial:
+ * @extra_args: other arguments to pass to QEMU. CAUTION: these
+ * arguments are subject to word splitting and shell evaluation.
+ * @sock_fd: pointer to store the socket file descriptor for
+ * connection with serial.
+ *
+ * Returns: #QTestState instance.
+ */
+QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd);
+
/**
* qtest_quit:
* @s: #QTestState instance to operate on.
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 55750dd68de..6fb30855faf 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -315,6 +315,31 @@ QTestState *qtest_initf(const char *fmt, ...)
return s;
}
+QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd)
+{
+ int sock_fd_init;
+ char *sock_path, sock_dir[] = "/tmp/qtest-serial-XXXXXX";
+ QTestState *qts;
+
+ g_assert_true(mkdtemp(sock_dir) != NULL);
+ sock_path = g_strdup_printf("%s/sock", sock_dir);
+
+ sock_fd_init = init_socket(sock_path);
+
+ qts = qtest_initf("-chardev socket,id=s0,path=%s -serial chardev:s0 %s",
+ sock_path, extra_args);
+
+ *sock_fd = socket_accept(sock_fd_init);
+
+ unlink(sock_path);
+ g_free(sock_path);
+ rmdir(sock_dir);
+
+ g_assert_true(*sock_fd >= 0);
+
+ return qts;
+}
+
void qtest_quit(QTestState *s)
{
g_hook_destroy_link(&abrt_hooks, g_hook_find_data(&abrt_hooks, TRUE, s));
--
2.20.1
- [Qemu-devel] [PULL 05/26] tests/microbit-test: add TWI stub device test, (continued)
- [Qemu-devel] [PULL 05/26] tests/microbit-test: add TWI stub device test, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 07/26] accel/tcg/user-exec: Don't parse aarch64 insns to test for read vs write, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 09/26] target/arm: Don't clear supported PMU events when initializing PMCEID1, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 10/26] memory: add memory_region_flush_rom_device(), Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 06/26] exec.c: Use correct attrs in cpu_memory_rw_debug(), Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 04/26] arm: Stub out NRF51 TWI magnetometer/accelerometer detection, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 12/26] arm: Instantiate NRF51 special NVM's and NVMC, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 11/26] hw/nvram/nrf51_nvm: Add nRF51 non-volatile memories, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 15/26] tests/microbit-test: Check nRF51 UART functionality, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 17/26] xlnx-zynqmp: Don't create rpu-cluster if there are no RPUs, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 13/26] tests/libqtest: Introduce qtest_init_with_serial(),
Peter Maydell <=
- [Qemu-devel] [PULL 18/26] aspeed/smc: fix default read value, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 21/26] aspeed/smc: snoop SPI transfers to fake dummy cycles, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 20/26] aspeed/smc: Add dummy data register, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 19/26] aspeed/smc: define registers for all possible CS, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 16/26] checkpatch: Don't emit spurious warnings about block comments, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 14/26] tests/microbit-test: Make test independent of global_qtest, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 26/26] gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 25/26] accel/tcg: Add cluster number to TCG TB hash, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 22/26] tests/microbit-test: Add tests for nRF51 NVMC, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 23/26] hw/arm/xlnx-zynqmp: Realize cluster after putting RPUs in it, Peter Maydell, 2019/01/28