Add DMA enablement tests#296
Conversation
90efb69 to
6b50d76
Compare
|
This one should be split into 3 commits, unlike the simple one commit and one-testcase PR. It currently combines:
|
This should still be split into 3 commits. Also address the structural commensts. The PR is 1 commit / 7 files / 3 logical chunks |
smuppand
left a comment
There was a problem hiding this comment.
Kindly close the comments that have been addressed with the updated patches.
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>
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "$__INIT_ENV_LOADED" ]; then |
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 |
There was a problem hiding this comment.
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 |
|
|
||
| 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 |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
If the path is wrong, the test can continue in the wrong directory and produce misleading results. So remove || true
Added the tests to check DMA configs, Device Tree Validation and upstream kselftests