summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2009-10-26 15:55:19 +0530
committerAmit Shah <amit.shah@redhat.com>2009-10-27 15:36:00 +0530
commit74ab3612c25320b60bab817b934441ae1d85b6e6 (patch)
tree90ef7dd2e03a3fdd167ef4a29483b3e52797cce8
parent25e9159f8ef2ec39ef96c45abd52cad61e139998 (diff)
downloadtest-virtserial-74ab3612c25320b60bab817b934441ae1d85b6e6.tar.gz
test-virtserial-74ab3612c25320b60bab817b934441ae1d85b6e6.tar.xz
test-virtserial-74ab3612c25320b60bab817b934441ae1d85b6e6.zip
auto-test: add test for opening of a port multiple times
Code should allow for having a port open only once in the guest. Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rw-r--r--auto-virtserial.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/auto-virtserial.c b/auto-virtserial.c
index 4c248d8..1776615 100644
--- a/auto-virtserial.c
+++ b/auto-virtserial.c
@@ -268,6 +268,29 @@ static int test_open(int nr)
return ret;
}
+static int test_multiple_open(int nr)
+{
+ int ret;
+
+ ret = guest_open_port(nr);
+ if (ret) {
+ fail(__func__, "open: single");
+ debug("%s: return: %d\n", __func__, ret);
+ return ret;
+ }
+ ret = guest_open_port(nr);
+ if (ret == -EMFILE) {
+ pass(__func__, "open: multiple");
+ } else {
+ fail(__func__, "open: multiple");
+ debug("%s: return: %d\n", __func__, ret);
+ }
+ ret = guest_close_port(nr);
+ if (ret)
+ debug("%s: close return: %d\n", __func__, ret);
+ return ret;
+}
+
static int test_close(int nr)
{
int ret;
@@ -924,6 +947,7 @@ static int start_tests(void)
test_open(2);
test_close(2);
+ test_multiple_open(2);
test_read_without_host(2);
test_blocking_read(2);