summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-09-16 16:02:50 +0530
committerAmit Shah <amit.shah@redhat.com>2010-09-16 16:04:55 +0530
commitf3963acf119801118d585df35e8d51c0cd384f54 (patch)
tree6e2af174173988e00fb62439cd9fbde9734da1f9
parent8d7a337d72579fbb4b28e361a890e5936673a52d (diff)
downloadtest-virtserial-f3963acf119801118d585df35e8d51c0cd384f54.tar.gz
test-virtserial-f3963acf119801118d585df35e8d51c0cd384f54.tar.xz
test-virtserial-f3963acf119801118d585df35e8d51c0cd384f54.zip
auto-test: poll() may have POLLIN set on host disconnect
When testing for POLLHUP, we can also get POLLIN set, which makes our error checks go wrong. Make sure we unset POLLIN from the return value and then check for POLLHUP. Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rw-r--r--auto-virtserial.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/auto-virtserial.c b/auto-virtserial.c
index 78c35bc..d11dd28 100644
--- a/auto-virtserial.c
+++ b/auto-virtserial.c
@@ -629,6 +629,7 @@ static int test_poll(int nr)
guest_open_port(nr);
ret = guest_poll(nr, 0, 0);
+ ret &= ~POLLIN;
err = result(__func__, true, "POLLHUP", ret, POLLHUP, 0, OP_EQ, true);
if (err)
goto out;
@@ -1295,6 +1296,7 @@ static int test_sigio_handler(int nr)
sleep(2);
ret = guest_get_sigio_poll_result(nr);
+ ret &= ~POLLIN;
err = result(__func__, true, "close",
ret, POLLHUP, POLLHUP, OP_EQ, true);
@@ -1330,12 +1332,15 @@ static int test_sigio_handler(int nr)
sleep(2);
ret = guest_get_sigio_poll_result(2);
+ ret &= ~POLLIN;
err = result(__func__, true, "multi-c2",
ret, POLLHUP, POLLHUP, OP_EQ, true);
ret = guest_get_sigio_poll_result(3);
+ ret &= ~POLLIN;
err = result(__func__, true, "multi-c3",
ret, POLLHUP, POLLHUP, OP_EQ, true);
ret = guest_get_sigio_poll_result(4);
+ ret &= ~POLLIN;
err = result(__func__, true, "multi-c4",
ret, POLLHUP, POLLHUP, OP_EQ, true);