• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2
3#SILENT="--disable-silent-rules"
4
5if test "x$TESTS" = "xyes" -o "x$TESTS" = "xtrue" ; then
6    WITH_TESTS="`scripts/fix-cunit.sh` --enable-tests"
7    test -f `pwd`/cunit.pc && echo cat `pwd`/cunit.pc
8fi
9
10TEST_LD_LIBRARY_PATH=
11case "x${TLS}" in
12    xno)       WITH_TLS="--disable-dtls"
13               ;;
14    xopenssl)  WITH_TLS="--with-openssl"
15               ;;
16    xgnutls)   WITH_TLS="--with-gnutls"
17               ;;
18    xmbedtls)  WITH_TLS="--with-mbedtls"
19               ;;
20    xtinydtls) WITH_TLS="--with-tinydtls"
21               # Need this as libtinydtls.so has not been installed
22               # as a part of the travis build
23               TEST_LD_LIBRARY_PATH="ext/tinydtls"
24               ;;
25    *)         WITH_TLS="--with-gnutls"
26               ;;
27esac
28
29case "x${DOCS}" in
30    xyes)      WITH_DOCS="--enable-documentation"
31               ;;
32    *)         WITH_DOCS="--disable-documentation"
33               ;;
34esac
35
36# Building with epoll support can be disabled by setting EPOLL=no.
37# Otherwise, it is enabled by default and used if available.
38if test "x$EPOLL" = "xno" ; then
39    OTHER_OPTS="$OTHER_OPTS --without-epoll"
40fi
41
42# Enable constrained stack build when SMALL_STACK is set to yes.
43if test "x$SMALL_STACK" = "xyes" ; then
44    OTHER_OPTS="$OTHER_OPTS --enable-small-stack"
45fi
46
47config() {
48    echo "./configure $SILENT $*"
49    ./configure $SILENT $* || cat config.log
50}
51
52case "${PLATFORM}" in
53    contiki) config "--disable-tests $WITH_DOCS --disable-examples $WITH_TLS" && \
54               make -C examples/contiki
55             ;;
56    lwip)    config "--disable-tests $WITH_DOCS --disable-examples $WITH_TLS" && \
57               make -C examples/lwip
58             ;;
59    posix|*) config "$WITH_TESTS $WITH_DOCS --enable-examples $WITH_TLS $OTHER_OPTS" && \
60               make && make check
61             ;;
62esac
63
64err=$?
65if test $err = 0 -a -n "$WITH_TESTS" ; then
66    EXEC_FILE=tests/testdriver
67    # then run valgrind on the actual executable
68    LD_LIBRARY_PATH=$TEST_LD_LIBRARY_PATH libtool --mode=execute valgrind --track-origins=yes --leak-check=yes --show-reachable=yes --error-exitcode=123 --quiet --suppressions=tests/valgrind_suppression $EXEC_FILE
69    err=$?
70fi
71
72# invoke OSS-Fuzz syntax checks
73if test $err = 0 -a -n "$WITH_TESTS" ; then
74    make -C tests/oss-fuzz -f Makefile.ci check clean
75    err=$?
76fi
77
78# invoke man page examples code compiles checks
79if test $err = 0 -a -n "$WITH_TESTS" ; then
80    make -C man
81    EXEC_FILE=man/examples-code-check
82    $EXEC_FILE man
83    err=$?
84fi
85
86exit $err
87