diff options
author | Amit Shah <amit.shah@redhat.com> | 2010-09-13 17:48:22 +0530 |
---|---|---|
committer | Amit Shah <amit.shah@redhat.com> | 2010-09-13 17:48:22 +0530 |
commit | 39e607714b15d4fdd89637aab9bf4a60204fefa5 (patch) | |
tree | c5d88766cf6bea3e35c88280505b71b8b1d63a5a | |
parent | 5c468270518dac6fd083f7527ae3a9992d154f0f (diff) | |
download | test-virtserial-39e607714b15d4fdd89637aab9bf4a60204fefa5.tar.gz test-virtserial-39e607714b15d4fdd89637aab9bf4a60204fefa5.tar.xz test-virtserial-39e607714b15d4fdd89637aab9bf4a60204fefa5.zip |
auto-test: Shut down a guest after all tests are done.
Currently we forcibly kill qemu from the run_test.sh script once each
test is done. Instead, give a chance to the guest to shut itself down
by sending a 'shutdown' command.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rw-r--r-- | auto-virtserial-guest.c | 3 | ||||
-rw-r--r-- | auto-virtserial.c | 13 | ||||
-rw-r--r-- | virtserial.h | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/auto-virtserial-guest.c b/auto-virtserial-guest.c index 10daeb5..85d5758 100644 --- a/auto-virtserial-guest.c +++ b/auto-virtserial-guest.c @@ -713,6 +713,9 @@ back_to_open: ret = get_sigio_result(gpkt.value); send_report(cfd, ret); break; + case KEY_SHUTDOWN: + system("shutdown -h now"); + break; default: send_report(cfd, -ERANGE); break; diff --git a/auto-virtserial.c b/auto-virtserial.c index cb3f419..f7c106c 100644 --- a/auto-virtserial.c +++ b/auto-virtserial.c @@ -286,6 +286,15 @@ static int guest_get_sigio_poll_result(int nr) return guest_cmd(&gpkt); } +static void guest_shutdown(void) +{ + struct guest_packet gpkt; + + gpkt.key = KEY_SHUTDOWN; + guest_cmd_only(&gpkt); + return; +} + static void show_stats(void) { fprintf(stderr, "-----\n"); @@ -1672,6 +1681,10 @@ next: /* Now we're all set to start our tests. */ start_tests(); + + /* Send guest a command to shut itself down. */ + guest_shutdown(); + show_stats(); host_close_chardev(1); diff --git a/virtserial.h b/virtserial.h index 4617414..45c06ad 100644 --- a/virtserial.h +++ b/virtserial.h @@ -20,6 +20,7 @@ #define KEY_JOIN_READ_THREAD 20 #define KEY_GET_SIGIO_RESULT 21 #define KEY_POLL_EVENTS 22 +#define KEY_SHUTDOWN 23 #define HOST_BIG_FILE "/tmp/amit/host-big-file" #define GUEST_BIG_FILE "/tmp/amit/guest-big-file" |