Skip to content

Conversation

ovsrobot
Copy link
Owner

@ovsrobot ovsrobot commented Oct 6, 2025

NOTE: This is an auto submission for "doc: document telemetry command name restrictions".

See "http://patchwork.dpdk.org/project/dpdk/list/?series=36295" for details.

Summary by Sourcery

Refactor the debug test suite to use a new process_dup helper for testing rte_panic and rte_exit in child processes, add cross‐platform support (skipping tests on Windows and handling FreeBSD prefixes), register test_panic and test_exit in the test runner, and document telemetry command name restrictions in the user guide

Enhancements:

  • Switch test_debug from raw fork to process_dup abstraction driven by RECURSIVE_ENV_VAR for panic and exit testing
  • Add Windows-specific test_panic and test_exit stubs to skip unsupported debug tests
  • Handle platform differences for file-prefix flags on FreeBSD vs Linux in test_debug setup
  • Consolidate test program arguments in a shared test_args array and register new test_panic and test_exit commands in the test harness
  • Introduce inline get_current_prefix helper in process.h and declare new test functions in test.h

Documentation:

  • Document telemetry command name restrictions in the telemetry library guide

Summary by CodeRabbit

  • New Features

    • Added new test actions to validate panic and exit behavior.
  • Tests

    • Reworked debug tests to use process duplication for more reliable execution and unified cross-platform behavior.
    • Certain debug-related tests are skipped on Windows to reflect platform limitations.
    • Improved test argument setup and environment-driven execution for clearer, more consistent runs.
  • Documentation

    • Clarified telemetry command naming rules: only alphanumeric characters, underscores, and forward slashes are allowed; other characters (including spaces) will cause registration to fail.

david-marchand and others added 2 commits October 5, 2025 18:26
Running rte_exit() in a forked process means that shared memory will be
released by the child process before the parent process does the same.
This issue has been seen recently when some GHA virtual machine (with
some mlx5 devices) runs the debug_autotest unit test.

Instead, run rte_panic() and rte_exit() from a new DPDK process spawned
like for other recursive unit tests.

Bugzilla ID: 1796
Fixes: af75078 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Telemetry command names must contain only alphanumeric characters
(`A-Z`, `a-z`, `0-9`), underscore (`_`), and forward slash (`/`).
Other characters, including hyphens (`-`), are not allowed and
cause registration to fail.

This patch updates the documentation to explicitly state these
restrictions and highlights the existing invalid example
"/l3fwd-power/stats" (in l3fwd-power app).

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
Copy link

sourcery-ai bot commented Oct 6, 2025

Reviewer's Guide

This PR refactors the debug test suite to replace direct fork()/wait logic with a recursive invocation via process_dup and environment variables, adds Windows support stubs, updates test registration, adjusts header usage and inlining, and enhances the telemetry guide with command name restrictions documentation.

File-Level Changes

Change Details Files
Replace fork()/wait test logic with process_dup-based recursion
  • Introduce a static test_args array and use process_dup() for recursive calls
  • Use RECURSIVE_ENV_VAR check to distinguish parent and child execution
  • Remove direct fork() and wait() calls in test_panic and test_exit
app/test/test_debug.c
Add Windows compatibility stubs for panic and exit tests
  • Implement test_panic and test_exit to return TEST_SKIPPED on Windows
app/test/test_debug.c
Integrate new test commands into the test framework
  • Register test_panic and test_exit in the do_recursive_call command list
  • Declare test_panic and test_exit in test.h
app/test/test.c
app/test/test.h
Adjust includes and function inlining
  • Replace rte_service_component.h with rte_lcore.h and include process.h
  • Mark get_current_prefix() as static inline in process.h
app/test/test_debug.c
app/test/process.h
Document telemetry command name restrictions
  • Add guidance on valid command name formats in the telemetry library guide
doc/guides/prog_guide/telemetry_lib.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

coderabbitai bot commented Oct 6, 2025

Walkthrough

