#include "xmlrpcpp/XmlRpcUtil.h"
#include "xmlrpcpp/XmlRpcSocket.h"
#include "test_system_mocks.h"
#include <arpa/inet.h>
#include <fcntl.h>
#include <errno.h>
#include <limits.h>
#include <netdb.h>
#include <stdarg.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <deque>
#include <gtest/gtest.h>
Go to the source code of this file.
Classes | |
struct | expected_read |
struct | expected_write |
class | XmlRpcConnectTest |
class | XmlRpcSocketTest |
Macros | |
#define | FOR_ERRNO(itr, var, ...) |
#define | TEST_READ(RES, ERR) |
#define | TEST_WRITE(RES, ERR) |
Functions | |
void | EXPECT_SOCKADDR_EQ (const sockaddr *addr1, const sockaddr *addr2) |
int | main (int argc, char **argv) |
ssize_t | mock_read (int fd, void *buf, size_t count) |
ssize_t | mock_write (int fd, const void *buf, size_t count) |
bool | operator== (const in6_addr a, const in6_addr b) |
int | test_accept (int sockfd, struct sockaddr *addr, socklen_t *addrlen) |
int | test_bind (int sockfd, const struct sockaddr *addr, socklen_t addrlen) |
int | test_close (int fd) |
int | test_connect (int sockfd, const struct sockaddr *addr, socklen_t addrlen) |
TEST_F (XmlRpcConnectTest, connect_failure) | |
TEST_F (XmlRpcConnectTest, connect_ipv4) | |
TEST_F (XmlRpcConnectTest, connect_ipv6) | |
TEST_F (XmlRpcConnectTest, connect_lookup_fail) | |
TEST_F (XmlRpcConnectTest, connect_multiple_result) | |
TEST_F (XmlRpcSocketTest, accept) | |
TEST_F (XmlRpcSocketTest, bind) | |
TEST_F (XmlRpcSocketTest, close) | |
TEST_F (XmlRpcSocketTest, get_port) | |
TEST_F (XmlRpcSocketTest, listen) | |
TEST_F (XmlRpcSocketTest, nbRead) | |
TEST_F (XmlRpcSocketTest, nbRead_EINTR) | |
TEST_F (XmlRpcSocketTest, nbWrite) | |
TEST_F (XmlRpcSocketTest, setNonBlocking) | |
TEST_F (XmlRpcSocketTest, setReuseAddr) | |
TEST_F (XmlRpcSocketTest, socket) | |
TEST_F (XmlRpcSocketTest, TestMocks) | |
int | test_fcntl (int fd, int cmd, unsigned long arg) |
void | test_freeaddrinfo (struct addrinfo *res) |
int | test_getaddrinfo (const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) |
int | test_getsockname (int sockfd, struct sockaddr *addr, socklen_t *addrlen) |
int | test_listen (int sockfd, int backlog) |
TEST_READ (FALSE, EACCES) | |
TEST_READ (FALSE, EBADF) | |
TEST_READ (FALSE, ECONNREFUSED) | |
TEST_READ (FALSE, EFAULT) | |
TEST_READ (FALSE, EINVAL) | |
TEST_READ (FALSE, EIO) | |
TEST_READ (FALSE, EISDIR) | |
TEST_READ (FALSE, ENOMEM) | |
TEST_READ (FALSE, ENOTCONN) | |
TEST_READ (TRUE, EAGAIN) | |
TEST_READ (TRUE, EWOULDBLOCK) | |
int | test_setsockopt (int sockfd, int level, int optname, const void *optval, socklen_t optlen) |
int | test_socket (int domain, int type, int protocol) |
TEST_WRITE (FALSE, EACCES) | |
TEST_WRITE (FALSE, EBADF) | |
TEST_WRITE (FALSE, ECONNRESET) | |
TEST_WRITE (FALSE, EDESTADDRREQ) | |
TEST_WRITE (FALSE, EDQUOT) | |
TEST_WRITE (FALSE, EFAULT) | |
TEST_WRITE (FALSE, EFBIG) | |
TEST_WRITE (FALSE, EINVAL) | |
TEST_WRITE (FALSE, EIO) | |
TEST_WRITE (FALSE, EISCONN) | |
TEST_WRITE (FALSE, ENOBUFS) | |
TEST_WRITE (FALSE, ENOMEM) | |
TEST_WRITE (FALSE, ENOSPC) | |
TEST_WRITE (FALSE, ENOTCONN) | |
TEST_WRITE (FALSE, EPIPE) | |
TEST_WRITE (TRUE, EAGAIN) | |
TEST_WRITE (TRUE, EINTR) | |
TEST_WRITE (TRUE, EWOULDBLOCK) | |
#define FOR_ERRNO | ( | itr, | |
var, | |||
... | |||
) |
Definition at line 42 of file test_socket.cpp.
#define TEST_READ | ( | RES, | |
ERR | |||
) |
Definition at line 376 of file test_socket.cpp.
#define TEST_WRITE | ( | RES, | |
ERR | |||
) |
Definition at line 546 of file test_socket.cpp.
void EXPECT_SOCKADDR_EQ | ( | const sockaddr * | addr1, |
const sockaddr * | addr2 | ||
) |
Definition at line 943 of file test_socket.cpp.
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 1388 of file test_socket.cpp.
ssize_t mock_read | ( | int | fd, |
void * | buf, | ||
size_t | count | ||
) |
Definition at line 313 of file test_socket.cpp.
ssize_t mock_write | ( | int | fd, |
const void * | buf, | ||
size_t | count | ||
) |
Definition at line 475 of file test_socket.cpp.
bool operator== | ( | const in6_addr | a, |
const in6_addr | b | ||
) |
Definition at line 628 of file test_socket.cpp.
int test_accept | ( | int | sockfd, |
struct sockaddr * | addr, | ||
socklen_t * | addrlen | ||
) |
Definition at line 824 of file test_socket.cpp.
int test_bind | ( | int | sockfd, |
const struct sockaddr * | addr, | ||
socklen_t | addrlen | ||
) |
Definition at line 638 of file test_socket.cpp.
int test_close | ( | int | fd | ) |
Definition at line 224 of file test_socket.cpp.
int test_connect | ( | int | sockfd, |
const struct sockaddr * | addr, | ||
socklen_t | addrlen | ||
) |
Definition at line 981 of file test_socket.cpp.
TEST_F | ( | XmlRpcConnectTest | , |
connect_failure | |||
) |
Definition at line 1321 of file test_socket.cpp.
TEST_F | ( | XmlRpcConnectTest | , |
connect_ipv4 | |||
) |
Definition at line 1166 of file test_socket.cpp.
TEST_F | ( | XmlRpcConnectTest | , |
connect_ipv6 | |||
) |
Definition at line 1204 of file test_socket.cpp.
TEST_F | ( | XmlRpcConnectTest | , |
connect_lookup_fail | |||
) |
Definition at line 1234 of file test_socket.cpp.
TEST_F | ( | XmlRpcConnectTest | , |
connect_multiple_result | |||
) |
Definition at line 1318 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
accept | |||
) |
Definition at line 845 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
bind | |||
) |
Definition at line 665 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
close | |||
) |
Definition at line 232 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
get_port | |||
) |
Definition at line 736 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
listen | |||
) |
Definition at line 800 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
nbRead | |||
) |
Definition at line 355 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
nbRead_EINTR | |||
) |
Definition at line 401 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
nbWrite | |||
) |
Definition at line 505 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
setNonBlocking | |||
) |
Definition at line 270 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
setReuseAddr | |||
) |
Definition at line 600 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
socket | |||
) |
Definition at line 181 of file test_socket.cpp.
TEST_F | ( | XmlRpcSocketTest | , |
TestMocks | |||
) |
Definition at line 80 of file test_socket.cpp.
int test_fcntl | ( | int | fd, |
int | cmd, | ||
unsigned long | arg | ||
) |
Definition at line 260 of file test_socket.cpp.
void test_freeaddrinfo | ( | struct addrinfo * | res | ) |
Definition at line 934 of file test_socket.cpp.
int test_getaddrinfo | ( | const char * | node, |
const char * | service, | ||
const struct addrinfo * | hints, | ||
struct addrinfo ** | res | ||
) |
Definition at line 909 of file test_socket.cpp.
int test_getsockname | ( | int | sockfd, |
struct sockaddr * | addr, | ||
socklen_t * | addrlen | ||
) |
Definition at line 715 of file test_socket.cpp.
int test_listen | ( | int | sockfd, |
int | backlog | ||
) |
Definition at line 792 of file test_socket.cpp.
TEST_READ | ( | FALSE | , |
EACCES | |||
) |
TEST_READ | ( | FALSE | , |
EBADF | |||
) |
TEST_READ | ( | FALSE | , |
ECONNREFUSED | |||
) |
TEST_READ | ( | FALSE | , |
EFAULT | |||
) |
TEST_READ | ( | FALSE | , |
EINVAL | |||
) |
TEST_READ | ( | FALSE | , |
EIO | |||
) |
TEST_READ | ( | FALSE | , |
EISDIR | |||
) |
TEST_READ | ( | FALSE | , |
ENOMEM | |||
) |
TEST_READ | ( | FALSE | , |
ENOTCONN | |||
) |
TEST_READ | ( | TRUE | , |
EAGAIN | |||
) |
TEST_READ | ( | TRUE | , |
EWOULDBLOCK | |||
) |
int test_setsockopt | ( | int | sockfd, |
int | level, | ||
int | optname, | ||
const void * | optval, | ||
socklen_t | optlen | ||
) |
Definition at line 583 of file test_socket.cpp.
int test_socket | ( | int | domain, |
int | type, | ||
int | protocol | ||
) |
Definition at line 171 of file test_socket.cpp.
TEST_WRITE | ( | FALSE | , |
EACCES | |||
) |
TEST_WRITE | ( | FALSE | , |
EBADF | |||
) |
TEST_WRITE | ( | FALSE | , |
ECONNRESET | |||
) |
TEST_WRITE | ( | FALSE | , |
EDESTADDRREQ | |||
) |
TEST_WRITE | ( | FALSE | , |
EDQUOT | |||
) |
TEST_WRITE | ( | FALSE | , |
EFAULT | |||
) |
TEST_WRITE | ( | FALSE | , |
EFBIG | |||
) |
TEST_WRITE | ( | FALSE | , |
EINVAL | |||
) |
TEST_WRITE | ( | FALSE | , |
EIO | |||
) |
TEST_WRITE | ( | FALSE | , |
EISCONN | |||
) |
TEST_WRITE | ( | FALSE | , |
ENOBUFS | |||
) |
TEST_WRITE | ( | FALSE | , |
ENOMEM | |||
) |
TEST_WRITE | ( | FALSE | , |
ENOSPC | |||
) |
TEST_WRITE | ( | FALSE | , |
ENOTCONN | |||
) |
TEST_WRITE | ( | FALSE | , |
EPIPE | |||
) |
TEST_WRITE | ( | TRUE | , |
EAGAIN | |||
) |
TEST_WRITE | ( | TRUE | , |
EINTR | |||
) |
TEST_WRITE | ( | TRUE | , |
EWOULDBLOCK | |||
) |
void* accept_addr = 0 |
Definition at line 822 of file test_socket.cpp.
socklen_t accept_addrlen = 0 |
Definition at line 823 of file test_socket.cpp.
int accept_errno = 0 |
Definition at line 820 of file test_socket.cpp.
int accept_ret = 0 |
Definition at line 819 of file test_socket.cpp.
int accept_sockfd = 0 |
Definition at line 821 of file test_socket.cpp.
int bind_errno = 0 |
Definition at line 634 of file test_socket.cpp.
int bind_family = 0 |
Definition at line 636 of file test_socket.cpp.
int bind_port = 0 |
Definition at line 637 of file test_socket.cpp.
int bind_ret = 0 |
Definition at line 633 of file test_socket.cpp.
int bind_sockfd = 0 |
Definition at line 635 of file test_socket.cpp.
int close_errno = 0 |
Definition at line 222 of file test_socket.cpp.
int close_fd = 0 |
Definition at line 221 of file test_socket.cpp.
int close_ret = 0 |
Definition at line 223 of file test_socket.cpp.
const struct sockaddr* connect_addr = 0 |
Definition at line 979 of file test_socket.cpp.
socklen_t connect_addrlen = 0 |
Definition at line 980 of file test_socket.cpp.
int connect_errno = 0 |
Definition at line 977 of file test_socket.cpp.
int connect_ret = 0 |
Definition at line 976 of file test_socket.cpp.
int connect_sockfd = 0 |
Definition at line 978 of file test_socket.cpp.
std::deque<expected_read> expected_reads |
Definition at line 311 of file test_socket.cpp.
std::deque<expected_write> expected_writes |
Definition at line 473 of file test_socket.cpp.
unsigned long fcntl_arg = 0 |
Definition at line 257 of file test_socket.cpp.
int fcntl_cmd = 0 |
Definition at line 256 of file test_socket.cpp.
int fcntl_errno = 0 |
Definition at line 258 of file test_socket.cpp.
int fcntl_fd = 0 |
Definition at line 255 of file test_socket.cpp.
int fcntl_ret = 0 |
Definition at line 259 of file test_socket.cpp.
struct addrinfo* freeaddrinfo_res = 0 |
Definition at line 933 of file test_socket.cpp.
int getaddrinfo_errno = 0 |
Definition at line 897 of file test_socket.cpp.
struct addrinfo getaddrinfo_hints |
Definition at line 900 of file test_socket.cpp.
const char* getaddrinfo_node = 0 |
Definition at line 898 of file test_socket.cpp.
struct addrinfo* getaddrinfo_res = 0 |
Definition at line 908 of file test_socket.cpp.
int getaddrinfo_ret = 0 |
Definition at line 896 of file test_socket.cpp.
const char* getaddrinfo_service = 0 |
Definition at line 899 of file test_socket.cpp.
void* getsockname_addr = 0 |
Definition at line 713 of file test_socket.cpp.
int getsockname_errno = 0 |
Definition at line 711 of file test_socket.cpp.
socklen_t getsockname_len = 0 |
Definition at line 714 of file test_socket.cpp.
int getsockname_ret = 0 |
Definition at line 710 of file test_socket.cpp.
int getsockname_sockfd = 0 |
Definition at line 712 of file test_socket.cpp.
int listen_backlog = 0 |
Definition at line 791 of file test_socket.cpp.
int listen_errno = 0 |
Definition at line 789 of file test_socket.cpp.
int listen_ret = 0 |
Definition at line 788 of file test_socket.cpp.
int listen_sockfd = 0 |
Definition at line 790 of file test_socket.cpp.
int setsockopt_errno = 0 |
Definition at line 581 of file test_socket.cpp.
int setsockopt_ret = 0 |
Definition at line 580 of file test_socket.cpp.
int setsockopt_sockfd = 0 |
Definition at line 582 of file test_socket.cpp.
int socket_domain = 0 |
Definition at line 168 of file test_socket.cpp.
int socket_errno = 0 |
Definition at line 167 of file test_socket.cpp.
int socket_protocol = 0 |
Definition at line 170 of file test_socket.cpp.
int socket_ret = 0 |
Definition at line 166 of file test_socket.cpp.
int socket_type = 0 |
Definition at line 169 of file test_socket.cpp.