2016-07-13 20:12:11 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-08-25 06:52:34 +08:00
|
|
|
# Enable test coverage recording.
|
|
|
|
export CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
|
2016-08-10 19:28:33 +08:00
|
|
|
|
2017-01-05 05:15:48 +08:00
|
|
|
set_opt() {
|
|
|
|
opts="$opts -D$1="`expr ON \& \( $i % 2 \) \| OFF`
|
|
|
|
set +e # result can be 0
|
|
|
|
i=`expr $i / 2`
|
|
|
|
set -e
|
|
|
|
}
|
|
|
|
|
2017-11-15 17:48:48 +08:00
|
|
|
if perl -e '
|
|
|
|
use Socket qw(PF_INET6 SOCK_STREAM pack_sockaddr_in6 IN6ADDR_LOOPBACK);
|
|
|
|
|
|
|
|
socket(S, PF_INET6, SOCK_STREAM, 0) || exit 1;
|
|
|
|
bind(S, pack_sockaddr_in6(0, IN6ADDR_LOOPBACK)) || exit 1;
|
|
|
|
'; then
|
2018-01-10 21:39:07 +08:00
|
|
|
USE_IPV6=yes
|
2017-11-15 17:48:48 +08:00
|
|
|
else
|
2018-01-10 21:39:07 +08:00
|
|
|
USE_IPV6=no
|
2017-11-15 17:48:48 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2016-07-13 20:12:11 +08:00
|
|
|
# Build toxcore and run tests.
|
2016-10-01 02:13:29 +08:00
|
|
|
RUN $CMAKE \
|
|
|
|
-B$BUILD_DIR \
|
|
|
|
-H. \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=$CURDIR/_install \
|
2016-11-06 04:24:36 +08:00
|
|
|
-DASAN=ON \
|
2016-10-01 02:13:29 +08:00
|
|
|
-DDEBUG=ON \
|
|
|
|
-DSTRICT_ABI=ON \
|
2017-03-26 23:56:51 +08:00
|
|
|
-DTEST_TIMEOUT_SECONDS=120 \
|
2016-10-01 02:13:29 +08:00
|
|
|
-DTRACE=ON \
|
2017-11-15 17:48:48 +08:00
|
|
|
-DUSE_IPV6=$USE_IPV6 \
|
2016-11-06 04:24:36 +08:00
|
|
|
$CMAKE_EXTRA_FLAGS
|
2016-08-10 19:28:33 +08:00
|
|
|
|
2016-08-25 06:52:34 +08:00
|
|
|
export CTEST_OUTPUT_ON_FAILURE=1
|
2016-07-13 20:12:11 +08:00
|
|
|
|
2017-03-08 17:10:46 +08:00
|
|
|
RUN $MAKE -C$BUILD_DIR -j$NPROC -k install
|
2017-01-06 05:23:06 +08:00
|
|
|
if $RUN_TESTS; then
|
2017-08-03 06:03:19 +08:00
|
|
|
TESTS $MAX_TEST_RETRIES $MAKE -C$BUILD_DIR -j$NPROC test ARGS="--rerun-failed" CTEST_OUTPUT_ON_FAILURE="$CTEST_OUTPUT_ON_FAILURE"
|
2017-01-06 05:23:06 +08:00
|
|
|
fi
|