]> The Tcpdump Group git mirrors - libpcap/blob - build_matrix.sh
CI: Test with IPv6 support enabled/disabled
[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 # It calls the build.sh script which runs one build with setup environment
26 # variables: CC, CMAKE, IPV6 and REMOTE.
27
28 . ./build_common.sh
29 print_sysinfo
30 # Install directory prefix
31 if [ -z "$PREFIX" ]; then
32 PREFIX=`mktempdir libpcap_build_matrix`
33 echo "PREFIX set to '$PREFIX'"
34 export PREFIX
35 fi
36 COUNT=0
37 export LIBPCAP_TAINTED
38 export LIBPCAP_CMAKE_TAINTED
39 if command -v valgrind >/dev/null 2>&1; then
40 VALGRIND_CMD="valgrind --leak-check=full --error-exitcode=1"
41 export VALGRIND_CMD
42 fi
43
44 touch .devel
45 for CC in $MATRIX_CC; do
46 export CC
47 discard_cc_cache
48 if gcc_is_clang_in_disguise; then
49 echo '(skipped)'
50 continue
51 fi
52 for CMAKE in $MATRIX_CMAKE; do
53 export CMAKE
54 for IPV6 in $MATRIX_IPV6; do
55 export IPV6
56 for REMOTE in $MATRIX_REMOTE; do
57 export REMOTE
58 COUNT=`increment $COUNT`
59 echo_magenta "===== SETUP $COUNT: CC=$CC CMAKE=$CMAKE IPV6=$IPV6 REMOTE=$REMOTE =====" >&2
60 # Run one build with setup environment variables: CC, CMAKE,
61 # IPV6 and REMOTE
62 run_after_echo ./build.sh
63 echo 'Cleaning...'
64 if [ "$CMAKE" = yes ]; then rm -rf build; else "$MAKE_BIN" distclean; fi
65 purge_directory "$PREFIX"
66 run_after_echo git status -suall
67 done
68 done
69 done
70 done
71 run_after_echo rm -rf "$PREFIX"
72 echo_magenta "Tested setup count: $COUNT" >&2
73 # vi: set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab autoindent :