Check oio_err in connection_fail test.

* Renamed test_connection_fail to connection_fail following the conventions.
 * Mapped Windows error ERROR_CONNECTION_REFUSED to OIO_ECONNREFUSED.
 * Asserting that the oio_err in connection_fail is OIO_ECONNREFUSED.
This commit is contained in:
Alan Gutierrez 2011-04-21 17:24:50 +08:00 committed by Bert Belder
parent 5bcbc31920
commit 9468c6570a
3 changed files with 5 additions and 4 deletions

View File

@ -230,6 +230,7 @@ static oio_err_code oio_translate_sys_error(int sys_errno) {
case WSAEINVAL: return OIO_EINVAL;
case WSAEALREADY: return OIO_EALREADY;
case ERROR_OUTOFMEMORY: return OIO_ENOMEM;
case ERROR_CONNECTION_REFUSED: return OIO_ECONNREFUSED;
default: return OIO_UNKNOWN;
}
}

View File

@ -40,13 +40,13 @@ static void on_close(oio_handle* handle, int status) {
static void on_connect(oio_req *req, int status) {
ASSERT(status == -1);
ASSERT(oio_last_error().code == OIO_ECONNREFUSED);
connect_cb_calls++;
oio_close(req->handle);
}
TEST_IMPL(test_connection_fail) {
TEST_IMPL(connection_fail) {
struct sockaddr_in client_addr, server_addr;
int r;

View File

@ -24,7 +24,7 @@ TEST_DECLARE (close_cb_stack)
TEST_DECLARE (timeout)
TEST_DECLARE (fail_always)
TEST_DECLARE (pass_always)
TEST_DECLARE (test_connection_fail)
TEST_DECLARE (connection_fail)
HELPER_DECLARE (echo_server)
TASK_LIST_START
@ -39,5 +39,5 @@ TASK_LIST_START
TEST_ENTRY (fail_always)
TEST_ENTRY (pass_always)
TEST_ENTRY (test_connection_fail)
TEST_ENTRY (connection_fail)
TASK_LIST_END