Skip to content

Commit

Permalink
kernel-build: add build selftests/sched_ext step
Browse files Browse the repository at this point in the history
* Update tar-artifacts.sh to include sched_ext files
* Remove copying of selftests/bpf in build_selftests.sh
  • Loading branch information
theihor committed Oct 18, 2024
1 parent 5d8a423 commit db5b57b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 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
20 changes: 16 additions & 4 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 @@ -82,7 +83,8 @@ jobs:
kbuild-output: ${{ env.KBUILD_OUTPUT }}
- uses: ./patch-kernel
with:
repo-root: '${{ github.workspace }}'
patches-root: '${{ github.workspace }}/ci/diffs'
repo-root: ${{ env.REPO_ROOT }}
- name: Setup build environment
uses: ./setup-build-env
with:
Expand All @@ -105,7 +107,7 @@ jobs:
kbuild-output: ${{ env.KBUILD_OUTPUT }}
max-make-jobs: 32
llvm-version: ${{ inputs.llvm-version }}
- name: Build selftests
- name: Build selftests/bpf
uses: ./build-selftests
with:
arch: ${{ inputs.arch }}
Expand All @@ -118,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: ./build-scx-selftests
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: ./build-samples
Expand All @@ -130,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
8 changes: 0 additions & 8 deletions build-selftests/build_selftests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ fi

foldable start build_selftests "Building selftests with $TOOLCHAIN"

LIBBPF_PATH="${REPO_ROOT}"

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})
Expand Down Expand Up @@ -59,10 +57,4 @@ make ${MAKE_OPTS} headers
make ${MAKE_OPTS} ${SELF_OPTS} clean
make ${MAKE_OPTS} ${SELF_OPTS} -j $(kernel_build_make_jobs)

cd -
mkdir "${LIBBPF_PATH}"/selftests
cp -R "${REPO_ROOT}/${REPO_PATH}/tools/testing/selftests/bpf" \
"${LIBBPF_PATH}"/selftests
cd "${LIBBPF_PATH}"

foldable end build_selftests

0 comments on commit db5b57b

Please sign in to comment.