Skip to content

Commit

Permalink
Add build-scx-selftests action
Browse files Browse the repository at this point in the history
  • Loading branch information
theihor committed Oct 16, 2024
1 parent f605c62 commit de42a5a
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
1 change: 1 addition & 0 deletions build-linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ cat_kernel_config() {
cat ${GITHUB_WORKSPACE}/tools/testing/selftests/bpf/config \
${GITHUB_WORKSPACE}/tools/testing/selftests/bpf/config.vm \
${GITHUB_WORKSPACE}/tools/testing/selftests/bpf/config.${TARGET_ARCH} \
${GITHUB_WORKSPACE}/tools/testing/selftests/sched_ext/config \
${GITHUB_WORKSPACE}/ci/vmtest/configs/config \
${GITHUB_WORKSPACE}/ci/vmtest/configs/config.${TARGET_ARCH} 2> /dev/null > "${1}"
}
Expand Down
34 changes: 34 additions & 0 deletions build-scx-selftests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'build selftests'
description: 'Build selftests/sched_ext'
inputs:
kbuild-output:
description: 'relative or absolute path to use for storing build artifacts'
required: true
arch:
description: 'arch'
required: true
toolchain:
description: 'what toolchain to use'
default: 'gcc'
required: true
repo-root:
description: "Path to the root of the kernel repository. Default: github.workspace"
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'

runs:
using: "composite"
steps:
- name: build selftests/sched_ext
env:
KBUILD_OUTPUT: ${{ inputs.kbuild-output }}
MAX_MAKE_JOBS: ${{ inputs.max-make-jobs }}
REPO_ROOT: ${{ inputs.repo-root || github.workspace }}
shell: bash
run:
${GITHUB_ACTION_PATH}/build.sh "${{ inputs.arch }}" "${{ inputs.toolchain }}" "${{ inputs.llvm-version }}"
43 changes: 43 additions & 0 deletions build-scx-selftests/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -euo pipefail

source "${GITHUB_ACTION_PATH}/../helpers.sh"

TARGET_ARCH=$1
TOOLCHAIN=$2
LLVM_VERSION=$3

ARCH="$(platform_to_kernel_arch ${TARGET_ARCH})"
CROSS_COMPILE=""

if [[ "${TARGET_ARCH}" != "$(uname -m)" ]]
then
CROSS_COMPILE="${TARGET_ARCH}-linux-gnu-"
fi

if [[ $TOOLCHAIN = "llvm" ]]; then
export LLVM="-$LLVM_VERSION"
TOOLCHAIN="llvm-$LLVM_VERSION"
fi

foldable start build_selftests "Building selftests/sched_ext with $TOOLCHAIN"

MAKE_OPTS=$(cat <<EOF
ARCH=${ARCH}
CROSS_COMPILE=${CROSS_COMPILE}
CLANG=clang-${LLVM_VERSION}
VMLINUX_BTF=${KBUILD_OUTPUT}/vmlinux
EOF
)
SELF_OPTS=$(cat <<EOF
-C ${REPO_ROOT}/tools/testing/selftests/sched_ext
EOF
)

cd ${REPO_ROOT}
make ${MAKE_OPTS} ${SELF_OPTS} clean
make ${MAKE_OPTS} ${SELF_OPTS} -j $(kernel_build_make_jobs)

foldable end build_selftests

0 comments on commit de42a5a

Please sign in to comment.