summaryrefslogtreecommitdiffstats
path: root/.github/actions/build-selftests/build_selftests.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 08:24:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 08:24:23 +0000
commit67c27783d7735af6ba22b9f031d97ca4ea56c29c (patch)
tree17770fad3c90bf420cb2470e6e51255fcbf31bf9 /.github/actions/build-selftests/build_selftests.sh
parentInitial commit. (diff)
downloadlibbpf-67c27783d7735af6ba22b9f031d97ca4ea56c29c.tar.xz
libbpf-67c27783d7735af6ba22b9f031d97ca4ea56c29c.zip
Adding upstream version 1.1.0.upstream/1.1.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '.github/actions/build-selftests/build_selftests.sh')
-rwxr-xr-x.github/actions/build-selftests/build_selftests.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/.github/actions/build-selftests/build_selftests.sh b/.github/actions/build-selftests/build_selftests.sh
new file mode 100755
index 0000000..0da1373
--- /dev/null
+++ b/.github/actions/build-selftests/build_selftests.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+set -euo pipefail
+
+THISDIR="$(cd $(dirname $0) && pwd)"
+
+source ${THISDIR}/helpers.sh
+
+foldable start prepare_selftests "Building selftests"
+
+LLVM_VER=16
+LIBBPF_PATH="${REPO_ROOT}"
+
+PREPARE_SELFTESTS_SCRIPT=${THISDIR}/prepare_selftests-${KERNEL}.sh
+if [ -f "${PREPARE_SELFTESTS_SCRIPT}" ]; then
+ (cd "${REPO_ROOT}/${REPO_PATH}/tools/testing/selftests/bpf" && ${PREPARE_SELFTESTS_SCRIPT})
+fi
+
+if [[ "${KERNEL}" = 'LATEST' ]]; then
+ VMLINUX_H=
+else
+ VMLINUX_H=${THISDIR}/vmlinux.h
+fi
+
+cd ${REPO_ROOT}/${REPO_PATH}
+make \
+ CLANG=clang-${LLVM_VER} \
+ LLC=llc-${LLVM_VER} \
+ LLVM_STRIP=llvm-strip-${LLVM_VER} \
+ VMLINUX_BTF="${VMLINUX_BTF}" \
+ VMLINUX_H=${VMLINUX_H} \
+ -C "${REPO_ROOT}/${REPO_PATH}/tools/testing/selftests/bpf" \
+ -j $((4*$(nproc))) > /dev/null
+cd -
+mkdir ${LIBBPF_PATH}/selftests
+cp -R "${REPO_ROOT}/${REPO_PATH}/tools/testing/selftests/bpf" \
+ ${LIBBPF_PATH}/selftests
+cd ${LIBBPF_PATH}
+rm selftests/bpf/.gitignore
+git add selftests
+
+foldable end prepare_selftests