Skip to content

Run URM Tests through Debian Packages - #528

Merged
Srikanth Muppandam (smuppand) merged 1 commit into
qualcomm-linux:mainfrom
kartnema:dev/add-urm-deb-dependency
Aug 14, 2026
Merged

Run URM Tests through Debian Packages#528
Srikanth Muppandam (smuppand) merged 1 commit into
qualcomm-linux:mainfrom
kartnema:dev/add-urm-deb-dependency

Conversation

@kartnema

@kartnema Kartik Nema (kartnema) commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

On platforms which use Debian builds, like Glymur, enable test case runs by installing the appropriate testing package for URM: "userspace-resource-manager-tests". This package installs the necessary binaries and configs needed for testing.

The run.sh script already has instructions for running the tests, fetching and reporting the results in an appropriate manner.

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 update the commit message to a more clear to reflect with the current changes.


if ! pkg_ensure_package_set urm; then
log_skip "$TESTNAME SKIP - required package set is not available: urm"
echo "$TESTNAME SKIP" >"$RES_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.

"RES_FILE" and "TESTNAME" have not been initialized when this failure path executes. they are assigned later at lines 55–58. If package recovery fails, the redirect targets an empty filename, no ".res" file is generated.

Move the complete package-recovery block below:

TESTNAME="userspace-resource-manager"
test_path="$(find_test_case_by_name "$TESTNAME")"
cd "$test_path" || exit 1
RES_FILE="./${TESTNAME}.res"

# shellcheck disable=SC1091
. "$TOOLS/lib_pkg_provider.sh"

if ! pkg_ensure_package_set urm; 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.

Every Debian/Ubuntu run may perform avoidable package-manager, network, and package-upgrade work, increasing runtime, external dependencies, and flakiness.

Recommended fix:

if ! pkg_ensure_required_package_set_present urm; then
    log_skip "$TESTNAME SKIP - failed to ensure required package set: urm"
    echo "$TESTNAME SKIP" >"$RES_FILE"
    exit 0
fi

The shared helper explicitly documents that it avoids package-manager/network work when the required package set is already complete and verifies the package set again after recovery.

# shellcheck disable=SC1091
. "$TOOLS/lib_pkg_provider.sh"

if ! pkg_ensure_required_package_set_present urm; 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.

"pkg_ensure_required_package_set_present" treats a missing package-set mapping as failure. On Yocto/RPM/OPKG, where this PR intentionally provides no "urm" mapping, the helper first fails verification, "pkg_ensure_package_set" performs its no-op, and the final verification fails again.
The runner then writes SKIP and exits instead of continuing with the packages already supplied by the image.

Recommended fix:

if [ -f "$TOOLS/lib_pkg_provider.sh" ]; then
    # shellcheck disable=SC1091
    . "$TOOLS/lib_pkg_provider.sh"

    if pkg_lookup_package_set urm >/dev/null 2>&1; then
        if ! pkg_ensure_required_package_set_present urm; then
            log_skip "$TESTNAME SKIP - failed to ensure required package set: urm"
            echo "$TESTNAME SKIP" >"$RES_FILE"
            exit 0
        fi
    else
        log_info "No URM package-set mapping for this OS/provider; using image-provided assets"
    fi
fi

Comment thread Runner/config/pkg_command_map.conf Outdated
# Qualcomm userspace-resource-manager package set.
#
# Used by tests that explicitly call:
# pkg_ensure_package_set urm

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 comment documents direct use of "pkg_ensure_package_set" and "pkg_ensure_optional_package_set", but the current runner uses "pkg_ensure_required_package_set_present". Update this block to document the actual required-set caller and clarify that absent mappings are intentionally ignored by the runner

Comment thread Runner/suites/Performance/userspace-resource-manager/run.sh
shift
done

if pkg_lookup_package_set urm >/dev/null 2>&1; 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.

I have two points to get confirmation. Then we are good to merge.

  1. Package recovery runs before the RUN_MODE=list branch at line 345. Therefore ./run.sh --list can invoke apt, install packages and trigger package post-install actions.

Skip package recovery when RUN_MODE=list. Only ensure the package set after confirming that an approved test will actually execute.

  1. Guard with command -v pkg_lookup_package_set and command -v pkg_ensure_required_package_set_present, or make the library explicitly required on mapped distributions.

@kartnema
Kartik Nema (kartnema) force-pushed the dev/add-urm-deb-dependency branch 2 times, most recently from 5b3fd2f to 786bd7a Compare August 13, 2026 09:06
exit 0
fi

# ---------- Ensure packages (deferred: skip when RUN_MODE=list) ----------

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.

Move this package-recovery block to immediately after CLI parsing, while retaining the RUN_MODE != list guard. It must execute before the service gate, configuration validation and preflight_bins. Continue using pkg_lookup_package_set and pkg_ensure_required_package_set_present

# Only recover the package set once we know an approved test will actually
# execute. Guard with command -v so the calls are safe even when
# lib_pkg_provider.sh was not sourced or the OS/provider has no mapping.
if [ "$RUN_MODE" != "list" ]; 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.

Maybe my earlier comments didn't convey in right way.

Package recovery is gated only by RUN_MODE != list it does not confirm that the value supplied through --bin is approved. Consequently, ./run.sh --bin typo or a missing --bin value can invoke package verification, network access, installation and package post-install actions before the runner later skips the unapproved test.

Move approved_tests/is_approved before this block and validate ONE_BIN, or construct the approved run list before recovery. Package recovery should execute only for --all or a validated, approved --bin

# unapproved test.
# Guard with command -v so the calls are safe even when lib_pkg_provider.sh
# was not sourced or the OS/provider has no mapping.
_pkg_recovery_needed=0

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 remove trailing underscore before var/functions names.

On platforms which use Debian builds, like Glymur, enable test case
runs by installing the appropriate debian tests package for URM,
"userspace-resource-manager-tests". This package installs the necessary
binaries and configs needed for testing.
The run.sh script already has instructions for running the tests,
fetching and reporting the results in an appropriate manner.

Signed-off-by: Kartik Nema <kartnema@qti.qualcomm.com>

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.

LGTM

@smuppand
Srikanth Muppandam (smuppand) merged commit e2dda42 into qualcomm-linux:main Aug 14, 2026
14 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.

2 participants