mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-13 21:09:07 +08:00
146 lines
5.2 KiB
YAML
146 lines
5.2 KiB
YAML
name: 'vmtest'
|
|
description: 'Build + run vmtest'
|
|
inputs:
|
|
kernel:
|
|
description: 'kernel version or LATEST'
|
|
required: true
|
|
default: 'LATEST'
|
|
arch:
|
|
description: 'what arch to test'
|
|
required: true
|
|
default: 'x86_64'
|
|
pahole:
|
|
description: 'pahole rev or master'
|
|
required: true
|
|
default: 'master'
|
|
llvm-version:
|
|
description: 'llvm version'
|
|
required: false
|
|
default: '17'
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
# Allow CI user to access /dev/kvm (via qemu) w/o group change/relogin
|
|
# by changing permissions set by udev.
|
|
- name: Set /dev/kvm permissions
|
|
shell: bash
|
|
run: |
|
|
if [ -e /dev/kvm ]; then
|
|
echo "/dev/kvm exists"
|
|
if [ $(id -u) != 0 ]; then
|
|
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
|
|
| sudo tee /etc/udev/rules.d/99-kvm4all.rules > /dev/null
|
|
sudo udevadm control --reload-rules
|
|
sudo udevadm trigger --name-match=kvm
|
|
fi
|
|
else
|
|
echo "/dev/kvm does not exist"
|
|
fi
|
|
# setup environment
|
|
- name: Setup environment
|
|
uses: libbpf/ci/setup-build-env@main
|
|
with:
|
|
pahole: ${{ inputs.pahole }}
|
|
arch: ${{ inputs.arch }}
|
|
llvm-version: ${{ inputs.llvm-version }}
|
|
# 1. download CHECKPOINT kernel source
|
|
- name: Get checkpoint commit
|
|
shell: bash
|
|
run: |
|
|
cat CHECKPOINT-COMMIT
|
|
echo "CHECKPOINT=$(cat CHECKPOINT-COMMIT)" >> $GITHUB_ENV
|
|
- name: Get kernel source at checkpoint
|
|
uses: libbpf/ci/get-linux-source@main
|
|
with:
|
|
repo: 'https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git'
|
|
rev: ${{ env.CHECKPOINT }}
|
|
dest: '${{ github.workspace }}/.kernel'
|
|
- name: Patch kernel source
|
|
uses: libbpf/ci/patch-kernel@main
|
|
with:
|
|
patches-root: '${{ github.workspace }}/ci/diffs'
|
|
repo-root: '.kernel'
|
|
- name: Prepare to build BPF selftests
|
|
shell: bash
|
|
run: |
|
|
source $GITHUB_ACTION_PATH/../../../ci/vmtest/helpers.sh
|
|
foldable start "Prepare building selftest"
|
|
cd .kernel
|
|
cat tools/testing/selftests/bpf/config \
|
|
tools/testing/selftests/bpf/config.${{ inputs.arch }} > .config
|
|
# this file might or mihgt not exist depending on kernel version
|
|
cat tools/testing/selftests/bpf/config.vm >> .config || :
|
|
make olddefconfig && make prepare
|
|
cd -
|
|
foldable end
|
|
# 2. if kernel == LATEST, build kernel image from tree
|
|
- name: Build kernel image
|
|
if: ${{ inputs.kernel == 'LATEST' }}
|
|
shell: bash
|
|
run: |
|
|
source $GITHUB_ACTION_PATH/../../../ci/vmtest/helpers.sh
|
|
foldable start "Build Kernel Image"
|
|
cd .kernel
|
|
make -j $((4*$(nproc))) all > /dev/null
|
|
cp vmlinux ${{ github.workspace }}
|
|
cd -
|
|
foldable end
|
|
# else, just download prebuilt kernel image
|
|
- name: Download prebuilt kernel
|
|
if: ${{ inputs.kernel != 'LATEST' }}
|
|
uses: libbpf/ci/download-vmlinux@main
|
|
with:
|
|
kernel: ${{ inputs.kernel }}
|
|
arch: ${{ inputs.arch }}
|
|
# 3. build selftests
|
|
- name: Build BPF selftests
|
|
uses: ./.github/actions/build-selftests
|
|
with:
|
|
repo-path: '.kernel'
|
|
kernel: ${{ inputs.kernel }}
|
|
llvm-version: ${{ inputs.llvm-version }}
|
|
|
|
- name: Prepare to run selftests
|
|
env:
|
|
ALLOWLIST_FILE: /tmp/allowlist
|
|
DENYLIST_FILE: /tmp/denylist
|
|
KERNEL: ${{ inputs.kernel }}
|
|
SELFTESTS_BPF: ${{ github.workspace }}/selftests/bpf
|
|
VMTEST_CONFIGS: ${{ github.workspace }}/ci/vmtest/configs
|
|
shell: bash
|
|
run: |
|
|
cat "${SELFTESTS_BPF}/ALLOWLIST" \
|
|
"${SELFTESTS_BPF}/ALLOWLIST.${ARCH}" \
|
|
"${VMTEST_CONFIGS}/ALLOWLIST" \
|
|
"${VMTEST_CONFIGS}/ALLOWLIST-${KERNEL}" \
|
|
"${VMTEST_CONFIGS}/ALLOWLIST-${KERNEL}.${ARCH}" \
|
|
2> /dev/null > "${ALLOWLIST_FILE}" || true
|
|
|
|
cat "${SELFTESTS_BPF}/DENYLIST" \
|
|
"${SELFTESTS_BPF}/DENYLIST.${ARCH}" \
|
|
"${VMTEST_CONFIGS}/DENYLIST" \
|
|
"${VMTEST_CONFIGS}/DENYLIST-${KERNEL}" \
|
|
"${VMTEST_CONFIGS}/DENYLIST-${KERNEL}.${ARCH}" \
|
|
2> /dev/null > "${DENYLIST_FILE}" || true
|
|
|
|
if [[ "${{ inputs.kernel }}" == "4.9.0" ]]; then
|
|
echo "KERNEL_TEST=test_progs_no_alu32" >> $GITHUB_ENV
|
|
elif [[ "${{ inputs.kernel }}" == "5.5.0" ]]; then
|
|
echo "KERNEL_TEST=test_progs test_progs_no_alu32" >> $GITHUB_ENV
|
|
fi
|
|
|
|
# 4. Run selftest via vmtest tool (https://github.com/danobi/vmtest)
|
|
- name: Run selftests
|
|
env:
|
|
ALLOWLIST_FILE: /tmp/allowlist
|
|
DENYLIST_FILE: /tmp/denylist
|
|
KERNEL: ${{ inputs.kernel }}
|
|
VMLINUX: ${{ github.workspace }}/vmlinux
|
|
uses: theihor/libbpf-ci/run-vmtest@run-vmtest-v2
|
|
with:
|
|
arch: ${{ inputs.arch }}
|
|
kbuild-output: ${{ github.workspace }}/.kernel
|
|
kernel-root: ${{ github.workspace }}/.kernel
|
|
kernel-test: ${{ env.KERNEL_TEST }}
|
|
vmlinuz: ${{ inputs.arch }}/vmlinuz-${{ inputs.kernel }}
|