summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-12-20 16:53:32 +0100
committerAndreas Schneider <asn@samba.org>2013-12-20 17:13:42 +0100
commitf6f5e28f3382d3828228089765040413682db85a (patch)
treeff34d970497cfbd05aa22495369f5c6dcac2a111
parent379af0763be3c25d8b4ec75220d0f98007f9328b (diff)
downloadsocket_wrapper-f6f5e28f3382d3828228089765040413682db85a.tar.gz
socket_wrapper-f6f5e28f3382d3828228089765040413682db85a.tar.xz
socket_wrapper-f6f5e28f3382d3828228089765040413682db85a.zip
torture: Add torture_server_port().
-rw-r--r--tests/torture.c15
-rw-r--r--tests/torture.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/torture.c b/tests/torture.c
index 2097ae5..3aeaa57 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -80,6 +80,21 @@ const char *torture_server_address(int family)
return NULL;
}
+int torture_server_port(void)
+{
+ char *env = getenv("TORTURE_SERVER_PORT");
+
+ if (env != NULL && env[0] != '\0' && strlen(env) < 6) {
+ int port = atoi(env);
+
+ if (port > 0 && port < 65536) {
+ return port;
+ }
+ }
+
+ return TORTURE_ECHO_SRV_PORT;
+}
+
void torture_setup_socket_dir(void **state)
{
struct torture_state *s;
diff --git a/tests/torture.h b/tests/torture.h
index be100f7..62382d6 100644
--- a/tests/torture.h
+++ b/tests/torture.h
@@ -59,6 +59,7 @@ struct torture_state {
#endif
const char *torture_server_address(int domain);
+int torture_server_port(void);
void torture_setup_socket_dir(void **state);
void torture_setup_echo_srv_udp_ipv4(void **state);