diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index f2991e19..675c089d 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - master + - main jobs: shellcheck: diff --git a/.github/workflows/scripts_tests.yml b/.github/workflows/scripts_tests.yml index 4cac0a1e..9caad9e5 100644 --- a/.github/workflows/scripts_tests.yml +++ b/.github/workflows/scripts_tests.yml @@ -5,7 +5,7 @@ on: pull_request: push: branches: - - master + - main jobs: test_run_vmtest: diff --git a/.github/workflows/test-prepare-incremental-build-action.yml b/.github/workflows/test-prepare-incremental-build-action.yml deleted file mode 100644 index 8137d117..00000000 --- a/.github/workflows/test-prepare-incremental-build-action.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Workflow to test prepare-incremental-build action - -on: - push: - paths: - - 'prepare-incremental-build/**' - - '.github/**' - workflow_dispatch: - inputs: - arch: - required: true - type: string - default: x86_64 - toolchain_full: - required: true - type: string - default: llvm-17 - runs_on: - required: true - type: string - default: ubuntu-24.04 - kernel-repo: - required: true - type: string - default: kernel-patches/bpf - kernel-branch: - required: true - type: string - default: bpf-next - -jobs: - test-job: - name: Test prepare-incremental-build action - runs-on: ${{ inputs.runs_on || 'ubuntu-24.04' }} - timeout-minutes: 100 - env: - ARCH: ${{ inputs.arch || 'x86_64' }} - TOOLCHAIN_FULL: ${{ inputs.toolchain_full || 'llvm-17' }} - KERNEL_REPO: ${{ inputs.kernel-repo || 'kernel-patches/bpf' }} - KERNEL_BRANCH: ${{ inputs.kernel-branch || 'bpf-next' }} - REPO_ROOT: ${{ github.workspace }}/linux - KBUILD_OUTPUT: ${{ github.workspace }}/kbuild-output - steps: - - - uses: actions/checkout@v4 - name: Checkout libbpf/ci - - - uses: actions/checkout@v4 - name: Checkout ${{ env.KERNEL_REPO }} - with: - repository: ${{ env.KERNEL_REPO }} - path: ${{ env.REPO_ROOT }} - - - name: Run prepare-incremental-build action - uses: ./prepare-incremental-build - with: - repo-root: ${{ env.REPO_ROOT }} - base-branch: ${{ env.KERNEL_BRANCH }} - arch: ${{ env.ARCH }} - toolchain_full: ${{ env.TOOLCHAIN_FULL }} - kbuild-output: ${{ env.KBUILD_OUTPUT }} - cache-key-prefix: 'test-prepare-incremental-build-action' - - - name: Put something in KBUILD_OUTPUT to trigger caching - shell: bash - run: | - mkdir -p $KBUILD_OUTPUT/path/to - echo "$ARCH $TOOLCHAIN_FULL $KERNEL" > $KBUILD_OUTPUT/path/to/output.txt - diff --git a/ci/vmtest/configs/SPLAT_ALLOWLIST b/ci/vmtest/configs/SPLAT_ALLOWLIST index 0c23bfb3..ef22209a 100644 --- a/ci/vmtest/configs/SPLAT_ALLOWLIST +++ b/ci/vmtest/configs/SPLAT_ALLOWLIST @@ -19,3 +19,15 @@ WARNING: Unprivileged eBPF is enabled # https://lore.kernel.org/all/20260812-hello_world-v1-1-c3c2ddcb362d@meta.com/ # Delete this entry once that fix reaches the CI kernel. BUG: KASAN: stack-out-of-bounds in (stack_trace_consume_entry|filter_irq_stacks)\+ + +# Ignore the KASAN splats generated by KASAN-for-JIT selftests: those are +# expected to trigger many splats to validate that the KASAN +# instrumentation is properly inserted in JITed programs. +BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_(st|ld)(x)?(_not)?_on_stack\+ +BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_simple_atomic(_fetch)?(_not)?_on_stack\+ +BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_ldx_patched(_not)?_on_stack\+ +BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_(load_acquire|store_release)(_not)?_on_stack\+ +BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_verifier_paths_stack_and_non_stack\+ +BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_ldx_oob\+ +BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_st_blinded\+ +BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_ldx_self_alias_on_stack\+ diff --git a/ci/vmtest/configs/run_veristat.cilium.cfg b/ci/vmtest/configs/run_veristat.cilium.cfg deleted file mode 100644 index a9e78676..00000000 --- a/ci/vmtest/configs/run_veristat.cilium.cfg +++ /dev/null @@ -1,3 +0,0 @@ -VERISTAT_OBJECTS_DIR="${CILIUM_BUILD_OUTPUT}/bpf" -VERISTAT_OBJECTS_GLOB="*.o" -VERISTAT_OUTPUT="veristat-cilium" diff --git a/ci/vmtest/configs/run_veristat.kernel.cfg b/ci/vmtest/configs/run_veristat.kernel.cfg deleted file mode 100644 index 807efc25..00000000 --- a/ci/vmtest/configs/run_veristat.kernel.cfg +++ /dev/null @@ -1,4 +0,0 @@ -VERISTAT_OBJECTS_DIR="${SELFTESTS_BPF}" -VERISTAT_OBJECTS_GLOB="*.bpf.o" -VERISTAT_CFG_FILE="${SELFTESTS_BPF}/veristat.cfg" -VERISTAT_OUTPUT="veristat-kernel" diff --git a/ci/vmtest/configs/run_veristat.meta.cfg b/ci/vmtest/configs/run_veristat.meta.cfg deleted file mode 100644 index 14f08d24..00000000 --- a/ci/vmtest/configs/run_veristat.meta.cfg +++ /dev/null @@ -1,4 +0,0 @@ -VERISTAT_OBJECTS_DIR="${WORKING_DIR}/bpf_objects" -VERISTAT_OBJECTS_GLOB="*.o" -VERISTAT_OUTPUT="veristat-meta" -VERISTAT_CFG_FILE="${VERISTAT_CONFIGS}/veristat_meta.cfg" diff --git a/ci/vmtest/configs/run_veristat.scx.cfg b/ci/vmtest/configs/run_veristat.scx.cfg deleted file mode 100644 index bf289c00..00000000 --- a/ci/vmtest/configs/run_veristat.scx.cfg +++ /dev/null @@ -1,3 +0,0 @@ -VERISTAT_OBJECTS_DIR="${SCX_BUILD_OUTPUT}/bpf" -VERISTAT_OBJECTS_GLOB="*.bpf.o" -VERISTAT_OUTPUT="veristat-scx" diff --git a/prepare-incremental-build/README.md b/prepare-incremental-build/README.md index 91a91a8a..bb2f6b6f 100644 --- a/prepare-incremental-build/README.md +++ b/prepare-incremental-build/README.md @@ -1,5 +1,3 @@ -[![Action test](https://github.com/libbpf/ci/actions/workflows/test-prepare-incremental-build-action.yml/badge.svg)](https://github.com/libbpf/ci/actions/workflows/test-prepare-incremental-build-action.yml) - # Prepare incremental build This action uses [actions/cache](https://github.com/actions/cache) in combination with custom scripts to save kernel build output from previous workflow runs to faciliate incremental builds. diff --git a/run-vmtest/README.md b/run-vmtest/README.md index 2617526d..7111385c 100644 --- a/run-vmtest/README.md +++ b/run-vmtest/README.md @@ -19,6 +19,12 @@ In summary the action performs the following: Note that behavior of the running scripts is tunable mostly by the environment variables. +`VMTEST_SCRIPT` selects a custom guest entrypoint. Configuration from +`run-vmtest.env` is loaded before selecting the script. BPF selftest preparation, +bpftool checks, and JSON summaries run only for `run-bpf-selftests.sh`. Custom +scripts share VM setup and exitstatus collection, and provide their own workload +setup and results. + ## Required inputs * `arch` - Target architecture @@ -35,7 +41,7 @@ environment variables. * if not specified, `$VMLINUZ` var is checked * if `$VMLINUZ` is not set, the script will attempt to run `make -s image_name` to find the image -* `output-dir` - path for test runner summaries and veristat output +* `output-dir` - path for test runner summaries * `kbuild-output` (default: `./kbuild-output`) - path to Linux Kernel binaries, aka `$KBUILD_OUTPUT` * `vmtest-release` - release version name of the vmtest tool diff --git a/run-vmtest/run-bpf-selftests.sh b/run-vmtest/run-bpf-selftests.sh index 151e62c6..d29584d5 100755 --- a/run-vmtest/run-bpf-selftests.sh +++ b/run-vmtest/run-bpf-selftests.sh @@ -94,46 +94,6 @@ test_progs-bpf_gcc() { test_progs_helper "-bpf_gcc" "" } -export VERISTAT_TARGET=${VERISTAT_TARGET:-kernel} -export VERISTAT_CONFIGS=${VERISTAT_CONFIGS:-/mnt/vmtest/ci/vmtest/configs} -export WORKING_DIR=$(pwd) # veristat config expects this variable - -run_veristat() { - foldable start run_veristat_${VERISTAT_TARGET} "Running veristat ${VERISTAT_TARGET}" - # Make veristat commands visible in the log - if [ -o xtrace ]; then - xtrace_was_on="1" - else - xtrace_was_on="" - set -x - fi - - ( - # shellcheck source=ci/vmtest/configs/run_veristat.default.cfg - # shellcheck source=ci/vmtest/configs/run_veristat.meta.cfg - source "${VERISTAT_CONFIGS}/run_veristat.${VERISTAT_TARGET}.cfg" - pushd "${VERISTAT_OBJECTS_DIR}" - - args=() - args+=(-o csv) - args+=(-q) - args+=(-e file,prog,verdict,states) - args+=(${VERISTAT_CFG_FILE:+-f@$VERISTAT_CFG_FILE}) - - "${SELFTESTS_BPF}/veristat" "${args[@]}" ${VERISTAT_OBJECTS_GLOB} > \ - "${OUTPUT_DIR}/${VERISTAT_OUTPUT}" - - echo "run_veristat_${VERISTAT_TARGET}:$?" >> ${STATUS_FILE} - popd - ) - - # Hide commands again - if [ -z "$xtrace_was_on" ]; then - set +x - fi - foldable end run_veristat_${VERISTAT_TARGET} -} - foldable end vm_init foldable start kernel_config "Kconfig" diff --git a/run-vmtest/run.sh b/run-vmtest/run.sh index 3fc30b8e..7f84d2da 100755 --- a/run-vmtest/run.sh +++ b/run-vmtest/run.sh @@ -33,6 +33,7 @@ else exit 2 fi +# Set this default before the config hook so its overrides take precedence. RUN_BPFTOOL_CHECKS=${RUN_BPFTOOL_CHECKS:-} if [[ -z "${RUN_BPFTOOL_CHECKS}" \ && "${KERNEL}" = 'LATEST' \ @@ -53,18 +54,23 @@ then VMTEST_SCRIPT="${GITHUB_ACTION_PATH}/run-scx-selftests.sh" elif [[ -z "$VMTEST_SCRIPT" ]]; then - ${GITHUB_ACTION_PATH}/prepare-bpf-selftests.sh VMTEST_SCRIPT="${GITHUB_ACTION_PATH}/run-bpf-selftests.sh" fi +bpf_selftests=false +if [[ "$VMTEST_SCRIPT" == "${GITHUB_ACTION_PATH}/run-bpf-selftests.sh" ]]; then + bpf_selftests=true + ${GITHUB_ACTION_PATH}/prepare-bpf-selftests.sh +fi + # clear exitstatus file echo -n > exitstatus foldable start bpftool_checks "Running bpftool checks..." # bpftool checks are aimed at checking type names, documentation, shell -# completion etc. against the current kernel, so only run on LATEST. -if [[ -n "${RUN_BPFTOOL_CHECKS}" ]]; then +# completion etc. against the current kernel, so default to LATEST. +if "$bpf_selftests" && [[ -n "${RUN_BPFTOOL_CHECKS:-}" ]]; then bpftool_exitstatus=0 # "&& true" does not change the return code (it is not executed if the # Python script fails), but it prevents the trap on ERR set at the top @@ -143,12 +149,14 @@ fi foldable end collect_status -SUMMARIES=$(find . -maxdepth 1 -name "test_*.json") -for summary in ${SUMMARIES}; do - if [ -f "${summary}" ]; then - "${GITHUB_ACTION_PATH}/print_test_summary.py" -s "${GITHUB_STEP_SUMMARY}" -j "${summary}" - fi -done +if "$bpf_selftests"; then + SUMMARIES=$(find . -maxdepth 1 -name "test_*.json") + for summary in ${SUMMARIES}; do + if [ -f "${summary}" ]; then + "${GITHUB_ACTION_PATH}/print_test_summary.py" -s "${GITHUB_STEP_SUMMARY}" -j "${summary}" + fi + done +fi # Final summary - Don't use a fold, keep it visible echo -e "\033[1;33mTest Results:\033[0m"