Skip to content

Commit

Permalink
kernel-build: build GCC BPF test runner on x86_64
Browse files Browse the repository at this point in the history
When BUILD_BPF_GCC is set in kernel-build, GCC BPF will be built and
BPF_GCC variable set for build-selftests. When BPF_GCC is set,
test_progs-bpf_gcc runner is built in selftests/bpf.

If test_progs-bpf_gcc is specified in KERNEL_TEST, it will be executed
by run-vmtest action.

Signed-off-by: Ihor Solodrai <[email protected]>
  • Loading branch information
theihor committed Jan 16, 2025
1 parent e89493a commit 236da0f
Show file tree
Hide file tree
Showing 4 changed files with 924 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/kernel-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ jobs:
timeout-minutes: 100
env:
ARTIFACTS_ARCHIVE: "vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst"

BUILD_BPF_GCC: ${{ inputs.arch == 'x86_64' && 'true' || '' }}
BPF_GCC_INSTALL_DIR: ${{ github.workspace }}/bpf-gcc

BPF_NEXT_BASE_BRANCH: 'master'
BPF_NEXT_FETCH_DEPTH: 64 # A bit of history is needed to facilitate incremental builds
BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
Expand Down Expand Up @@ -107,11 +111,19 @@ jobs:
kbuild-output: ${{ env.KBUILD_OUTPUT }}
max-make-jobs: 32
llvm-version: ${{ inputs.llvm-version }}

- if: ${{ env.BUILD_BPF_GCC }}
name: Build GCC for BPF selftests
uses: ./build-bpf-gcc
with:
install-dir: ${{ env.BPF_GCC_INSTALL_DIR }}

- name: Build selftests/bpf
uses: ./build-selftests
env:
MAX_MAKE_JOBS: 32
RELEASE: ${{ inputs.release && '1' || '' }}
BPF_GCC: ${{ env.BUILD_BPF_GCC && env.BPF_GCC_INSTALL_DIR || '' }}
with:
arch: ${{ inputs.arch }}
kernel-root: ${{ env.KERNEL_ROOT }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- {"test": "test_progs_no_alu32", "continue_on_error": false, "timeout_minutes": 360}
- {"test": "test_verifier", "continue_on_error": false, "timeout_minutes": 360}
- {"test": "test_maps", "continue_on_error": false, "timeout_minutes": 360}
- {"test": "test_progs-bpf_gcc", "continue_on_error": false, "timeout_minutes": 360}
# Uncomment this to enable sched_ext selftests jobs
# - {"test": "sched_ext", "continue_on_error": false, "timeout_minutes": 360}
fail-fast: false
Expand Down
7 changes: 7 additions & 0 deletions build-selftests/build_selftests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@ if [[ $TOOLCHAIN = "llvm" ]]; then
TOOLCHAIN="llvm-$LLVM_VERSION"
fi

if [ -n "${BPF_GCC:-}" ]; then
BPF_GCC="${BPF_GCC}/bin/bpf-unknown-none-gcc"
else
BPF_GCC=
fi

foldable start build_selftests "Building selftests with $TOOLCHAIN"

MAKE_OPTS=$(cat <<EOF
ARCH=${ARCH}
BPF_GCC=${BPF_GCC}
CROSS_COMPILE=${CROSS_COMPILE}
CLANG=clang-${LLVM_VERSION}
LLC=llc-${LLVM_VERSION}
Expand Down
Loading

0 comments on commit 236da0f

Please sign in to comment.