summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-12-17 14:44:08 +0100
committerAndreas Schneider <asn@samba.org>2013-12-17 14:44:08 +0100
commite778fa214fb69b2119f7f5e5ebbf21476cd8b0a8 (patch)
treec252d64c6d41f0291e46bf1e441ad719818a5eb3 /tests
parent356fc983ec7f3147b5685fa6dc586959ec50b0ea (diff)
downloadsocket_wrapper-e778fa214fb69b2119f7f5e5ebbf21476cd8b0a8.tar.gz
socket_wrapper-e778fa214fb69b2119f7f5e5ebbf21476cd8b0a8.tar.xz
socket_wrapper-e778fa214fb69b2119f7f5e5ebbf21476cd8b0a8.zip
torture: Pass socket type to torture_setup_echo_srv_ip().
Diffstat (limited to 'tests')
-rw-r--r--tests/torture.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/torture.c b/tests/torture.c
index ea3c9a6..8cfd538 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -39,6 +39,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/socket.h>
#include <signal.h>
#include <fcntl.h>
@@ -79,19 +80,34 @@ void torture_setup_socket_dir(void **state)
*state = s;
}
-static void torture_setup_echo_srv_udp_ip(void **state, const char *ip)
+static void torture_setup_echo_srv_ip(void **state,
+ const char *ip,
+ int type)
{
struct torture_state *s;
char start_echo_srv[1024] = {0};
+ const char *t;
int rc;
torture_setup_socket_dir(state);
s = *state;
+ switch (type) {
+ case SOCK_STREAM:
+ t = "-t";
+ break;
+ case SOCK_DGRAM:
+ t = "-u";
+ break;
+ default:
+ t = "";
+ break;
+ }
+
snprintf(start_echo_srv, sizeof(start_echo_srv),
- "%s/tests/echo_srv -b %s -D -u --pid %s",
- BINARYDIR, ip, s->srv_pidfile);
+ "%s/tests/echo_srv -b %s -D %s --pid %s",
+ BINARYDIR, ip, t, s->srv_pidfile);
rc = system(start_echo_srv);
assert_int_equal(rc, 0);
@@ -101,12 +117,12 @@ static void torture_setup_echo_srv_udp_ip(void **state, const char *ip)
void torture_setup_echo_srv_udp_ipv4(void **state)
{
- torture_setup_echo_srv_udp_ip(state, TORTURE_ECHO_SRV_IPV4);
+ torture_setup_echo_srv_ip(state, TORTURE_ECHO_SRV_IPV4, SOCK_DGRAM);
}
void torture_setup_echo_srv_udp_ipv6(void **state)
{
- torture_setup_echo_srv_udp_ip(state, TORTURE_ECHO_SRV_IPV6);
+ torture_setup_echo_srv_ip(state, TORTURE_ECHO_SRV_IPV6, SOCK_DGRAM);
}
void torture_teardown_socket_dir(void **state)