summaryrefslogtreecommitdiff
path: root/other/travis/toxcore-script
blob: 2154d55856da976f429b5ec1b5971c569a617a14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh

# Enable test coverage recording.
export CFLAGS="$CFLAGS -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
}

# Try some combinations of cmake options.
for i in `seq 0 7`; do
  set +x
  opts="$CMAKE_EXTRA_FLAGS -DWARNINGS=OFF"
  set_opt STRICT_ABI
  set_opt ENABLE_STATIC
  set_opt ENABLE_SHARED
  set -x
  RUN $CMAKE -B$BUILD_DIR -H. $opts
  rm -rf $BUILD_DIR
done

# 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                                    \
  $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="--rerun-failed"
fi