Add function list comparison to github CI
v3 cover Add function list comparison to github CI
As changes to pahole can generate different sets of functions for vmlinux BTF, automate comparison between next branch and the series CI is testing. Build baseline (default 'next' branch) as part of build-pahole.sh and build kernel with both test and baseline pahole, using pfunct to generate function lists for comparison. Example job here [1].
Patch 1 ensures that the baseline pahole is not built as part of setup; patch 2 adds the baseline build and compare-functions job to the dwarves-ci pipeline.
Changes since v2:
- altered patch 1 to not build pahole (pahole: 'none') during setup (Ihor, patch 1)
- do baseline build when building pahole via script, add compare functions to summary (Ihor, patch 2)
Changes since v1:
- fix rebuild to actually rebuild with baseline pahole (patch 2)
[1] https://github.com/alan-maguire/dwarves/actions/runs/16192185959
Alan Maguire (2):
github CI: Do not build pahole as part of dwarves-ci setup github CI: Add comparison of generated BTF functions between baseline,
change
.github/scripts/build-pahole.sh | 23 +++++++++++++++++++++ .github/scripts/compare-functions.sh | 30 ++++++++++++++++++++++++++++ .github/workflows/test.yml | 4 ++-- .github/workflows/vmtest.yml | 4 ++++ 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100755 .github/scripts/compare-functions.sh
Signature · 1 line
2.43.5
PATCH v3 1/2 github CI: Do not build pahole as part of dwarves-ci setup
We build it during testing, no need to do it during setup.
--- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
.github/workflows/test.yml +2 -2
@@ -20,12 +20,12 @@ jobs: runs_on: 'ubuntu-24.04' arch: 'x86_64' llvm-version: '18' - pahole: 'master' + pahole: 'none' - kernel: 'LATEST' runs_on: 'ubuntu-24.04-arm' arch: 'aarch64' llvm-version: '18' - pahole: 'tmp.master' + pahole: 'none' name: Linux ${{ matrix.kernel }} uses: ./.github/workflows/vmtest.yml with:
Signature · 1 line
2.43.5
PATCH v3 2/2 github CI: Add comparison of generated BTF functions between baseline, change
In reply to Alan MaguireSometimes changes can be introduced that modify the set of functions encoded in BTF, or change aspects of that encoding. Add a non-fatal comparison job to compare between the change and the base branch, by default the "next" branch. Update the build-pahole.sh script to build baseline.
--- .github/scripts/build-pahole.sh | 23 +++++++++++++++++++++ .github/scripts/compare-functions.sh | 30 ++++++++++++++++++++++++++++ .github/workflows/vmtest.yml | 4 ++++ 3 files changed, 57 insertions(+) create mode 100755 .github/scripts/compare-functions.sh
.github/scripts/build-pahole.sh +23 -0
@@ -4,8 +4,16 @@ # Copyright (c) 2025, Oracle and/or its affiliates. # +function restore() { + git checkout $SHA + git submodule update +} + GITHUB_WORKSPACE=${GITHUB_WORKSPACE:-$(dirname $0)/../..} +BASELINE=${BASELINE:-next} + cd $GITHUB_WORKSPACE +git log --oneline -1 git config --global --add safe.directory $GITHUB_WORKSPACE git submodule update --init mkdir -p build
@@ -15,3 +23,18 @@ cmake -DGIT_SUBMODULE=OFF -DBUILD_SHARED_LIBS=OFF .. make -j$((4*$(nproc))) all make DESTDIR=../install install +# save sha to restore after building baseline +cd $GITHUB_WORKSPACE +export SHA=$(git log --format="%h" -1) +trap restore EXIT + +git fetch origin ${BASELINE}:${BASELINE} +git checkout ${BASELINE} +git log --oneline -1 +git submodule update +mkdir -p build.$BASELINE +cd build.$BASELINE +pwd +cmake -DGIT_SUBMODULE=OFF -DBUILD_SHARED_LIBS=OFF .. +make -j$((4*$(nproc))) all +make DESTDIR=../install.$BASELINE install
.github/scripts/compare-functions.sh new file +30 -0
@@ -0,0 +1,30 @@ +#!/usr/bin/bash +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (c) 2025, Oracle and/or its affiliates. +# + +GITHUB_WORKSPACE=${GITHUB_WORKSPACE:-$(pwd)} +REPO_TARGET=${GITHUB_WORKSPACE}/.kernel +VMLINUX=${GITHUB_WORKSPACE}/.kernel/vmlinux +BASELINE=${BASELINE:-next} +GITHUB_STEP_SUMMARY=${GITHUB_STEP_SUMMARY:-/dev/null} + +export PATH=${GITHUB_WORKSPACE}/install/usr/local/bin:${PATH} +which pahole +pahole --version +cd $REPO_TARGET +pfunct --all --format_path=btf $VMLINUX > functions + +rm -f vmlinux vmlinux.o + +# now use baseline branch of pahole for comparison +export PATH=${GITHUB_WORKSPACE}/install.${BASELINE}/usr/local/bin:${PATH} +export PAHOLE=${GITHUB_WORKSPACE}/install.${BASELINE}/usr/local/bin/pahole +which pahole +pahole --version +make oldconfig +make -j $((4*$(nproc))) all +pfunct --all --format_path=btf $VMLINUX > functions.${BASELINE} +echo "### Compare vmlinux BTF functions generated with this change vs baseline (none means no differences)." | tee -a $GITHUB_STEP_SUMMARY +diff functions.${BASELINE} functions | tee -a $GITHUB_STEP_SUMMARY
.github/workflows/vmtest.yml +4 -0
@@ -60,3 +60,7 @@ jobs: shell: bash run: .github/scripts/run-selftests.sh + - name: Compare functions generated + shell: bash + run: .github/scripts/compare-functions.sh +
Signature · 1 line
2.43.5
Quoted 11 lines · Alan Maguire
As changes to pahole can generate different sets of functions for vmlinux BTF, automate comparison between next branch and the series CI is testing. Build baseline (default 'next' branch) as part of
build-pahole.shand build kernel with both test and baseline pahole, using pfunct to generate function lists for comparison. Example job here [1].Patch 1 ensures that the baseline pahole is not built as part of setup; patch 2 adds the baseline build and compare-functions job to the dwarves-ci pipeline.
Quoted 6 lines
Changes since v2:
- altered patch 1 to not build pahole (pahole: 'none') during setup (Ihor, patch 1)
- do baseline build when building pahole via script, add compare functions to summary (Ihor, patch 2)
Thanks!
Quoted 19 lines
Changes since v1:
- fix rebuild to actually rebuild with baseline pahole (patch 2)
[1] https://github.com/alan-maguire/dwarves/actions/runs/16192185959
Alan Maguire (2):
github CI: Do not build pahole as part of dwarves-ci setup github CI: Add comparison of generated BTF functions between baseline,
change.github/scripts/build-pahole.sh | 23 +++++++++++++++++++++ .github/scripts/compare-functions.sh | 30 ++++++++++++++++++++++++++++ .github/workflows/test.yml | 4 ++-- .github/workflows/vmtest.yml | 4 ++++ 4 files changed, 59 insertions(+), 2 deletions(-)create mode 100755
.github/scripts/compare-functions.sh
Alan Maguire
AppliedQuoted 14 lines · Ihor Solodrai
Quoted 13 lines · Alan Maguire
As changes to pahole can generate different sets of functions for vmlinux BTF, automate comparison between next branch and the series CI is testing. Build baseline (default 'next' branch) as part of
build-pahole.shand build kernel with both test and baseline pahole, using pfunct to generate function lists for comparison. Example job here [1].Patch 1 ensures that the baseline pahole is not built as part of setup; patch 2 adds the baseline build and compare-functions job to the dwarves-ci pipeline.
Changes since v2:
Quoted 9 lines
Quoted 4 lines
- altered patch 1 to not build pahole (pahole: 'none') during setup (Ihor, patch 1)
- do baseline build when building pahole via script, add compare functions to summary (Ihor, patch 2)Acked-by Ihor Solodrai <[email protected]>Thanks!
Applied the series to the "next" branch of
https://git.kernel.org/pub/scm/devel/pahole/pahole.git/
Thank you!
Alan
Quoted 20 lines
Quoted 19 lines
Changes since v1:
- fix rebuild to actually rebuild with baseline pahole (patch 2)
[1] https://github.com/alan-maguire/dwarves/actions/runs/16192185959
Alan Maguire (2):
github CI: Do not build pahole as part of dwarves-ci setup github CI: Add comparison of generated BTF functions between baseline, change.github/scripts/build-pahole.sh | 23 +++++++++++++++++++++
.github/scripts/compare-functions.sh| 30 ++++++++++++++++++++++++++++ .github/workflows/test.yml | 4 ++-- .github/workflows/vmtest.yml | 4 ++++4 files changed, 59 insertions(+), 2 deletions(-)create mode 100755
.github/scripts/compare-functions.sh