Skip to content

Added tests for dmabuf validations#296

Open
vnarapar wants to merge 1 commit intoqualcomm-linux:mainfrom
vnarapar:dmabuf
Open

Added tests for dmabuf validations#296
vnarapar wants to merge 1 commit intoqualcomm-linux:mainfrom
vnarapar:dmabuf

Conversation

@vnarapar
Copy link
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
@vnarapar vnarapar force-pushed the dmabuf branch 3 times, most recently from fb87ffd to 90efb69 Compare March 23, 2026 12:45
Added the tests to check DMA configs, Device Tree Validation and
upstream kselftests

Signed-off-by: Vamsee Narapareddi <vnarapar@qti.qualcomm.com>
@smuppand
Copy link
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

fi

# Only source if not already loaded (idempotent)
if [ -z "$__INIT_ENV_LOADED" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the unset-safe form here:

if [ -z "${__INIT_ENV_LOADED:-}" ]; then

Expanding "$__INIT_ENV_LOADED" directly is less robust when the variable is unset.

log_info "============ Starting $TESTNAME Testcase ======================================="
log_info "================================================================================"

check_dependencies "find grep basename"
Copy link
Contributor

Choose a reason for hiding this comment

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

check_dependencies is called here, but its return code is not used. Can we gate this properly and SKIP early if required tools are missing, following the standard testkit dependency-check pattern?

for region in /proc/device-tree/reserved-memory/*; do
if [ -d "$region" ]; then
region_name=$(basename "$region")
log_info " Region: $region_name"
Copy link
Contributor

Choose a reason for hiding this comment

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

This reserved-memory enumeration is useful as info, but it is not really DMA-BUF-specific validation yet. Can we either narrow this to relevant DMA-BUF/heap-related nodes or clearly keep it informational in the README/log wording?

skip_count=${skip_count:-0}
error_count=${error_count:-0}
else
pass_count=$(grep -c "^ok " "$output_file" || echo 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

In fallback mode, pass_count=$(grep -c "^ok " ...) still counts skipped tests as passes because TAP skip lines are ok ... # SKIP. Can we split this into:

skip_count=$(grep -c "^ok .*# SKIP" ...)

pass_count=(all ok) - skip_count so the fallback summary is accurate?

pass=false
elif [ "$pass_count" -eq 0 ]; then
log_fail "No tests passed - possible execution issue"
pass=false
Copy link
Contributor

Choose a reason for hiding this comment

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

The pass/fail priority still treats a non-zero exit code as FAIL even when TAP totals might already say fail:0 error:0. Can we trust TAP totals first when they are present, and only fall back to exit-code-based judgment when totals are absent?

pass=true

DEFAULT_BINARY_PATH="/kselftest/dmabuf-heaps/dmabuf-heap"
BINARY_PATH="$DEFAULT_BINARY_PATH"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add explicit dependency checks near startup for the tools used in this script (grep, awk, cut, basename, etc.) and SKIP if they are unavailable? That would align with the standard dependency-gating pattern used elsewhere.

```bash
cd /path/to/Runner/suites/Kernel/Baseport/dmabuf_heap_kselftest
./run.sh /custom/path/to/dmabuf-heap
```
Copy link
Contributor

Choose a reason for hiding this comment

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

README still documents the positional path form:

./run.sh /custom/path/to/dmabuf-heap

but the current script ignores positional args. Please align README with the actual CLI behavior, or update the script to support positional path input.


### Mandatory:
```
CONFIG_DMA_SHARED_BUFFER=y
Copy link
Contributor

Choose a reason for hiding this comment

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

The mandatory kernel-config section here still says:

CONFIG_DMA_SHARED_BUFFER=y
CONFIG_DMA_HEAP=y

but elsewhere in the PR the terminology/config expectations are centered around CONFIG_DMABUF_HEAPS / heap devices / the selftest binary. Please double-check that the documented mandatory config names match the actual test expectations.

@smuppand
Copy link
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

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