summaryrefslogtreecommitdiff
path: root/tests/test-vconn.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-01-06 14:27:46 -0800
committerBen Pfaff <blp@nicira.com>2010-01-06 14:27:46 -0800
commit60cb3eb8b296e2aebbda6ccc161e99ad2bc7ca4a (patch)
tree295738314c8ac07a6908ec1b55e47063e1101c32 /tests/test-vconn.c
parent539e96f62300e4afab00e5906a28e3b89301d62e (diff)
downloadopenvswitch-60cb3eb8b296e2aebbda6ccc161e99ad2bc7ca4a.tar.gz
vconn: Convert vconn code to modern OVS structure.
The vconn code is a relative fossil as OVS code goes. It was written before we had really figured how code should fit together. Part of that history is that it used poll_fd_callback() to register callbacks without the assistance of other code. That isn't how the rest of OVS works now; this code is the only remaining user of that function. To make it more like the rest of the system, this code gets rid of the use of poll_fd_callback(). It also adds vconn_run() and vconn_run_wait() functions and calls to them from the places where they are now required.
Diffstat (limited to 'tests/test-vconn.c')
-rw-r--r--tests/test-vconn.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test-vconn.c b/tests/test-vconn.c
index 34c2930a4..87e35c4ae 100644
--- a/tests/test-vconn.c
+++ b/tests/test-vconn.c
@@ -143,6 +143,7 @@ test_refuse_connection(const char *type, int expected_error)
fpv_create(type, &fpv);
assert(!vconn_open(fpv.vconn_name, OFP_VERSION, &vconn));
fpv_close(&fpv);
+ vconn_run(vconn);
assert(vconn_connect(vconn) == expected_error);
vconn_close(vconn);
fpv_destroy(&fpv);
@@ -159,6 +160,7 @@ test_accept_then_close(const char *type, int expected_error)
fpv_create(type, &fpv);
assert(!vconn_open(fpv.vconn_name, OFP_VERSION, &vconn));
+ vconn_run(vconn);
close(fpv_accept(&fpv));
fpv_close(&fpv);
assert(vconn_connect(vconn) == expected_error);
@@ -178,6 +180,7 @@ test_read_hello(const char *type, int expected_error)
fpv_create(type, &fpv);
assert(!vconn_open(fpv.vconn_name, OFP_VERSION, &vconn));
+ vconn_run(vconn);
fd = fpv_accept(&fpv);
fpv_destroy(&fpv);
assert(!set_nonblocking(fd));
@@ -195,7 +198,9 @@ test_read_hello(const char *type, int expected_error)
assert(errno == EAGAIN);
}
+ vconn_run(vconn);
assert(vconn_connect(vconn) == EAGAIN);
+ vconn_run_wait(vconn);
vconn_connect_wait(vconn);
poll_fd_wait(fd, POLLIN);
poll_block();
@@ -221,6 +226,7 @@ test_send_hello(const char *type, const void *out, size_t out_size,
fpv_create(type, &fpv);
assert(!vconn_open(fpv.vconn_name, OFP_VERSION, &vconn));
+ vconn_run(vconn);
fd = fpv_accept(&fpv);
fpv_destroy(&fpv);
@@ -243,6 +249,7 @@ test_send_hello(const char *type, const void *out, size_t out_size,
}
}
+ vconn_run(vconn);
if (!connected) {
int error = vconn_connect(vconn);
if (error == expect_connect_error) {
@@ -262,6 +269,7 @@ test_send_hello(const char *type, const void *out, size_t out_size,
break;
}
+ vconn_run_wait(vconn);
if (!connected) {
vconn_connect_wait(vconn);
}