Skip to content

Add DMA enablement tests#296

Open
vnarapar wants to merge 3 commits into
qualcomm-linux:mainfrom
vnarapar:dmabuf
Open

Add DMA enablement tests#296
vnarapar wants to merge 3 commits into
qualcomm-linux:mainfrom
vnarapar:dmabuf

Conversation

@vnarapar
Copy link
Copy Markdown
Contributor

Added the tests to check DMA configs, Device Tree Validation and upstream kselftests

@vnarapar vnarapar requested a review from smuppand February 15, 2026 19:17
Comment thread Runner/suites/Kernel/Baseport/dmabuf/dmabuf.yaml Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf/README.md Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/run.sh
@vnarapar vnarapar force-pushed the dmabuf branch 4 times, most recently from 90efb69 to 6b50d76 Compare March 23, 2026 12:47
@smuppand
Copy link
Copy Markdown
Contributor

smuppand commented Mar 24, 2026

This one should be split into 3 commits, unlike the simple one commit and one-testcase PR. It currently combines:

  1. library/helper addition
  2. presence-style dmabuf testcase
  3. functional dmabuf heap kselftest runner

Comment thread Runner/utils/functestlib.sh
Comment thread Runner/suites/Kernel/Baseport/dmabuf/dmabuf.yaml
Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/run.sh
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/run.sh Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/run.sh
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/README.md
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/README.md Outdated
@smuppand
Copy link
Copy Markdown
Contributor

This one should be split into 3 commits, unlike the simple one commit and one-testcase PR. It currently combines:

  1. library/helper addition
  2. presence-style dmabuf testcase
  3. functional dmabuf heap kselftest runner

This should still be split into 3 commits. Also address the structural commensts. The PR is 1 commit / 7 files / 3 logical chunks

@vnarapar vnarapar changed the title Added tests for dmabuf validations Add DMA enablement tests Apr 5, 2026
Copy link
Copy Markdown
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

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

Kindly close the comments that have been addressed with the updated patches.

Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh
Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/run.sh Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/run.sh
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/README.md Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/README.md
Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf/run.sh Outdated
vnarapar added 2 commits May 7, 2026 17:14
Add the helper function to check kernel optional config

Signed-off-by: Vamsee Narapareddi <vnarapar@qti.qualcomm.com>
This test validates the DMA-BUF subsystem configuration on Qualcomm
platforms, including kernel configuration, device tree setup, and system
interfaces

Signed-off-by: Vamsee Narapareddi <vnarapar@qti.qualcomm.com>
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/dmabuf_heap_kselftest.yaml Outdated
Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/dmabuf_heap_kselftest.yaml Outdated
exit 1
fi

if [ -z "$__INIT_ENV_LOADED" ]; then
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.

please add this too

Comment thread Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest/run.sh Outdated
This test runs the `dmabuf-heap` binary from the Linux kernel selftests
suite to validate DMA-BUF heap functionality

Signed-off-by: Vamsee Narapareddi <vnarapar@qti.qualcomm.com>
exit 1
fi

if [ "${__INIT_ENV_LOADED:-}" ]; then
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.

The guard is inverted. This sources init_env only when __INIT_ENV_LOADED is already set. On a normal first-time run, init_env will not be sourced, but the script still immediately sources "$TOOLS/functestlib.sh"

recommend

if [ -z "${__INIT_ENV_LOADED:-}" ]; then
    # shellcheck disable=SC1090
    . "$INIT_ENV"
fi

fi

# Only source if not already loaded (idempotent)
if [ "${__INIT_ENV_LOADED:-}" ]; then
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.

Same here too.


log_info "Checking optional DMA-BUF configurations..."
for cfg in $OPTIONAL_CONFIGS; do
if zgrep -qE "^${cfg}=(y|m)" /proc/config.gz 2>/dev/null; then
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.

duplicates optional config parsing using raw zgrep. Since this PR adds check_optional_config() to functestlib.sh,

}

# Check each given kernel config is set to y/m in /proc/config.gz, logs result, returns 0/1.
check_optional_config() {
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.

For optional configs, returning 1 immediately on the first missing config means later optional configs are not logged.

Make it log all optional configs and return 0, or return 1 only after checking all configs.

check_optional_config() {
    cfgs=$1
    missing=0
 
    for config_key in $cfgs; do
        if check_kernel_config "$config_key" >/dev/null 2>&1; then
            log_pass "Optional Kernel config $config_key is enabled"
        else
            log_warn "Optional Kernel config $config_key is missing or not enabled"
            missing=1
        fi
    done
 
    return "$missing"
}

log_fail "dmabuf-heap binary is not executable: $BINARY_PATH"
pass="false"
echo "$TESTNAME FAIL" > "$res_file"
exit 1
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.

Please make it to exit 0 for lava friendly


# Parse the totals line if present
if grep -q "# Totals:" "$output_file"; then
totals_line=$(grep "# Totals:" "$output_file")
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.

If multiple totals lines appear, this captures all of them.
Impact: TAP parsing can become ambiguous.

Recommended fix:

totals_line=$(grep "# Totals:" "$output_file" | tail -n 1)

log_info " Skipped: $skip_count"
log_info " Errors: $error_count"

if [ "$fail_count" -gt 0 ] || [ "$error_count" -gt 0 ]; then
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.

If the binary exits 0 but produces no TAP tests and no not ok lines, this can still PASS with 0 passed, 0 skipped. A broken or empty test binary could be misclassified as PASS.
Recommended fix:

if [ "$pass_count" -eq 0 ] && [ "$skip_count" -eq 0 ]; then
    log_fail "No TAP test results were parsed"
    pass="false"
elif [ "$fail_count" -gt 0 ] || [ "$error_count" -gt 0 ]; then
    ...
fi

run:
steps:
- REPO_PATH=$PWD
- cd "$REPO_PATH/Runner/suites/Kernel/Baseport/dmabuf" || true
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.

If the path is wrong, the test can continue in the wrong directory and produce misleading results. So remove || true

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.

2 participants