summaryrefslogtreecommitdiffstats
path: root/auto-virtserial.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2009-11-04 18:15:50 +0530
committerAmit Shah <amit.shah@redhat.com>2009-11-04 18:18:24 +0530
commit51cf586256115a5bedaa0e937105da12fb0b7680 (patch)
treeff3b399b90c5e07e956a882e29c35692ddb413ec /auto-virtserial.c
parent14e4a3838013c550319367ccfb3d0476581cd2c3 (diff)
downloadtest-virtserial-51cf586256115a5bedaa0e937105da12fb0b7680.tar.gz
test-virtserial-51cf586256115a5bedaa0e937105da12fb0b7680.tar.xz
test-virtserial-51cf586256115a5bedaa0e937105da12fb0b7680.zip
auto-test: guest caching: make sure data reaches guest port before announcing result
In many cases the data got sent after the port was inspected for any cached data that was available in the cache disabled case. We can't rely on the sequence of the events; they can get rearranged so let's close the port only after we know the data reached the guest. Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'auto-virtserial.c')
-rw-r--r--auto-virtserial.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/auto-virtserial.c b/auto-virtserial.c
index 534947f..90bdb04 100644
--- a/auto-virtserial.c
+++ b/auto-virtserial.c
@@ -627,9 +627,16 @@ static int test_guest_caching(int nr)
if (ret == -1)
error(errno, errno, "%s: write", __func__);
+ /* Make sure the data made its way to the port in the guest */
+ ret = guest_poll(nr, 10000);
+ err = result(__func__, chardevs[nr].caching, "guest poll",
+ ret, POLLIN|POLLOUT, POLLIN|POLLOUT, OP_EQ, false);
+
guest_close_port(nr);
host_close_chardev(nr);
free(buf);
+ if (err < 0)
+ return err;
guest_open_port(nr);
ret = guest_read(nr, BUF_LENGTH);