Skip to content

Commit

Permalink
kernel-build: add build selftests/sched_ext step
Browse files Browse the repository at this point in the history
  • Loading branch information
theihor committed Oct 18, 2024
1 parent 99aee90 commit 5e735b6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
12 changes: 8 additions & 4 deletions .github/scripts/tar-artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ fi

arch="${1}"
toolchain="${2}"
archive_make_helpers="${3:-0}"

# Convert a platform (as returned by uname -m) to the kernel
# arch (as expected by ARCH= env).
Expand All @@ -40,7 +39,7 @@ platform_to_kernel_arch() {
# Remove intermediate object files that we have no use for. Ideally
# we'd just exclude them from tar below, but it does not provide
# options to express the precise constraints.
find selftests/ -name "*.o" -a ! -name "*.bpf.o" -print0 | \
find tools/testing/selftests/ -name "*.o" -a ! -name "*.bpf.o" -print0 | \
xargs --null --max-args=10000 rm

# Strip debug information, which is excessively large (consuming
Expand Down Expand Up @@ -74,7 +73,7 @@ for file in "${kbuild_output_file_list[@]}"; do
done

additional_file_list=()
if [ $archive_make_helpers -ne 0 ]; then
if [[ -n "${ARCHIVE_MAKE_HELPERS}" ]]; then
# Package up a bunch of additional infrastructure to support running
# 'make kernelrelease' and bpf tool checks later on.
mapfile -t additional_file_list < <(find . -iname Makefile)
Expand All @@ -86,6 +85,11 @@ if [ $archive_make_helpers -ne 0 ]; then
)
fi

mkdir -p selftests
cp -r tools/testing/selftests/bpf selftests
if [[ -n "${BUILD_SCHED_EXT_SELFTESTS}" ]]; then
cp -r tools/testing/selftests/sched_ext selftests
fi

tar -cf - \
kbuild-output \
Expand All @@ -94,7 +98,7 @@ tar -cf - \
--exclude '*.d' \
--exclude '*.h' \
--exclude '*.output' \
selftests/bpf/ \
selftests/ \
| zstd -T0 -19 -o "vmlinux-${arch}-${toolchain}.tar.zst"

# Cleanup and restore the original KBUILD_OUTPUT
Expand Down
31 changes: 25 additions & 6 deletions .github/workflows/kernel-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
runs-on: ${{ fromJSON(inputs.runs_on) }}
timeout-minutes: 100
env:
ARCHIVE_MAKE_HELPERS: ${{ github.repository != 'kernel-patches/bpf' && '1' || '0' }}
ARCHIVE_MAKE_HELPERS: ${{ github.repository != 'kernel-patches/bpf' && 'true' || '' }}
KERNEL: ${{ inputs.kernel }}
REPO_ROOT: ${{ github.workspace }}
REPO_PATH: ""
Expand All @@ -55,6 +55,7 @@ jobs:
|| github.base_ref
|| 'bpf-next'
}}
BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
steps:
- uses: actions/checkout@v4
# We fetch an actual bit of history here to facilitate incremental
Expand Down Expand Up @@ -83,23 +84,31 @@ jobs:
- uses: libbpf/ci/patch-kernel@v1
with:
patches-root: '${{ github.workspace }}/ci/diffs'
repo-root: '${{ github.workspace }}'
repo-root: ${{ env.REPO_ROOT }}
- name: Setup build environment
uses: libbpf/ci/setup-build-env@v1
with:
arch: ${{ inputs.arch }}
llvm-version: ${{ inputs.llvm-version }}
pahole: c2f89dab3f2b0ebb53bab3ed8be32f41cb743c37
- name: Print toolchain version used
shell: bash
run: |
TOOLCHAIN=${{ inputs.toolchain }}
if [ $TOOLCHAIN = "llvm" ]; then
TOOLCHAIN="clang-${{ inputs.llvm-version }}"
fi
${TOOLCHAIN} --version
- name: Build kernel image
uses: libbpf/ci/build-linux@v1
uses: theihor/libbpf-ci/build-linux@build-scx
with:
arch: ${{ inputs.arch }}
toolchain: ${{ inputs.toolchain }}
kbuild-output: ${{ env.KBUILD_OUTPUT }}
max-make-jobs: 32
llvm-version: ${{ inputs.llvm-version }}
- name: Build selftests
uses: libbpf/ci/build-selftests@v1
- name: Build selftests/bpf
uses: theihor/libbpf-ci/build-selftests@build-scx
with:
arch: ${{ inputs.arch }}
toolchain: ${{ inputs.toolchain }}
Expand All @@ -111,6 +120,16 @@ jobs:
# RELEASE=0 adds -O0 make flag
# RELEASE=1 adds -O2 make flag
RELEASE: ${{ inputs.release && '1' || '' }}
- if: ${{ env.BUILD_SCHED_EXT_SELFTESTS }}
name: Build selftests/sched_ext
uses: theihor/libbpf-ci/build-scx-selftests@build-scx
with:
kbuild-output: ${{ env.KBUILD_OUTPUT }}
repo-root: ${{ env.REPO_ROOT }}
arch: ${{ inputs.arch }}
toolchain: ${{ inputs.toolchain }}
llvm-version: ${{ inputs.llvm-version }}
max-make-jobs: 32
- if: ${{ github.event_name != 'push' }}
name: Build samples
uses: libbpf/ci/build-samples@v1
Expand All @@ -123,7 +142,7 @@ jobs:
- name: Tar artifacts
working-directory: ${{ env.REPO_ROOT }}
run: |
bash .github/scripts/tar-artifact.sh ${{ inputs.arch }} ${{ inputs.toolchain_full }} ${{ env.ARCHIVE_MAKE_HELPERS }}
bash .github/scripts/tar-artifact.sh ${{ inputs.arch }} ${{ inputs.toolchain_full }}
- if: ${{ github.event_name != 'push' }}
name: Remove KBUILD_OUTPUT content
shell: bash
Expand Down

0 comments on commit 5e735b6

Please sign in to comment.