Files
libbpf/.github/workflows/vmtest.yml
Ihor Solodrai cd73a17321 ci: configure CI test jobs
* Don't run pahole@tmp.master + llvm-17 combination.
* Use descriptive name of for vmtest jobs
* Don't run test_progs_cpuv4 when LLVM_VERSION < 18 (same as on BPF CI)
* Add some logging to prepare-selftests-run.sh

Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me>
2024-11-18 22:00:09 -08:00

137 lines
4.5 KiB
YAML

name: 'Build kernel and selftests/bpf, run selftests via vmtest'
on:
workflow_call:
inputs:
runs_on:
required: true
default: 'ubuntu-24.04'
type: string
arch:
description: 'what arch to test'
required: true
default: 'x86_64'
type: string
kernel:
description: 'kernel version or LATEST'
required: true
default: 'LATEST'
type: string
pahole:
description: 'pahole rev or branch'
required: false
default: 'master'
type: string
llvm-version:
description: 'llvm version'
required: false
default: '18'
type: string
jobs:
vmtest:
name: llvm-${{ inputs.llvm-version }} pahole@${{ inputs.pahole }} linux-${{ inputs.kernel }}
runs-on: ${{ inputs.runs_on }}
steps:
- uses: actions/checkout@v4
- name: Setup environment
uses: theihor/libbpf-ci/setup-build-env@run-vmtest-v2
with:
pahole: ${{ inputs.pahole }}
arch: ${{ inputs.arch }}
llvm-version: ${{ inputs.llvm-version }}
- name: Get checkpoint commit
shell: bash
run: |
cat CHECKPOINT-COMMIT
echo "CHECKPOINT=$(cat CHECKPOINT-COMMIT)" >> $GITHUB_ENV
- name: Get kernel source at checkpoint
uses: theihor/libbpf-ci/get-linux-source@run-vmtest-v2
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: theihor/libbpf-ci/patch-kernel@run-vmtest-v2
with:
patches-root: '${{ github.workspace }}/ci/diffs'
repo-root: '.kernel'
- name: Configure kernel build
shell: bash
run: |
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 -
- name: Build kernel image
if: ${{ inputs.kernel == 'LATEST' }}
shell: bash
run: |
cd .kernel
make -j $((4*$(nproc))) all
cp vmlinux ${{ github.workspace }}
cd -
- name: Download prebuilt kernel
if: ${{ inputs.kernel != 'LATEST' }}
uses: theihor/libbpf-ci/download-vmlinux@run-vmtest-v2
with:
kernel: ${{ inputs.kernel }}
arch: ${{ inputs.arch }}
- name: Prepare to build selftests
shell: bash
env:
PREPARE_SCRIPT: ${{ github.workspace }}/ci/vmtest/prepare-selftests-build-${{ inputs.kernel }}.sh
SELFTESTS_BPF: ${{ github.workspace }}/.kernel/tools/testing/selftests/bpf
run: |
if [ -f "${PREPARE_SCRIPT}" ]; then
bash "${PREPARE_SCRIPT}"
fi
- name: Build selftests/bpf
uses: theihor/libbpf-ci/build-selftests@run-vmtest-v2
env:
MAX_MAKE_JOBS: 32
VMLINUX_BTF: ${{ github.workspace }}/vmlinux
VMLINUX_H: ${{ inputs.kernel != 'LATEST' && format('{0}/.github/actions/build-selftests/vmlinux.h', github.workspace) || '' }}
with:
arch: ${{ inputs.arch }}
kernel-root: ${{ github.workspace }}/.kernel
llvm-version: ${{ inputs.llvm-version }}
- name: Prepare to run selftests
env:
ALLOWLIST_FILE: /tmp/allowlist
DENYLIST_FILE: /tmp/denylist
ARCH: ${{ inputs.arch }}
KERNEL: ${{ inputs.kernel }}
LLVM_VERSION: ${{ inputs.llvm-version }}
SELFTESTS_BPF: ${{ github.workspace }}/.kernel/tools/testing/selftests/bpf
VMTEST_CONFIGS: ${{ github.workspace }}/ci/vmtest/configs
shell: bash
run: ${{ github.workspace }}/ci/vmtest/prepare-selftests-run.sh
- 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 }}