The changeset refactors test debug execution to use process duplication and environment-driven recursion instead of fork/wait, adds new test actions (test_panic, test_exit) and their declarations, adjusts a helper function to be inline, and updates telemetry documentation to clarify command name character constraints.

Changes

Cohort / File(s) Summary
Process helper tweak
app/test/process.h
Change function specifier of get_current_prefix from static to static inline; body unchanged.
Test harness API and mappings
app/test/test.h, app/test/test.c
Add declarations for int test_exit(void) and int test_panic(void); register new actions in the recursive call mapping.
Test debug refactor to process_dup
app/test/test_debug.c
Replace fork-based flows with process_dup and RECURSIVE_ENV_VAR-triggered child behavior; implement test_panic and test_exit; set up test_args; adjust includes; provide Windows stubs returning TEST_SKIPPED; handle exit value via env var.
Docs: telemetry command naming
doc/guides/prog_guide/telemetry_lib.rst
Document that command names must contain only alphanumeric, underscores, and forward slashes; others cause registration failure.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Tester
  participant TestApp as Test App (parent)
  participant Proc as process_dup
  participant Child as Test App (child)
  participant Env as Environment

  Tester->>TestApp: run test_debug
  Note over TestApp: Build test_args and EAL options
  TestApp->>Env: Set RECURSIVE_ENV_VAR=<action>
  TestApp->>Proc: spawn with test_args
  Proc-->>TestApp: PID/handle

  rect rgba(200,230,255,0.3)
    Note over Child: On start, read RECURSIVE_ENV_VAR
    Child->>Env: Read RECURSIVE_ENV_VAR
    alt action == "test_panic"
      Child->>Child: test_panic()
      Note over Child: trigger panic path
    else action == "test_exit"
      Child->>Child: test_exit()
      Note over Child: call rte_exit(exit_val)
    else other
      Child->>Child: normal test flow
    end
  end

  Child-->>Proc: exit(code)
  Proc-->>TestApp: exit status
  TestApp-->>Tester: report result

  Note over Tester,Child: On Windows: tests stubbed, return TEST_SKIPPED
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

A rabbit taps keys with a twitch of delight,
Forks hop aside—now children spawn light.
Env vars whisper which path to tread,
Panic or exit, by Process led.
Docs tidy names, clean as the moon—
Tests thump-thump, we’ll ship very soon. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely and clearly summarizes the core change of documenting telemetry command name restrictions in the user guide. It directly reflects the modifications to the RST documentation and is specific enough that a reviewer can understand the main intent. The [PWCI] prefix and internal quotes do not detract from its clarity.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch series_36295

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76393b9 and ceb095a.

📒 Files selected for processing (5)
  • app/test/process.h (1 hunks)
  • app/test/test.c (1 hunks)
  • app/test/test.h (1 hunks)
  • app/test/test_debug.c (5 hunks)
  • doc/guides/prog_guide/telemetry_lib.rst (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
app/test/test.h (1)
app/test/test_debug.c (4)
  • test_exit (17-22)
  • test_exit (93-115)
  • test_panic (11-16)
  • test_panic (51-72)
app/test/test.c (1)
app/test/test_debug.c (4)
  • test_panic (11-16)
  • test_panic (51-72)
  • test_exit (17-22)
  • test_exit (93-115)
app/test/test_debug.c (2)
app/test/process.h (1)
  • process_dup (72-200)
lib/eal/common/eal_common_lcore.c (1)
  • rte_get_main_lcore (23-26)
🪛 ast-grep (0.39.5)
app/test/test_debug.c

[warning] 104-104: The getenv function returns NULL on error and this line dereferences the return value without checking for NULL.
Context: strtol(getenv("TEST_DEBUG_EXIT_VAL"), NULL, 0)
Note: [CWE-476] NULL Pointer Dereference. [REFERENCES]
- https://wiki.sei.cmu.edu/confluence/display/c/EXP34-C.+Do+not+dereference+null+pointers

(null-library-function-c)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Sourcery review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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