diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/torture.c | 15 | ||||
| -rw-r--r-- | tests/torture.h | 1 |
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); |
