summaryrefslogtreecommitdiff
path: root/.travis
diff options
context:
space:
mode:
Diffstat (limited to '.travis')
-rwxr-xr-x.travis/autotools-linux52
-rwxr-xr-x.travis/cmake-freebsd-stage123
-rwxr-xr-x.travis/cmake-freebsd-stage223
-rwxr-xr-x.travis/cmake-linux75
-rwxr-xr-x.travis/cmake-osx46
-rwxr-xr-x.travis/cmake-win327
-rwxr-xr-x.travis/cmake-win647
-rw-r--r--.travis/cmake-windows.sh48
-rw-r--r--.travis/flags-clang.sh62
-rw-r--r--.travis/flags-gcc.sh19
-rw-r--r--.travis/flags.sh33
-rwxr-xr-x.travis/tox-bootstrapd-docker62
-rwxr-xr-x.travis/upload-coverage8
13 files changed, 465 insertions, 0 deletions
diff --git a/.travis/autotools-linux b/.travis/autotools-linux
new file mode 100755
index 00000000..6d38e34e
--- /dev/null
+++ b/.travis/autotools-linux
@@ -0,0 +1,52 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7CACHEDIR="$HOME/cache"
8NPROC=`nproc`
9
10travis_install() {
11 # Install vanilla NaCl only.
12 [ -f "$CACHEDIR/lib/amd64/libnacl.a" ] || {
13 curl https://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 | tar jx
14 cd nacl-20110221 # pushd
15 "./do"
16 # "make install"
17 mkdir -p "$CACHEDIR/include"; mv build/*/include/* "$CACHEDIR/include"
18 mkdir -p "$CACHEDIR/lib" ; mv build/*/lib/* "$CACHEDIR/lib"
19 cd - # popd
20 }
21}
22
23travis_script() {
24 . ".travis/flags-$CC.sh"
25
26 add_ld_flag -Wl,-z,defs
27
28 # Make compilation error on a warning
29 add_flag -Werror
30
31 add_config_flag --with-nacl-libs="$CACHEDIR/lib/amd64"
32 add_config_flag --with-nacl-headers="$CACHEDIR/include/amd64"
33 add_config_flag --disable-ipv6
34 add_config_flag --enable-nacl
35 add_config_flag --enable-daemon
36 add_config_flag --enable-logging
37 add_config_flag --with-log-level=TRACE
38
39 autoreconf -fi
40 mkdir -p _build
41 cd _build # pushd
42 ../configure $CONFIG_FLAGS || (cat config.log && false)
43 make "-j$NPROC" -k CFLAGS="$C_FLAGS" LDFLAGS="$LD_FLAGS"
44 make "-j$NPROC" -k distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIG_FLAGS"
45 cd - # popd
46}
47
48if [ "-z" "$ACTION" ]; then
49 "travis_script"
50else
51 "travis_$ACTION"
52fi
diff --git a/.travis/cmake-freebsd-stage1 b/.travis/cmake-freebsd-stage1
new file mode 100755
index 00000000..3954e2af
--- /dev/null
+++ b/.travis/cmake-freebsd-stage1
@@ -0,0 +1,23 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7. other/travis/env.sh
8. other/travis/env-freebsd.sh
9
10travis_install() {
11 . other/travis/freebsd-install
12 . other/travis/freebsd-install-stage1
13}
14
15travis_script() {
16 echo "Nothing to do here. Building happens in stage 2."
17}
18
19if [ "-z" "$ACTION" ]; then
20 "travis_script"
21else
22 "travis_$ACTION"
23fi
diff --git a/.travis/cmake-freebsd-stage2 b/.travis/cmake-freebsd-stage2
new file mode 100755
index 00000000..57b8a0f8
--- /dev/null
+++ b/.travis/cmake-freebsd-stage2
@@ -0,0 +1,23 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7. other/travis/env.sh
8. other/travis/env-freebsd.sh
9
10travis_install() {
11 . other/travis/freebsd-install
12 . other/travis/freebsd-install-stage2
13}
14
15travis_script() {
16 . other/travis/toxcore-script
17}
18
19if [ "-z" "$ACTION" ]; then
20 "travis_script"
21else
22 "travis_$ACTION"
23fi
diff --git a/.travis/cmake-linux b/.travis/cmake-linux
new file mode 100755
index 00000000..e3517a09
--- /dev/null
+++ b/.travis/cmake-linux
@@ -0,0 +1,75 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7CACHEDIR="$HOME/cache"
8NPROC=`nproc`
9ASTYLE="$CACHEDIR/astyle/build/gcc/bin/astyle"
10
11travis_install() {
12 which coveralls || {
13 # Install cpp-coveralls to upload test coverage results.
14 pip install --user ndg-httpsclient urllib3[secure] cpp-coveralls
15
16 # Work around https://github.com/eddyxu/cpp-coveralls/issues/108 by manually
17 # installing the pyOpenSSL module and injecting it into urllib3 as per
18 # https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
19 sed -i -e '/^import sys$/a import urllib3.contrib.pyopenssl\nurllib3.contrib.pyopenssl.inject_into_urllib3()' `which coveralls`
20 }
21
22 # Install astyle (version in ubuntu-precise too old).
23 [ -f "$ASTYLE" ] || {
24 wget -O ../astyle.tar.gz https://deb.debian.org/debian/pool/main/a/astyle/astyle_2.06.orig.tar.gz
25 tar -xf ../astyle.tar.gz -C "$CACHEDIR"
26 make -C "$CACHEDIR/astyle/build/gcc" "-j$NPROC"
27 }
28
29 # Install libsodium (not in ubuntu-precise).
30 [ -f "$CACHEDIR/lib/libsodium.a" ] || {
31 git clone --depth=1 --branch=stable https://github.com/jedisct1/libsodium ../libsodium
32 cd ../libsodium # pushd
33 ./autogen.sh
34 ./configure --prefix="$CACHEDIR"
35 make install "-j$NPROC"
36 cd - # popd
37 }
38}
39
40travis_script() {
41 . ".travis/flags-$CC.sh"
42
43 add_ld_flag -Wl,-z,defs
44
45 # Make compilation error on a warning
46 add_flag -Werror
47
48 # Coverage flags.
49 add_flag -fprofile-arcs -ftest-coverage
50
51 cmake -B_build -H. \
52 -DCMAKE_C_FLAGS="$C_FLAGS" \
53 -DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
54 -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
55 -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
56 -DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
57 -DTRACE=ON \
58 -DMUST_BUILD_TOXAV=ON \
59 -DSTRICT_ABI=ON \
60 -DTEST_TIMEOUT_SECONDS=120 \
61 -DUSE_IPV6=OFF
62
63 cd _build # pushd
64 make "-j$NPROC" -k install
65 make "-j$NPROC" test ARGS="-j50" CTEST_OUTPUT_ON_FAILURE=1
66 cd - # popd
67
68 other/astyle/format-source . "$ASTYLE"
69}
70
71if [ "-z" "$ACTION" ]; then
72 "travis_script"
73else
74 "travis_$ACTION"
75fi
diff --git a/.travis/cmake-osx b/.travis/cmake-osx
new file mode 100755
index 00000000..529a2309
--- /dev/null
+++ b/.travis/cmake-osx
@@ -0,0 +1,46 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7CACHEDIR="$HOME/cache"
8NPROC=`sysctl -n hw.physicalcpu`
9
10travis_install() {
11 # Workaround for bug in Homebrew where it only finds an old Ruby version.
12 brew update
13
14 brew install libsodium libvpx opus libconfig
15}
16
17travis_script() {
18 . ".travis/flags-$CC.sh"
19
20 add_ld_flag -undefined error
21
22 # Make compilation error on a warning
23 add_flag -Werror
24
25 cmake -B_build -H. \
26 -DCMAKE_C_FLAGS="$C_FLAGS" \
27 -DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
28 -DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
29 -DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
30 -DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
31 -DTRACE=ON \
32 -DMUST_BUILD_TOXAV=ON \
33 -DTEST_TIMEOUT_SECONDS=120 \
34 -DUSE_IPV6=OFF
35
36 cd _build # pushd
37 make "-j$NPROC" -k install
38 make "-j$NPROC" test ARGS="-j50" CTEST_OUTPUT_ON_FAILURE=1
39 cd - # popd
40}
41
42if [ "-z" "$ACTION" ]; then
43 "travis_script"
44else
45 "travis_$ACTION"
46fi
diff --git a/.travis/cmake-win32 b/.travis/cmake-win32
new file mode 100755
index 00000000..e4be36f0
--- /dev/null
+++ b/.travis/cmake-win32
@@ -0,0 +1,7 @@
1#!/bin/sh
2
3i686=true
4x86_64=false
5WINDOWS_ARCH=win32
6
7. .travis/cmake-windows.sh
diff --git a/.travis/cmake-win64 b/.travis/cmake-win64
new file mode 100755
index 00000000..f961a00b
--- /dev/null
+++ b/.travis/cmake-win64
@@ -0,0 +1,7 @@
1#!/bin/sh
2
3i686=false
4x86_64=true
5WINDOWS_ARCH=win64
6
7. .travis/cmake-windows.sh
diff --git a/.travis/cmake-windows.sh b/.travis/cmake-windows.sh
new file mode 100644
index 00000000..a7d1f7e1
--- /dev/null
+++ b/.travis/cmake-windows.sh
@@ -0,0 +1,48 @@
1#!/bin/sh
2
3ACTION="$1"
4
5set -eu
6
7CACHEDIR="$HOME/cache"
8NPROC=`nproc`
9
10travis_install() {
11 cd other/docker/windows
12
13 docker build \
14 --build-arg SUPPORT_ARCH_i686=$i686 \
15 --build-arg SUPPORT_ARCH_x86_64=$x86_64 \
16 --build-arg SUPPORT_TEST=true \
17 -t toxcore-$WINDOWS_ARCH \
18 .
19}
20
21travis_script() {
22 . ".travis/flags-$CC.sh"
23
24 # Allows wine to display source code file names and line numbers on crash in
25 # its backtrace.
26 add_flag -gdwarf-2
27
28 docker run \
29 -e ALLOW_TEST_FAILURE=true \
30 -e ENABLE_ARCH_i686=$i686 \
31 -e ENABLE_ARCH_x86_64=$x86_64 \
32 -e ENABLE_TEST=true \
33 -e EXTRA_CMAKE_FLAGS="-DBOOTSTRAP_DAEMON=OFF -DDEBUG=ON -DTEST_TIMEOUT_SECONDS=90" \
34 -e DCMAKE_C_FLAGS="$C_FLAGS" \
35 -e CMAKE_CXX_FLAGS="$CXX_FLAGS" \
36 -e CMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
37 -e CMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
38 -v "$PWD:/toxcore" \
39 -v "$PWD/result:/prefix" \
40 --rm \
41 toxcore-$WINDOWS_ARCH
42}
43
44if [ "-z" "$ACTION" ]; then
45 "travis_script"
46else
47 "travis_$ACTION"
48fi
diff --git a/.travis/flags-clang.sh b/.travis/flags-clang.sh
new file mode 100644
index 00000000..1bca35ca
--- /dev/null
+++ b/.travis/flags-clang.sh
@@ -0,0 +1,62 @@
1#!/bin/sh
2
3. .travis/flags.sh
4
5# Add all warning flags we can.
6add_flag -Wall
7add_flag -Wextra
8add_flag -Weverything
9
10# Disable specific warning flags for both C and C++.
11
12# TODO(iphydf): Clean these up. Probably all of these are actual bugs.
13add_flag -Wno-cast-align
14# Very verbose, not very useful. This warns about things like int -> uint
15# conversions that change sign without a cast and narrowing conversions.
16add_flag -Wno-conversion
17# TODO(iphydf): Check enum values when received from the user, then assume
18# correctness and remove this suppression.
19add_flag -Wno-covered-switch-default
20# Due to clang's tolower() macro being recursive
21# https://github.com/TokTok/c-toxcore/pull/481
22add_flag -Wno-disabled-macro-expansion
23# We don't put __attribute__ on the public API.
24add_flag -Wno-documentation-deprecated-sync
25# Bootstrap daemon does this.
26add_flag -Wno-format-nonliteral
27# struct Foo foo = {0}; is a common idiom.
28add_flag -Wno-missing-field-initializers
29# Useful sometimes, but we accept padding in structs for clarity.
30# Reordering fields to avoid padding will reduce readability.
31add_flag -Wno-padded
32# This warns on things like _XOPEN_SOURCE, which we currently need (we
33# probably won't need these in the future).
34add_flag -Wno-reserved-id-macro
35# TODO(iphydf): Clean these up. They are likely not bugs, but still
36# potential issues and probably confusing.
37add_flag -Wno-sign-compare
38# Our use of mutexes results in a false positive, see 1bbe446.
39add_flag -Wno-thread-safety-analysis
40# File transfer code has this.
41add_flag -Wno-type-limits
42# Callbacks often don't use all their parameters.
43add_flag -Wno-unused-parameter
44# libvpx uses __attribute__((unused)) for "potentially unused" static
45# functions to avoid unused static function warnings.
46add_flag -Wno-used-but-marked-unused
47# We use variable length arrays a lot.
48add_flag -Wno-vla
49
50# Disable specific warning flags for C++.
51
52# Comma at end of enum is supported everywhere we run.
53add_cxx_flag -Wno-c++98-compat-pedantic
54# TODO(iphydf): Stop using flexible array members.
55add_cxx_flag -Wno-c99-extensions
56# We're C-compatible, so use C style casts.
57add_cxx_flag -Wno-old-style-cast
58
59# Downgrade to warning so we still see it.
60add_flag -Wno-error=documentation-unknown-command
61add_flag -Wno-error=unreachable-code
62add_flag -Wno-error=unused-variable
diff --git a/.travis/flags-gcc.sh b/.travis/flags-gcc.sh
new file mode 100644
index 00000000..0d262060
--- /dev/null
+++ b/.travis/flags-gcc.sh
@@ -0,0 +1,19 @@
1#!/bin/sh
2
3. .travis/flags.sh
4
5# Add all warning flags we can.
6add_flag -Wall
7add_flag -Wextra
8
9# Disable specific warning flags for both C and C++.
10
11# struct Foo foo = {0}; is a common idiom.
12add_flag -Wno-missing-field-initializers
13# TODO(iphydf): Clean these up. They are likely not bugs, but still
14# potential issues and probably confusing.
15add_flag -Wno-sign-compare
16# File transfer code has this.
17add_flag -Wno-type-limits
18# Callbacks often don't use all their parameters.
19add_flag -Wno-unused-parameter
diff --git a/.travis/flags.sh b/.travis/flags.sh
new file mode 100644
index 00000000..0c80e703
--- /dev/null
+++ b/.travis/flags.sh
@@ -0,0 +1,33 @@
1#!/bin/sh
2
3add_config_flag() { CONFIG_FLAGS="$CONFIG_FLAGS $@"; }
4add_c_flag() { C_FLAGS="$C_FLAGS $@"; }
5add_cxx_flag() { CXX_FLAGS="$CXX_FLAGS $@"; }
6add_ld_flag() { LD_FLAGS="$LD_FLAGS $@"; }
7add_flag() { add_c_flag "$@"; add_cxx_flag "$@"; }
8
9export LD_LIBRARY_PATH="$CACHEDIR/lib"
10export PKG_CONFIG_PATH="$CACHEDIR/lib/pkgconfig"
11
12# Our own flags which we can insert in the correct place. We don't use CFLAGS
13# and friends here (we unset them below), because they influence config tests
14# such as ./configure and cmake tests. Our warning flags break those tests, so
15# we can't add them globally here.
16CONFIG_FLAGS=""
17C_FLAGS=""
18CXX_FLAGS=""
19LD_FLAGS=""
20
21unset CFLAGS
22unset CXXFLAGS
23unset CPPFLAGS
24unset LDFLAGS
25
26# Optimisation flags.
27add_flag -O3 -march=native
28
29# Warn on non-ISO C.
30add_c_flag -pedantic
31
32add_flag -g3
33add_flag -ftrapv
diff --git a/.travis/tox-bootstrapd-docker b/.travis/tox-bootstrapd-docker
new file mode 100755
index 00000000..9e476b5f
--- /dev/null
+++ b/.travis/tox-bootstrapd-docker
@@ -0,0 +1,62 @@
1#!/bin/sh
2
3# Copy source code to other/bootstrap_daemon/docker/c-toxcore
4OLD_PWD=$PWD
5cd /tmp
6cp -a $OLD_PWD c-toxcore
7mv c-toxcore $OLD_PWD/other/bootstrap_daemon/docker
8cd $OLD_PWD
9ls -lbh other/bootstrap_daemon/docker
10ls -lbh other/bootstrap_daemon/docker/c-toxcore
11
12cd other/bootstrap_daemon
13
14# Make Docker container use our current source code instead of master branch
15sed -i "s|WORKDIR /tmp/tox|WORKDIR /tmp/tox\nADD /c-toxcore ./c-toxcore/|g" docker/Dockerfile
16sed -i '/git clone/d' docker/Dockerfile
17
18cat docker/Dockerfile
19
20sudo docker build -t tox-bootstrapd docker/
21sudo useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
22sudo chmod 700 /var/lib/tox-bootstrapd
23sudo docker run -d --name tox-bootstrapd -v /var/lib/tox-bootstrapd/:/var/lib/tox-bootstrapd/ -p 443:443 -p 3389:3389 -p 33445:33445 -p 33445:33445/udp tox-bootstrapd
24
25sudo ls -lbh /var/lib/tox-bootstrapd
26
27if sudo [ ! -f /var/lib/tox-bootstrapd/keys ]; then
28 echo "Error: File /var/lib/tox-bootstrapd/keys doesn't exist"
29 exit 1
30fi
31
32COUNTER=0
33COUNTER_END=120
34while [ $COUNTER -lt $COUNTER_END ]; do
35 if sudo docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully" ; then
36 break
37 fi
38 sleep 1
39 COUNTER=$(($COUNTER+1))
40done
41
42sudo docker logs tox-bootstrapd
43
44if [ "$COUNTER" = "$COUNTER_END" ]; then
45 echo "Error: Didn't connect to any nodes"
46 exit 1
47fi
48
49# Wait a bit befrore testing if the container is still running
50sleep 30
51
52sudo docker ps -a
53
54if [ "`sudo docker inspect -f {{.State.Running}} tox-bootstrapd`" != "true" ]; then
55 echo "Error: Container is not running"
56 exit 1
57fi
58
59if ! python3 ../fun/bootstrap_node_info.py ipv4 localhost 33445 ; then
60 echo "Error: Unable to get bootstrap node info"
61 exit 1
62fi
diff --git a/.travis/upload-coverage b/.travis/upload-coverage
new file mode 100755
index 00000000..7a388d0d
--- /dev/null
+++ b/.travis/upload-coverage
@@ -0,0 +1,8 @@
1#!/bin/sh
2
3# We only submit coverage from the Linux build.
4coveralls \
5 --exclude auto_tests \
6 --exclude other \
7 --exclude testing \
8 --gcov-options '\-lp'