summaryrefslogtreecommitdiffstats
path: root/auto-virtserial.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-08-25 19:10:55 +0530
committerAmit Shah <amit.shah@redhat.com>2010-08-26 09:43:10 +0530
commitc35234eef8dab01e74547ebfceb98f0e8b6ede64 (patch)
tree41a82f241c64b252a0bdbe375ca5131a9dddc16a /auto-virtserial.c
parenteb36ec2bfcdbb2d469873c4acc94aa7c3144c546 (diff)
downloadtest-virtserial-c35234eef8dab01e74547ebfceb98f0e8b6ede64.tar.gz
test-virtserial-c35234eef8dab01e74547ebfceb98f0e8b6ede64.tar.xz
test-virtserial-c35234eef8dab01e74547ebfceb98f0e8b6ede64.zip
auto-virtserial: Add a few sleep(2)s between host-guest commands
Give the guest to schedule in and react to input from the host before sending off results. Not doing this can result in some IO being missed and hence incorrect test results. Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'auto-virtserial.c')
-rw-r--r--auto-virtserial.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/auto-virtserial.c b/auto-virtserial.c
index f04a834..54c35a2 100644
--- a/auto-virtserial.c
+++ b/auto-virtserial.c
@@ -510,6 +510,9 @@ static int test_nonblocking_read(int nr)
/* Write out anything -- doesn't matter what it is */
write(chardevs[nr].sock, &gpkt, sizeof(gpkt));
+ /* Give the guest a chance to be scheduled in and react */
+ sleep(2);
+
ret = guest_read(nr, sizeof(gpkt));
err = result(__func__, true, "read", ret, sizeof(gpkt), 0, OP_EQ, true);
out:
@@ -588,13 +591,23 @@ static int test_poll(int nr)
if (err)
goto out;
+ /*
+ * Give the guest a chance to be scheduled in and give correct
+ * results for the previous test -- else it'll find the host
+ * chardev connected.
+ */
+ sleep(2);
host_connect_chardev(nr);
+ /* Give the guest a chance to be scheduled in and react */
+ sleep(2);
ret = guest_poll(nr, 0);
err = result(__func__, true, "POLLOUT", ret, POLLOUT, 0, OP_EQ, true);
if (err)
goto out_close;
write(chardevs[nr].sock, &ret, sizeof(ret));
+ /* Give the guest a chance to be scheduled in and react */
+ sleep(2);
ret = guest_poll(nr, 0);
err = result(__func__, true, "POLLIN",
ret, POLLIN|POLLOUT, 0, OP_EQ, true);
@@ -714,6 +727,7 @@ static int test_guest_caching(int nr)
error(errno, errno, "%s: write", __func__);
/* Make sure the data made its way to the port in the guest */
+ sleep(2);
ret = guest_poll(nr, 10000);
err = result(__func__, chardevs[nr].caching, "guest poll",
ret, POLLIN|POLLOUT, POLLIN|POLLOUT, OP_EQ, false);