Skip to content

Add libbpf-tool profile tests - #4598

Merged
LiliDeng merged 1 commit into
microsoft:mainfrom
mayankfz:mayansingh/libbpf-profile
Jul 16, 2026
Merged

Add libbpf-tool profile tests#4598
LiliDeng merged 1 commit into
microsoft:mainfrom
mayankfz:mayansingh/libbpf-profile

Conversation

@mayankfz

@mayankfz mayankfz commented Jul 14, 2026

Copy link
Copy Markdown

Description

Add libbpf-tool profile tests

Related Issue

Add libbpf-tool profile tests

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation update

Checklist

  • Description is filled in above
  • No credentials, secrets, or internal details are included
  • Peer review requested (if not, add required peer reviewers after raising PR)
  • Tests executed and results posted below

Test Validation

Key Test Cases:

  • verify_bpf_profile_captures_stacks -> profiles dd workload 3s, asserts >2 stack lines
  • verify_bpf_profile_stack_filtering ->validates -K (kernel) and -U (user) flags
  • verify_bpf_profile_no_resource_leak -> 5 rapid runs, asserts BPF prog count stable
  • verify_bpf_profile_handles_edge_cases -> bad PID + target exit mid-profile, no segfault

Impacted LISA Features:

  • Adds 4 bpf-profile test cases to LibbpfToolsSuite in lisa/microsoft/testsuites/bpf/libbpf_tools.py

Tested Azure Marketplace Images:

  • MicrosoftCBLMariner:azure-linux-3:azure-linux-3:latest

Test Results

Image VM Size Result
azure-linux-3:latest (3.20260706.01) Standard_D2ads_v5 4/4 SKIPPED
azure-linux-3 + sideloaded v0.29.1-5 RPM Standard_D2ads_v5 4/4 PASSED
image

Copilot AI review requested due to automatic review settings July 14, 2026 08:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the existing LibbpfToolsSuite with new test coverage for the bpf-profile tool (profiling, stack filtering, resource cleanup, and edge-case handling) to validate libbpf-tools functionality beyond basic install/binary execution checks.

Changes:

  • Added helper methods to locate bpf-profile, start a CPU workload, and clean it up.
  • Added multiple new bpf-profile test cases covering stack capture, -K/-U filtering, leak checks via bpftool, and edge cases.
  • (PR hygiene) The PR description is still the default template placeholders and should be filled in before approval.

Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 08:25
@mayankfz
mayankfz force-pushed the mayansingh/libbpf-profile branch from fd62af5 to d8fd1ba Compare July 14, 2026 08:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 6 comments.

Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Copilot AI review requested due to automatic review settings July 14, 2026 09:02
@mayankfz
mayankfz force-pushed the mayansingh/libbpf-profile branch from d8fd1ba to 99b1043 Compare July 14, 2026 09:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Copilot AI review requested due to automatic review settings July 14, 2026 09:08
@mayankfz
mayankfz force-pushed the mayansingh/libbpf-profile branch from 99b1043 to 054bd87 Compare July 14, 2026 09:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Copilot AI review requested due to automatic review settings July 14, 2026 09:21
@mayankfz
mayankfz force-pushed the mayansingh/libbpf-profile branch from 054bd87 to 2b38bc0 Compare July 14, 2026 09:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 11 comments.

Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Copilot AI review requested due to automatic review settings July 14, 2026 10:02
@mayankfz
mayankfz force-pushed the mayansingh/libbpf-profile branch from 2b38bc0 to b45aaa1 Compare July 14, 2026 10:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.

Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 13:24
@mayankfz
mayankfz force-pushed the mayansingh/libbpf-profile branch from b45aaa1 to 8bf986a Compare July 14, 2026 13:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 6 comments.

Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 13:42
@mayankfz
mayankfz force-pushed the mayansingh/libbpf-profile branch from 8bf986a to 823e13c Compare July 14, 2026 13:42
@mayankfz
mayankfz marked this pull request as ready for review July 14, 2026 13:44
Signed-off-by: Mayank Singh <mayansingh@microsoft.com>
@mayankfz
mayankfz force-pushed the mayansingh/libbpf-profile branch from 823e13c to b145889 Compare July 14, 2026 13:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 9 comments.

Comments suppressed due to low confidence (1)

lisa/microsoft/testsuites/bpf/libbpf_tools.py:411

  • 139 and -11 are magic numbers here. Add an inline comment (or use a named constant) to clarify that these exit codes commonly map to SIGSEGV so the intent of this assertion stays clear.
        ).is_not_in(139, -11)
        log.info("Target exit mid-profile handled gracefully")

Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Copilot AI review requested due to automatic review settings July 14, 2026 13:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
Comment thread lisa/microsoft/testsuites/bpf/libbpf_tools.py
@LiliDeng

LiliDeng commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

@mayankfz
Is it expected? test image: microsoftcblmariner azure-linux-3 azure-linux-3-gen2 3.20260501.01

image

@mayankfz

mayankfz commented Jul 15, 2026

Copy link
Copy Markdown
Author

@mayankfz Is it expected? test image: microsoftcblmariner azure-linux-3 azure-linux-3-gen2 3.20260501.01

image

Yes @LiliDeng , the update package still needs to be released the changes are under review. So, that is why tested with the copying the package rpm locally as well. For now, it will get skipped if the tool is not present. Have mentioned the same in the description as well. Thanks.

@LiliDeng

Copy link
Copy Markdown
Collaborator

@mayankfz Is it expected? test image: microsoftcblmariner azure-linux-3 azure-linux-3-gen2 3.20260501.01
image

Yes @LiliDeng , the update package still needs to be released the changes are under review. So, that is why tested with the copying the package rpm locally as well. For now, it will get skipped if the tool is not present. Have mentioned the same in the description as well. Thanks.

Thanks for the explanation.
From the log, I saw package has been installed, but later the command was still not found, do you mean the package is not ready yet, for the future version of the package will work? Then how we know that it is a real package issue?

@mayankfz

Copy link
Copy Markdown
Author

@mayankfz Is it expected? test image: microsoftcblmariner azure-linux-3 azure-linux-3-gen2 3.20260501.01
image

Yes @LiliDeng , the update package still needs to be released the changes are under review. So, that is why tested with the copying the package rpm locally as well. For now, it will get skipped if the tool is not present. Have mentioned the same in the description as well. Thanks.

Thanks for the explanation. From the log, I saw package has been installed, but later the command was still not found, do you mean the package is not ready yet, for the future version of the package will work? Then how we know that it is a real package issue?

The current libbpf-tools package in the Azure Linux 3 repo (0.29.1-4) does not include the bpf-profile binary, it is being added in version 0.29.1-5, which is still under review. That is why the package installs successfully but the command is not found.

The test handles this gracefully, it checks if bpf-profile is available and skips with a clear message if not. Once the updated package (0.29.1-5) is published to the repo, the test will pick it up automatically without any code changes.
To validate the test logic itself, I sideloaded the locally built RPM on a test VM and confirmed all 4 test cases pass. Thanks.

@LiliDeng
LiliDeng merged commit 5ef4eb9 into microsoft:main Jul 16, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants