vdpa/mlx5: set default event mode to polling
[dpdk.git] / .ci / linux-build.sh
1 #!/bin/sh -xe
2
3 on_error() {
4     if [ $? = 0 ]; then
5         exit
6     fi
7     FILES_TO_PRINT="build/meson-logs/testlog.txt build/.ninja_log build/meson-logs/meson-log.txt"
8
9     for pr_file in $FILES_TO_PRINT; do
10         if [ -e "$pr_file" ]; then
11             cat "$pr_file"
12         fi
13     done
14 }
15 # We capture the error logs as artifacts in Github Actions, no need to dump
16 # them via a EXIT handler.
17 [ -n "$GITHUB_WORKFLOW" ] || trap on_error EXIT
18
19 install_libabigail() {
20     version=$1
21     instdir=$2
22
23     wget -q "http://mirrors.kernel.org/sourceware/libabigail/${version}.tar.gz"
24     tar -xf ${version}.tar.gz
25     cd $version && autoreconf -vfi && cd -
26     mkdir $version/build
27     cd $version/build && ../configure --prefix=$instdir && cd -
28     make -C $version/build all install
29     rm -rf $version
30     rm ${version}.tar.gz
31 }
32
33 if [ "$AARCH64" = "true" ]; then
34     # convert the arch specifier
35     OPTS="$OPTS --cross-file config/arm/arm64_armv8_linux_gcc"
36 fi
37
38 if [ "$BUILD_DOCS" = "true" ]; then
39     OPTS="$OPTS -Denable_docs=true"
40 fi
41
42 if [ "$BUILD_32BIT" = "true" ]; then
43     OPTS="$OPTS -Dc_args=-m32 -Dc_link_args=-m32"
44     export PKG_CONFIG_LIBDIR="/usr/lib32/pkgconfig"
45 fi
46
47 if [ "$DEF_LIB" = "static" ]; then
48     OPTS="$OPTS -Dexamples=l2fwd,l3fwd"
49 else
50     OPTS="$OPTS -Dexamples=all"
51 fi
52
53 OPTS="$OPTS -Dmachine=default"
54 OPTS="$OPTS --default-library=$DEF_LIB"
55 OPTS="$OPTS --buildtype=debugoptimized"
56 meson build --werror $OPTS
57 ninja -C build
58
59 if [ "$AARCH64" != "true" ]; then
60     devtools/test-null.sh
61 fi
62
63 if [ "$ABI_CHECKS" = "true" ]; then
64     LIBABIGAIL_VERSION=${LIBABIGAIL_VERSION:-libabigail-1.6}
65
66     if [ "$(cat libabigail/VERSION 2>/dev/null)" != "$LIBABIGAIL_VERSION" ]; then
67         rm -rf libabigail
68         # if we change libabigail, invalidate existing abi cache
69         rm -rf reference
70     fi
71
72     if [ ! -d libabigail ]; then
73         install_libabigail $LIBABIGAIL_VERSION $(pwd)/libabigail
74         echo $LIBABIGAIL_VERSION > libabigail/VERSION
75     fi
76
77     export PATH=$(pwd)/libabigail/bin:$PATH
78
79     REF_GIT_REPO=${REF_GIT_REPO:-https://dpdk.org/git/dpdk}
80     REF_GIT_TAG=${REF_GIT_TAG:-v19.11}
81
82     if [ "$(cat reference/VERSION 2>/dev/null)" != "$REF_GIT_TAG" ]; then
83         rm -rf reference
84     fi
85
86     if [ ! -d reference ]; then
87         refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG)
88         git clone --single-branch -b $REF_GIT_TAG $REF_GIT_REPO $refsrcdir
89         meson $OPTS -Dexamples= $refsrcdir $refsrcdir/build
90         ninja -C $refsrcdir/build
91         DESTDIR=$(pwd)/reference ninja -C $refsrcdir/build install
92         devtools/gen-abi.sh reference
93         find reference/usr/local -name '*.a' -delete
94         rm -rf reference/usr/local/bin
95         rm -rf reference/usr/local/share
96         echo $REF_GIT_TAG > reference/VERSION
97     fi
98
99     DESTDIR=$(pwd)/install ninja -C build install
100     devtools/gen-abi.sh install
101     devtools/check-abi.sh reference install ${ABI_CHECKS_WARN_ONLY:-}
102 fi
103
104 if [ "$RUN_TESTS" = "true" ]; then
105     sudo meson test -C build --suite fast-tests -t 3
106 fi