All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Alan Maguire <alan.maguire@oracle.com>, dwarves@vger.kernel.org
Cc: bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH v2 dwarves 2/2] github CI: Add comparison of generated BTF functions between baseline, change
Date: Mon, 30 Jun 2025 11:36:54 -0700	[thread overview]
Message-ID: <b9b2e516-5591-4c0b-a1aa-6fa89f002181@linux.dev> (raw)
In-Reply-To: <20250630101537.2680289-3-alan.maguire@oracle.com>

On 6/30/25 3:15 AM, Alan Maguire wrote:
> Sometimes 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.
> 
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> ---
>   .github/scripts/compare-functions.sh | 30 ++++++++++++++++++++++++++++
>   .github/workflows/vmtest.yml         |  4 ++++
>   2 files changed, 34 insertions(+)
>   create mode 100755 .github/scripts/compare-functions.sh
> 

Hi Alan. That's a good addition. See a couple of comments below.

> diff --git a/.github/scripts/compare-functions.sh b/.github/scripts/compare-functions.sh
> new file mode 100755
> index 0000000..062f15c
> --- /dev/null
> +++ b/.github/scripts/compare-functions.sh
> @@ -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
> +SELFTESTS=${GITHUB_WORKSPACE}/tests

nit: SELFTESTS isn't used

> +export PATH=${GITHUB_WORKSPACE}/install/usr/local/bin:${PATH}
> +which pahole
> +pahole --version
> +cd $REPO_TARGET
> +pfunct --all --format_path=btf $VMLINUX > functions_latest
> +# now use baseline pahole for comparison
> +export PAHOLE=/usr/local/bin/pahole

So we assume that the baseline is installed at this path?
And that would be an installation done by
libbpf/ci/setup-build-env action?

I would not rely on that behavior.  I think a better approach is to
build and use master (or whatever is the baseline) explicitly.

> +rm -f vmlinux vmlinux.o
> +export PATH=/usr/local/bin:${PATH}
> +make oldconfig
> +make -j $((4*$(nproc))) all
> +pfunct --all --format_path=btf $VMLINUX > functions_base
> +echo "Comparing vmlinux BTF functions generated with this change vs baseline."
> +echo "Differences are non-fatal to the workflow, but should be examined for correctness."

You might find it useful to dump a formatted diff to
$GITHUB_STEP_SUMMARY, to get a rendered output in github UI.

See here: 
https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions?versionId=free-pro-team%40latest&productId=actions#adding-a-job-summary 


> +set +e
> +diff functions_base functions_latest
> +if [[ $? -eq 0 ]]; then
> +	echo "Function lists are identical."
> +fi
> +set -e
> diff --git a/.github/workflows/vmtest.yml b/.github/workflows/vmtest.yml
> index 0f66eed..54bb92e 100644
> --- a/.github/workflows/vmtest.yml
> +++ b/.github/workflows/vmtest.yml
> @@ -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
> +


  reply	other threads:[~2025-06-30 18:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 10:15 [PATCH v2 dwarves 0/2] Add function list comparison to github CI Alan Maguire
2025-06-30 10:15 ` [PATCH v2 dwarves 1/2] github CI: Build pahole "next" branch as well as latest changes Alan Maguire
2025-06-30 18:38   ` Ihor Solodrai
2025-06-30 10:15 ` [PATCH v2 dwarves 2/2] github CI: Add comparison of generated BTF functions between baseline, change Alan Maguire
2025-06-30 18:36   ` Ihor Solodrai [this message]
2025-07-01 16:14     ` Alan Maguire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9b2e516-5591-4c0b-a1aa-6fa89f002181@linux.dev \
    --to=ihor.solodrai@linux.dev \
    --cc=alan.maguire@oracle.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.