mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
9d58e0aa0a
The first round some tests will fail and others will segfault. The second round, still some will fail, but the third round it might pass. At some point, tests will pass. The reason for this is that tests assume a lot about which ports they are given, and also toxcore's default port range has too few ports to run all tests in parallel. These issues will be fixed in future PRs.
45 lines
1.3 KiB
Bash
Executable File
45 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Enable test coverage recording.
|
|
export CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
|
|
export CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
|
|
|
|
set_opt() {
|
|
opts="$opts -D$1="`expr ON \& \( $i % 2 \) \| OFF`
|
|
set +e # result can be 0
|
|
i=`expr $i / 2`
|
|
set -e
|
|
}
|
|
|
|
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
|
|
USE_IPV6=yes
|
|
else
|
|
USE_IPV6=no
|
|
fi
|
|
|
|
|
|
# Build toxcore and run tests.
|
|
RUN $CMAKE \
|
|
-B$BUILD_DIR \
|
|
-H. \
|
|
-DCMAKE_INSTALL_PREFIX:PATH=$CURDIR/_install \
|
|
-DASAN=ON \
|
|
-DDEBUG=ON \
|
|
-DSTRICT_ABI=ON \
|
|
-DTEST_TIMEOUT_SECONDS=120 \
|
|
-DTRACE=ON \
|
|
-DUSE_IPV6=$USE_IPV6 \
|
|
$CMAKE_EXTRA_FLAGS
|
|
|
|
export CTEST_OUTPUT_ON_FAILURE=1
|
|
|
|
RUN $MAKE -C$BUILD_DIR -j$NPROC -k install
|
|
if $RUN_TESTS; then
|
|
TESTS $MAX_TEST_RETRIES $MAKE -C$BUILD_DIR -j$NPROC test ARGS="-j50 --rerun-failed" CTEST_OUTPUT_ON_FAILURE="$CTEST_OUTPUT_ON_FAILURE"
|
|
fi
|