summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiadlo <polsha3@gmail.com>2017-11-15 12:48:48 +0300
committerDiadlo <polsha3@gmail.com>2017-11-15 15:22:19 +0300
commitb39cc55d374457f66606096904af9fe7ea6562f6 (patch)
treebdfdbf57bd6b6e757e156b6dad4ab6c6eeb8823d
parentd037f938111c148c6956b58ebfba717e7c7cfb00 (diff)
Add support of IPv6 disabling
-rw-r--r--CMakeLists.txt5
-rw-r--r--configure.ac10
-rwxr-xr-xother/travis/autotools-script12
-rwxr-xr-xother/travis/toxcore-script13
4 files changed, 40 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f94555fe..79f07e9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -148,6 +148,11 @@ else()
148 add_dllflag("-Wl,-z,defs") 148 add_dllflag("-Wl,-z,defs")
149endif() 149endif()
150 150
151option(USE_IPV6 "Use IPv6 in tests" ON)
152if(NOT USE_IPV6)
153 add_definitions(-DUSE_IPV6=0)
154endif()
155
151option(BUILD_TOXAV "Whether to build the tox AV library" ON) 156option(BUILD_TOXAV "Whether to build the tox AV library" ON)
152 157
153include(Dependencies) 158include(Dependencies)
diff --git a/configure.ac b/configure.ac
index 38e3dd82..1ff861cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -193,6 +193,16 @@ AC_ARG_ENABLE([[epoll]],
193 [enable_epoll='auto'] 193 [enable_epoll='auto']
194 ) 194 )
195 195
196AC_ARG_ENABLE([[ipv6]],
197 [AS_HELP_STRING([[--disable-ipv6[=ARG]]], [use ipv4 in tests (yes, no, auto) [auto]])],
198 [use_ipv6=${enableval}],
199 [use_ipv6='auto']
200 )
201
202if test "$use_ipv6" != "yes"; then
203 AC_DEFINE([USE_IPV6],[0],[define to 0 to force ipv4])
204fi
205
196AX_HAVE_EPOLL 206AX_HAVE_EPOLL
197if test "$enable_epoll" != "no"; then 207if test "$enable_epoll" != "no"; then
198 if test "${ax_cv_have_epoll}" = "yes"; then 208 if test "${ax_cv_have_epoll}" = "yes"; then
diff --git a/other/travis/autotools-script b/other/travis/autotools-script
index d97b15b3..d47dc717 100755
--- a/other/travis/autotools-script
+++ b/other/travis/autotools-script
@@ -1,5 +1,16 @@
1#!/bin/sh 1#!/bin/sh
2 2
3if perl -e '
4 use Socket qw(PF_INET6 SOCK_STREAM pack_sockaddr_in6 IN6ADDR_LOOPBACK);
5
6 socket(S, PF_INET6, SOCK_STREAM, 0) || exit 1;
7 bind(S, pack_sockaddr_in6(0, IN6ADDR_LOOPBACK)) || exit 1;
8'; then
9 IPV6_FLAG="--enable-ipv6"
10else
11 IPV6_FLAG="--disable-ipv6"
12fi
13
3# Build toxcore with some custom flags here. Note that this does *not* run the 14# Build toxcore with some custom flags here. Note that this does *not* run the
4# tests, so any flags passed here are irrelevant to testing. This only checks 15# tests, so any flags passed here are irrelevant to testing. This only checks
5# that we can build toxcore with the specified flags. Tests run with default 16# that we can build toxcore with the specified flags. Tests run with default
@@ -12,6 +23,7 @@
12 --enable-daemon \ 23 --enable-daemon \
13 --enable-logging \ 24 --enable-logging \
14 --enable-ntox \ 25 --enable-ntox \
26 $IPV6_FLAG \
15 --with-log-level=TRACE 27 --with-log-level=TRACE
16 28
17# We use make instead of RUN $MAKE here, because the autotools build will only 29# We use make instead of RUN $MAKE here, because the autotools build will only
diff --git a/other/travis/toxcore-script b/other/travis/toxcore-script
index 4f5a58ea..df1462de 100755
--- a/other/travis/toxcore-script
+++ b/other/travis/toxcore-script
@@ -22,6 +22,18 @@ for i in `seq 0 7`; do
22 RUN rm -rf $BUILD_DIR 22 RUN rm -rf $BUILD_DIR
23done 23done
24 24
25if perl -e '
26 use Socket qw(PF_INET6 SOCK_STREAM pack_sockaddr_in6 IN6ADDR_LOOPBACK);
27
28 socket(S, PF_INET6, SOCK_STREAM, 0) || exit 1;
29 bind(S, pack_sockaddr_in6(0, IN6ADDR_LOOPBACK)) || exit 1;
30'; then
31 USE_IPV6=yes
32else
33 USE_IPV6=no
34fi
35
36
25# Build toxcore and run tests. 37# Build toxcore and run tests.
26RUN $CMAKE \ 38RUN $CMAKE \
27 -B$BUILD_DIR \ 39 -B$BUILD_DIR \
@@ -32,6 +44,7 @@ RUN $CMAKE \
32 -DSTRICT_ABI=ON \ 44 -DSTRICT_ABI=ON \
33 -DTEST_TIMEOUT_SECONDS=120 \ 45 -DTEST_TIMEOUT_SECONDS=120 \
34 -DTRACE=ON \ 46 -DTRACE=ON \
47 -DUSE_IPV6=$USE_IPV6 \
35 $CMAKE_EXTRA_FLAGS 48 $CMAKE_EXTRA_FLAGS
36 49
37export CTEST_OUTPUT_ON_FAILURE=1 50export CTEST_OUTPUT_ON_FAILURE=1