diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bandwidth.c | 10 | ||||
| -rw-r--r-- | tests/common.c | 6 | ||||
| -rwxr-xr-x | tests/test_closure | 2 |
3 files changed, 14 insertions, 4 deletions
diff --git a/tests/bandwidth.c b/tests/bandwidth.c index f202a3c..0420c5d 100644 --- a/tests/bandwidth.c +++ b/tests/bandwidth.c @@ -125,6 +125,16 @@ test_bandwidth(unsigned bw) send_proc(SOCK2PTR(udp_socks[1])); check_res(th[0], expected); + // both at the same time + flush_socks(); + assert(pthread_create(&th[0], NULL, recv_proc, SOCK2PTR(udp_socks[0])) == 0); + assert(pthread_create(&th[1], NULL, recv_proc, SOCK2PTR(udp_socks[1])) == 0); + assert(pthread_create(&th[2], NULL, send_proc, SOCK2PTR(udp_socks[0])) == 0); + send_proc(SOCK2PTR(udp_socks[1])); + assert(pthread_join(th[2], NULL) == 0); + check_res(th[0], expected); + check_res(th[1], expected); + close_udp_pair(udp_socks); kill_latency(); } diff --git a/tests/common.c b/tests/common.c index 58e86b8..d103f1d 100644 --- a/tests/common.c +++ b/tests/common.c @@ -16,7 +16,7 @@ latency_running(void) int sock = socket(AF_INET, SOCK_DGRAM, 0); assert(sock >= 0); setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const void *) &socktrue, sizeof(socktrue)); - setup_addr(&addr, "192.168.127.0", 0); + setup_addr(&addr, "192.168.127.2", 0); bool res; if (bind(sock, &addr.generic, sizeof(addr)) == 0) { res = true; @@ -127,7 +127,7 @@ create_udp_pair(int socks[2]) assert(sock >= 0); socks[1] = sock; setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const void *) &socktrue, sizeof(socktrue)); - setup_addr(&addr, "192.168.127.0", 0); + setup_addr(&addr, "192.168.127.2", 0); assert(bind(sock, &addr.generic, sizeof(addr)) == 0); addr_len = sizeof(addr); assert(getsockname(sock, &addr.generic, &addr_len) == 0); @@ -136,7 +136,7 @@ create_udp_pair(int socks[2]) // make a pair from the above ones setup_addr(&addr, "192.168.127.1", ports[1]); assert(connect(socks[0], &addr.generic, sizeof(addr)) == 0); - setup_addr(&addr, "192.168.127.1", ports[0]); + setup_addr(&addr, "192.168.127.3", ports[0]); assert(connect(socks[1], &addr.generic, sizeof(addr)) == 0); } diff --git a/tests/test_closure b/tests/test_closure index e2df3df..33eeced 100755 --- a/tests/test_closure +++ b/tests/test_closure @@ -4,7 +4,7 @@ # after all data are sent even if real client # already closed the connection port=8765 -ip_listen=192.168.127.0 +ip_listen=192.168.127.2 ip=192.168.127.1 set -e |
