Skip to content

Commit

Permalink
build-selftests: change action inputs to those actually required
Browse files Browse the repository at this point in the history
  • Loading branch information
theihor committed Nov 12, 2024
1 parent 766dd98 commit 9f45a6b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 37 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/kernel-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,15 @@ jobs:
llvm-version: ${{ inputs.llvm-version }}
- name: Build selftests/bpf
uses: ./build-selftests
env:
MAX_MAKE_JOBS: 32
RELEASE: ${{ inputs.release && '1' || '' }}
with:
arch: ${{ inputs.arch }}
toolchain: ${{ inputs.toolchain }}
kbuild-output: ${{ env.KBUILD_OUTPUT }}
max-make-jobs: 32
kernel-root: ${{ env.KERNEL_ROOT }}
llvm-version: ${{ inputs.llvm-version }}
env:
# RELEASE= disables all optimizaions
# RELEASE=0 adds -O0 make flag
# RELEASE=1 adds -O2 make flag
RELEASE: ${{ inputs.release && '1' || '' }}
toolchain: ${{ inputs.toolchain }}

- if: ${{ env.BUILD_SCHED_EXT_SELFTESTS }}
name: Build selftests/sched_ext
uses: ./build-scx-selftests
Expand Down
33 changes: 13 additions & 20 deletions build-selftests/action.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
name: 'build selftests'
description: 'Build BPF selftests'
inputs:
kernel:
description: 'kernel version'
default: 'LATEST'
toolchain:
description: 'what toolchain to use'
default: 'gcc'
kbuild-output:
description: 'relative or absolute path to use for storing build artifacts'
arch:
description: 'arch'
required: true
kernel-root:
description: 'Path to the root of the kernel source tree'
required: true
max-make-jobs:
description: 'Maximum number of jobs to use when running make (e.g argument to -j). Default: 4*nproc'
default: ''
llvm-version:
description: 'llvm version'
required: false
default: '16'
arch:
description: 'arch'
required: true
default: '18'
toolchain:
description: 'gcc or llvm'
default: 'gcc'

runs:
using: "composite"
steps:
- name: build selftests
shell: bash
run: |
kbuild_output="$(realpath ${{ inputs.kbuild-output }})"
export LLVM_VERSION=${{ inputs.llvm-version }}
${GITHUB_ACTION_PATH}/build_selftests.sh "${{ inputs.arch }}" "${{ inputs.kernel }}" "${{ inputs.toolchain }}" "${kbuild_output}"
env:
MAX_MAKE_JOBS: ${{ inputs.max-make-jobs }}
LLVM_VERSION: ${{ inputs.llvm-version }}
run: |
${GITHUB_ACTION_PATH}/build_selftests.sh "${{ inputs.arch }}" "${{ inputs.toolchain }}" "${{ inputs.kernel-root }}"
15 changes: 6 additions & 9 deletions build-selftests/build_selftests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ set -euo pipefail
source "${GITHUB_ACTION_PATH}/../helpers.sh"

TARGET_ARCH="$1"
KERNEL="$2"
TOOLCHAIN="$3"
export KBUILD_OUTPUT="$4"
VMLINUX_H=${VMLINUX_H:-}
TOOLCHAIN="$2"
KERNEL_ROOT="$(realpath $3)"

export KBUILD_OUTPUT="${KBUILD_OUTPUT:-${KERNEL_ROOT}}"
export VMLINUX_BTF="${VMLINUX_BTF:-${KBUILD_OUTPUT}/vmlinux}"
export VMLINUX_H="${VMLINUX_H:-}"

ARCH="$(platform_to_kernel_arch ${TARGET_ARCH})"
CROSS_COMPILE=""
Expand All @@ -25,11 +27,6 @@ fi

foldable start build_selftests "Building selftests with $TOOLCHAIN"

PREPARE_SELFTESTS_SCRIPT=$(find $GITHUB_WORKSPACE -name prepare_selftests-${KERNEL}.sh)
if [ -f "${PREPARE_SELFTESTS_SCRIPT}" ]; then
(cd "${KERNEL_ROOT}/tools/testing/selftests/bpf" && ${PREPARE_SELFTESTS_SCRIPT})
fi

MAKE_OPTS=$(cat <<EOF
ARCH=${ARCH}
CROSS_COMPILE=${CROSS_COMPILE}
Expand Down

0 comments on commit 9f45a6b

Please sign in to comment.