diff --git a/.github/actions/build-selftests/action.yml b/.github/actions/build-selftests/action.yml deleted file mode 100644 index 7874229..0000000 --- a/.github/actions/build-selftests/action.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: 'build-selftests' -description: 'Build BPF selftests' -inputs: - repo-path: - description: 'where is the source code' - required: true - kernel: - description: 'kernel version or LATEST' - required: true - default: 'LATEST' - vmlinux: - description: 'where is vmlinux file' - required: true - default: '${{ github.workspace }}/vmlinux' - llvm-version: - description: 'llvm version' - required: true - -runs: - using: "composite" - steps: - - shell: bash - run: | - source $GITHUB_ACTION_PATH/../../../ci/vmtest/helpers.sh - foldable start "Setup Env" - sudo apt-get install -y qemu-kvm zstd binutils-dev elfutils libcap-dev libelf-dev libdw-dev python3-docutils - foldable end - - shell: bash - run: | - export KERNEL=${{ inputs.kernel }} - export REPO_ROOT="${{ github.workspace }}" - export REPO_PATH="${{ inputs.repo-path }}" - export VMLINUX_BTF="${{ inputs.vmlinux }}" - export LLVM_VERSION="${{ inputs.llvm-version }}" - - ${{ github.action_path }}/build_selftests.sh diff --git a/.github/actions/build-selftests/build_selftests.sh b/.github/actions/build-selftests/build_selftests.sh deleted file mode 100755 index 3b46b77..0000000 --- a/.github/actions/build-selftests/build_selftests.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -THISDIR="$(cd $(dirname $0) && pwd)" - -source ${THISDIR}/helpers.sh - -foldable start prepare_selftests "Building selftests" - -llvm_latest_version() { - echo "19" -} - -if [[ "${LLVM_VERSION}" == $(llvm_latest_version) ]]; then - REPO_DISTRO_SUFFIX="" -else - REPO_DISTRO_SUFFIX="-${LLVM_VERSION}" -fi - -DISTRIB_CODENAME="noble" -test -f /etc/lsb-release && . /etc/lsb-release -echo "${DISTRIB_CODENAME}" - -echo "deb https://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}${REPO_DISTRO_SUFFIX} main" \ - | sudo tee /etc/apt/sources.list.d/llvm.list - -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 headers -make \ - KBUILD_MODPOST_WARN=1 \ - CLANG=clang-${LLVM_VERSION} \ - LLC=llc-${LLVM_VERSION} \ - LLVM_STRIP=llvm-strip-${LLVM_VERSION} \ - VMLINUX_BTF="${VMLINUX_BTF}" \ - VMLINUX_H=${VMLINUX_H} \ - -C "${REPO_ROOT}/${REPO_PATH}/tools/testing/selftests/bpf" \ - -j $((4*$(nproc))) > /dev/null -cd - - -mkdir ${GITHUB_WORKSPACE}/selftests -cp -R "${REPO_ROOT}/${REPO_PATH}/tools/testing/selftests/bpf" \ - ${GITHUB_WORKSPACE}/selftests - -foldable end prepare_selftests diff --git a/.github/actions/build-selftests/helpers.sh b/.github/actions/build-selftests/helpers.sh deleted file mode 100644 index c44d098..0000000 --- a/.github/actions/build-selftests/helpers.sh +++ /dev/null @@ -1,38 +0,0 @@ -# shellcheck shell=bash - -# $1 - start or end -# $2 - fold identifier, no spaces -# $3 - fold section description -foldable() { - local YELLOW='\033[1;33m' - local NOCOLOR='\033[0m' - if [ $1 = "start" ]; then - line="::group::$2" - if [ ! -z "${3:-}" ]; then - line="$line - ${YELLOW}$3${NOCOLOR}" - fi - else - line="::endgroup::" - fi - echo -e "$line" -} - -__print() { - local TITLE="" - if [[ -n $2 ]]; then - TITLE=" title=$2" - fi - echo "::$1${TITLE}::$3" -} - -# $1 - title -# $2 - message -print_error() { - __print error $1 $2 -} - -# $1 - title -# $2 - message -print_notice() { - __print notice $1 $2 -} diff --git a/.github/actions/build-selftests/prepare_selftests-4.9.0.sh b/.github/actions/build-selftests/prepare_selftests-4.9.0.sh deleted file mode 100755 index be192c3..0000000 --- a/.github/actions/build-selftests/prepare_selftests-4.9.0.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -printf "all:\n\ttouch bpf_testmod.ko\n\nclean:\n" > bpf_testmod/Makefile -printf "all:\n\ttouch bpf_test_no_cfi.ko\n\nclean:\n" > bpf_test_no_cfi/Makefile - diff --git a/.github/actions/build-selftests/prepare_selftests-5.5.0.sh b/.github/actions/build-selftests/prepare_selftests-5.5.0.sh deleted file mode 100755 index be192c3..0000000 --- a/.github/actions/build-selftests/prepare_selftests-5.5.0.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -printf "all:\n\ttouch bpf_testmod.ko\n\nclean:\n" > bpf_testmod/Makefile -printf "all:\n\ttouch bpf_test_no_cfi.ko\n\nclean:\n" > bpf_test_no_cfi/Makefile - diff --git a/.github/actions/vmtest/action.yml b/.github/actions/vmtest/action.yml deleted file mode 100644 index 116515a..0000000 --- a/.github/actions/vmtest/action.yml +++ /dev/null @@ -1,142 +0,0 @@ -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: theihor/libbpf-ci/setup-build-env@run-vmtest-v2 - 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: 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: | - 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: 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 }} - 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 - - # 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 }} diff --git a/.github/workflows/ondemand.yml b/.github/workflows/ondemand.yml index c76dd8a..5f3034f 100644 --- a/.github/workflows/ondemand.yml +++ b/.github/workflows/ondemand.yml @@ -3,34 +3,29 @@ name: ondemand on: workflow_dispatch: inputs: - kernel-origin: - description: 'git repo for linux kernel' - default: 'https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git' + arch: + default: 'x86_64' required: true - kernel-rev: - description: 'rev/tag/branch for linux kernel' + llvm-version: + default: '18' + required: true + kernel: + default: 'LATEST' + required: true + pahole: default: "master" required: true - pahole-origin: - description: 'git repo for pahole' - default: 'https://git.kernel.org/pub/scm/devel/pahole/pahole.git' - required: true - pahole-rev: - description: 'ref/tag/branch for pahole' - default: "master" + runs-on: + default: 'ubuntu-24.04' required: true jobs: vmtest: - runs-on: ubuntu-latest - name: vmtest with customized pahole/Kernel - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup - - uses: ./.github/actions/vmtest - with: - kernel: 'LATEST' - kernel-rev: ${{ github.event.inputs.kernel-rev }} - kernel-origin: ${{ github.event.inputs.kernel-origin }} - pahole: ${{ github.event.inputs.pahole-rev }} - pahole-origin: ${{ github.event.inputs.pahole-origin }} + name: ${{ inputs.kernel }} kernel llvm-${{ inputs.llvm-version }} pahole@${{ inputs.pahole }} + uses: ./.github/workflows/vmtest.yml + with: + runs_on: ${{ inputs.runs-on }} + kernel: ${{ inputs.kernel }} + arch: ${{ inputs.arch }} + llvm-version: ${{ inputs.llvm-version }} + pahole: ${{ inputs.pahole }} diff --git a/.github/workflows/pahole.yml b/.github/workflows/pahole.yml deleted file mode 100644 index 3034dda..0000000 --- a/.github/workflows/pahole.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: pahole-staging - -on: - workflow_dispatch: - schedule: - - cron: '0 18 * * *' - -jobs: - vmtest: - runs-on: ubuntu-20.04 - name: Kernel LATEST + staging pahole - env: - STAGING: tmp.master - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup - - uses: ./.github/actions/vmtest - with: - kernel: LATEST - pahole: $STAGING diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d3d02e..758142d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,12 +15,11 @@ jobs: strategy: fail-fast: false matrix: - include: - - kernel: 'LATEST' - runs_on: ubuntu-24.04 - arch: 'x86_64' - llvm-version: '18' - pahole: 'master' + arch: ['x86_64'] + kernel: ['LATEST'] + llvm-version: ['17', '18'] + pahole: ['master', 'tmp.master'] + runs_on: ['ubuntu-24.04'] name: ${{ matrix.kernel }} kernel llvm-${{ matrix.llvm-version }} pahole@${{ matrix.pahole }} uses: ./.github/workflows/vmtest.yml with: