]> The Tcpdump Group git mirrors - libpcap/blob - build_matrix.sh
TESTrun: Make some naming more consistent.
[libpcap] / build_matrix.sh
1 #!/bin/sh -e
2
3 # This script executes the matrix loops, exclude tests and cleaning.
4 # The matrix can be configured with the following environment variables:
5 # MATRIX_CC, MATRIX_CMAKE, MATRIX_IPV6 and MATRIX_REMOTE.
6 : "${MATRIX_CC:=gcc clang}"
7 : "${MATRIX_CMAKE:=no yes}"
8 : "${MATRIX_IPV6:=no yes}"
9 : "${MATRIX_REMOTE:=no yes}"
10 # Set this variable to "yes" before calling this script to disregard all cmake
11 # warnings in a particular environment (CI or a local working copy). Set it
12 # to "yes" in this script or in build.sh when a matrix subset is known to be
13 # not cmake warning-free because of the version or whatever other factor
14 # that the scripts can detect both in and out of CI.
15 : "${LIBPCAP_CMAKE_TAINTED:=no}"
16 # Set this variable to "yes" before calling this script to disregard all
17 # warnings in a particular environment (CI or a local working copy). Set it
18 # to "yes" in this script or in build.sh when a matrix subset is known to be
19 # not warning-free because of the OS, the compiler or whatever other factor
20 # that the scripts can detect both in and out of CI.
21 : "${LIBPCAP_TAINTED:=no}"
22 # Some OSes have native make without parallel jobs support and sometimes have
23 # GNU Make available as "gmake".
24 : "${MAKE_BIN:=make}"
25 # Custom path to Valgrind (default: use "valgrind" if available). Set to
26 # "false" to avoid using Valgrind on a slow host.
27 : "${VALGRIND_BIN:=valgrind}"
28 # It calls the build.sh script which runs one build with setup environment
29 # variables: CC, CMAKE, IPV6 and REMOTE.
30
31 . ./build_common.sh
32 print_sysinfo
33 # Install directory prefix
34 if [ -z "$PREFIX" ]; then
35 PREFIX=`mktempdir libpcap_build_matrix`
36 echo "PREFIX set to '$PREFIX'"
37 export PREFIX
38 fi
39 COUNT=0
40 export LIBPCAP_TAINTED
41 export LIBPCAP_CMAKE_TAINTED
42 if "$VALGRIND_BIN" --version >/dev/null 2>&1; then
43 VALGRIND_CMD="$VALGRIND_BIN --leak-check=full --error-exitcode=1 --quiet"
44 export VALGRIND_CMD
45 # With Valgrind filtertest takes significantly longer to complete.
46 : "${FILTERTEST_TIMEOUT:=5}"
47 export FILTERTEST_TIMEOUT
48 fi
49
50 run_after_echo git show --oneline -s | cat
51 touch .devel
52 for CC in $MATRIX_CC; do
53 export CC
54 discard_cc_cache
55 if gcc_is_clang_in_disguise; then
56 echo '(skipped)'
57 continue
58 fi
59 for CMAKE in $MATRIX_CMAKE; do
60 export CMAKE
61 for IPV6 in $MATRIX_IPV6; do
62 export IPV6
63 for REMOTE in $MATRIX_REMOTE; do
64 export REMOTE
65 COUNT=`increment "$COUNT"`
66 echo_magenta "===== SETUP $COUNT: CC=$CC CMAKE=$CMAKE IPV6=$IPV6 REMOTE=$REMOTE =====" >&2
67 # Run one build with setup environment variables: CC, CMAKE,
68 # IPV6 and REMOTE
69 run_after_echo ./build.sh
70 echo 'Cleaning...'
71 if [ "$CMAKE" = yes ]; then rm -rf build; else "$MAKE_BIN" distclean; fi
72 purge_directory "$PREFIX"
73 run_after_echo git status -suall
74 done
75 done
76 done
77 done
78 run_after_echo rm -rf "$PREFIX"
79 echo_magenta "Tested setup count: $COUNT" >&2
80 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :