diff options
author | Amit Shah <amit.shah@redhat.com> | 2009-10-24 13:34:28 +0530 |
---|---|---|
committer | Amit Shah <amit.shah@redhat.com> | 2009-10-24 14:27:06 +0530 |
commit | 943b2c74dd2eb1e7aea42738108003978bfb6cf8 (patch) | |
tree | ed4f8aae43b3e3b43243c3ed01d9bb04255aed41 /auto-virtserial-guest.c | |
parent | 3a8ba6c2c7b6ba0b193bf76b19cc218fc75da9ab (diff) | |
download | test-virtserial-943b2c74dd2eb1e7aea42738108003978bfb6cf8.tar.gz test-virtserial-943b2c74dd2eb1e7aea42738108003978bfb6cf8.tar.xz test-virtserial-943b2c74dd2eb1e7aea42738108003978bfb6cf8.zip |
auto-test: add virtio-console tests
This commit adds test for virtio-console functionality on new qemu and
guest kernel. Functionality for older qemu and older kernel will come
in the following commits.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'auto-virtserial-guest.c')
-rw-r--r-- | auto-virtserial-guest.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/auto-virtserial-guest.c b/auto-virtserial-guest.c index a5c0f57..db1814e 100644 --- a/auto-virtserial-guest.c +++ b/auto-virtserial-guest.c @@ -140,6 +140,23 @@ static int set_port_nonblocking(int val) return 0; } +static int spawn_console(int val) +{ + /* Currently only works on hvc0 */ + int ret; + + ret = vfork(); + if (!ret) { + /* Child */ + char *argv[] = { "/sbin/agetty", "/dev/hvc0", "9600", "vt100" }; + char *envp[] = { NULL }; + + ret = execve("/sbin/agetty", argv, envp); + error(errno, errno, "execve"); + } + return 0; +} + static void send_report(int cfd, int ret) { struct guest_packet gpkt; @@ -155,6 +172,15 @@ int main(int argc, char *argv[]) struct pollfd pollfd[1]; int ret, cfd; + /* + * Just spawn a console on the default console port - + * /dev/hvc0. This helps in the case of running on new + * kernel-old qemu combination or old kernel-new qemu + * combination so that the console port test can be run and + * the other tests will just fail. + */ + spawn_console(0); + ret = access(CONTROL_PORT, R_OK|W_OK); if (ret == -1) error(errno, errno, "No control port found %s", CONTROL_PORT); |