3 # Builds are run as root in containers, no need for sudo
4 [ "$(id -u)" != '0' ] || alias sudo=
10 FILES_TO_PRINT="build/meson-logs/testlog.txt"
11 FILES_TO_PRINT="$FILES_TO_PRINT build/.ninja_log"
12 FILES_TO_PRINT="$FILES_TO_PRINT build/meson-logs/meson-log.txt"
13 FILES_TO_PRINT="$FILES_TO_PRINT build/gdb.log"
15 for pr_file in $FILES_TO_PRINT; do
16 if [ -e "$pr_file" ]; then
21 # We capture the error logs as artifacts in Github Actions, no need to dump
22 # them via a EXIT handler.
23 [ -n "$GITHUB_WORKFLOW" ] || trap on_error EXIT
25 install_libabigail() {
29 wget -q "http://mirrors.kernel.org/sourceware/libabigail/${version}.tar.gz"
30 tar -xf ${version}.tar.gz
31 cd $version && autoreconf -vfi && cd -
33 cd $version/build && ../configure --prefix=$instdir && cd -
34 make -C $version/build all install
39 configure_coredump() {
40 # No point in configuring coredump without gdb
41 which gdb >/dev/null || return 0
43 sudo sysctl -w kernel.core_pattern=/tmp/dpdk-core.%e.%p
47 ls /tmp/dpdk-core.*.* 2>/dev/null || return 0
48 for core in /tmp/dpdk-core.*.*; do
49 binary=$(sudo readelf -n $core |grep $(pwd)/build/ 2>/dev/null |head -n1)
50 [ -x $binary ] || binary=
51 sudo gdb $binary -c $core \
53 -ex 'thread apply all bt full' \
55 done |tee -a build/gdb.log
61 if [ "$AARCH64" = "true" ]; then
62 if [ "${CC%%clang}" != "$CC" ]; then
63 cross_file=config/arm/arm64_armv8_linux_clang_ubuntu
65 cross_file=config/arm/arm64_armv8_linux_gcc
69 if [ "$MINGW" = "true" ]; then
70 cross_file=config/x86/cross-mingw
73 if [ "$PPC64LE" = "true" ]; then
74 cross_file=config/ppc/ppc64le-power8-linux-gcc-ubuntu
77 if [ -n "$cross_file" ]; then
78 OPTS="$OPTS --cross-file $cross_file"
81 if [ "$BUILD_DOCS" = "true" ]; then
82 OPTS="$OPTS -Denable_docs=true"
85 if [ "$BUILD_32BIT" = "true" ]; then
86 OPTS="$OPTS -Dc_args=-m32 -Dc_link_args=-m32"
87 OPTS="$OPTS -Dcpp_args=-m32 -Dcpp_link_args=-m32"
88 export PKG_CONFIG_LIBDIR="/usr/lib32/pkgconfig"
91 if [ "$MINGW" = "true" ]; then
92 OPTS="$OPTS -Dexamples=helloworld"
93 elif [ "$DEF_LIB" = "static" ]; then
94 OPTS="$OPTS -Dexamples=l2fwd,l3fwd"
96 OPTS="$OPTS -Dexamples=all"
99 OPTS="$OPTS -Dplatform=generic"
100 OPTS="$OPTS --default-library=$DEF_LIB"
101 OPTS="$OPTS --buildtype=debugoptimized"
102 OPTS="$OPTS -Dcheck_includes=true"
103 if [ "$MINI" = "true" ]; then
104 OPTS="$OPTS -Denable_drivers=net/null"
105 OPTS="$OPTS -Ddisable_libs=*"
108 if [ "$ASAN" = "true" ]; then
109 OPTS="$OPTS -Db_sanitize=address"
110 if [ "${CC%%clang}" != "$CC" ]; then
111 OPTS="$OPTS -Db_lundef=false"
115 meson build --werror $OPTS
118 if [ -z "$cross_file" ]; then
121 devtools/test-null.sh || failed="true"
123 [ "$failed" != "true" ]
126 if [ "$ABI_CHECKS" = "true" ]; then
127 if [ "$(cat libabigail/VERSION 2>/dev/null)" != "$LIBABIGAIL_VERSION" ]; then
129 # if we change libabigail, invalidate existing abi cache
133 if [ ! -d libabigail ]; then
134 install_libabigail "$LIBABIGAIL_VERSION" $(pwd)/libabigail
135 echo $LIBABIGAIL_VERSION > libabigail/VERSION
138 export PATH=$(pwd)/libabigail/bin:$PATH
140 REF_GIT_REPO=${REF_GIT_REPO:-https://dpdk.org/git/dpdk}
142 if [ "$(cat reference/VERSION 2>/dev/null)" != "$REF_GIT_TAG" ]; then
146 if [ ! -d reference ]; then
147 refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG)
148 git clone --single-branch -b "$REF_GIT_TAG" $REF_GIT_REPO $refsrcdir
149 meson $OPTS -Dexamples= $refsrcdir $refsrcdir/build
150 ninja -C $refsrcdir/build
151 DESTDIR=$(pwd)/reference ninja -C $refsrcdir/build install
152 devtools/gen-abi.sh reference
153 find reference/usr/local -name '*.a' -delete
154 rm -rf reference/usr/local/bin
155 rm -rf reference/usr/local/share
156 echo $REF_GIT_TAG > reference/VERSION
159 DESTDIR=$(pwd)/install ninja -C build install
160 devtools/gen-abi.sh install
161 devtools/check-abi.sh reference install ${ABI_CHECKS_WARN_ONLY:-}
164 if [ "$RUN_TESTS" = "true" ]; then
167 sudo meson test -C build --suite fast-tests -t 3 || failed="true"
169 [ "$failed" != "true" ]