-
Notifications
You must be signed in to change notification settings - Fork 32
userspace-resource-manager: Modify test runner for URM #352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kartnema
wants to merge
1
commit into
qualcomm-linux:main
Choose a base branch
from
kartnema:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+64
−122
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| #!/bin/sh | ||
| # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. | ||
| # SPDX-License-Identifier: BSD-3-Clause# resource-tuner test runner (pinned whitelist) | ||
| # SPDX-License-Identifier: BSD-3-Clause# userspace-resource-manager test runner (pinned whitelist) | ||
|
|
||
| # ---------- Repo env + helpers ---------- | ||
| SCRIPT_DIR="$( | ||
|
|
@@ -37,7 +37,7 @@ export PATH="/usr/sbin:/sbin:/usr/bin:/bin:${PATH}" | |
| # shellcheck disable=SC3045 | ||
| ( ulimit -c unlimited ) >/dev/null 2>&1 || true | ||
|
|
||
| TESTNAME="resource-tuner" | ||
| TESTNAME="userspace-resource-manager" | ||
| test_path="$(find_test_case_by_name "$TESTNAME")" | ||
| cd "$test_path" || exit 1 | ||
| RES_FILE="./${TESTNAME}.res" | ||
|
|
@@ -62,42 +62,20 @@ fi | |
|
|
||
| # ---------- Approved list (pinned whitelist) ---------- | ||
| APPROVED_TESTS=" | ||
| /usr/bin/ClientDataManagerTests | ||
| /usr/bin/ResourceProcessorTests | ||
| /usr/bin/MemoryPoolTests | ||
| /usr/bin/SignalConfigProcessorTests | ||
| /usr/bin/DeviceInfoTests | ||
| /usr/bin/ThreadPoolTests | ||
| /usr/bin/MiscTests | ||
| /usr/bin/SignalParsingTests | ||
| /usr/bin/SafeOpsTests | ||
| /usr/bin/ExtensionIntfTests | ||
| /usr/bin/RateLimiterTests | ||
| /usr/bin/SysConfigAPITests | ||
| /usr/bin/ExtFeaturesParsingTests | ||
| /usr/bin/RequestMapTests | ||
| /usr/bin/TargetConfigProcessorTests | ||
| /usr/bin/InitConfigParsingTests | ||
| /usr/bin/RequestQueueTests | ||
| /usr/bin/CocoTableTests | ||
| /usr/bin/ResourceParsingTests | ||
| /usr/bin/TimerTests | ||
| /usr/bin/resource_tuner_tests | ||
| /usr/bin/UrmComponentTests | ||
| /usr/bin/UrmIntegrationTests | ||
| " | ||
|
|
||
| # Suites that need base configs (accept either common/ OR custom/) | ||
| SUITES_REQUIRE_BASE_CFGS="ResourceProcessorTests SignalConfigProcessorTests SysConfigAPITests \ | ||
| ExtFeaturesParsingTests TargetConfigProcessorTests InitConfigParsingTests \ | ||
| ResourceParsingTests ExtensionIntfTests resource_tuner_tests" | ||
| # Suites that need base configs (accept either common/ OR tests/) | ||
| SUITES_REQUIRE_BASE_CFGS="UrmComponentTests UrmIntegrationTests" | ||
|
|
||
| # ---------- CLI ---------- | ||
| print_usage() { | ||
| cat <<EOF | ||
| Usage: $0 [--all] [--bin <name|absolute>] [--list] [--timeout SECS] | ||
| Policy: | ||
| - Service INACTIVE => overall SKIP (end early) | ||
| - Base configs: suites require common/ OR custom/ (skip only if BOTH missing) | ||
| - resource_tuner_tests additionally needs tests/Configs/ResourceSysFsNodes | ||
| - Base configs: suites require common/ OR tests/ (skip only if BOTH missing) | ||
| - Any test FAIL => overall FAIL | ||
| - No FAIL & PASS>0 => overall PASS | ||
| - No FAIL & PASS=0 => overall SKIP (everything skipped) | ||
|
|
@@ -180,10 +158,10 @@ parse_and_score_log() { | |
| } | ||
| per_suite_timeout() { | ||
| case "$1" in | ||
| ThreadPoolTests|RateLimiterTests) | ||
| UrmComponentTests) | ||
| echo 1800 | ||
| ;; | ||
| resource_tuner_tests) | ||
| UrmIntegrationTests) | ||
| echo 2400 | ||
| ;; | ||
| *) | ||
|
|
@@ -225,18 +203,18 @@ if command -v log_soc_info >/dev/null 2>&1; then | |
| fi | ||
|
|
||
| # ---------- Service gate (use repo helper) ---------- | ||
| SERVICE_NAME="${SERVICE_NAME:-resource-tuner.service}" | ||
| SERVICE_NAME="${SERVICE_NAME:-urm.service}" | ||
| log_info "[SERVICE] Checking $SERVICE_NAME via check_systemd_services()" | ||
| if check_systemd_services "$SERVICE_NAME"; then | ||
| log_pass "[SERVICE] $SERVICE_NAME is active" | ||
| else | ||
| log_warn "[SERVICE] $SERVICE_NAME not active — attempting enable/start" | ||
|
|
||
| if command -v systemctl >/dev/null 2>&1; then | ||
| systemctl enable resource-tuner >/dev/null 2>&1 || true | ||
| systemctl enable urm >/dev/null 2>&1 || true | ||
| systemctl daemon-reload >/dev/null 2>&1 || true | ||
| systemctl start resource-tuner >/dev/null 2>&1 || true | ||
| systemctl status resource-tuner --no-pager -l >/dev/null 2>&1 || true | ||
| systemctl start urm >/dev/null 2>&1 || true | ||
| systemctl status urm --no-pager -l >/dev/null 2>&1 || true | ||
| else | ||
| log_warn "[SERVICE] systemctl not available; cannot auto-start $SERVICE_NAME" | ||
| fi | ||
|
|
@@ -250,64 +228,57 @@ else | |
| fi | ||
| fi | ||
|
|
||
| # ---------- Config preflight (check both common/ and custom/) ---------- | ||
| RT_CONFIG_DIR="${RT_CONFIG_DIR:-/etc/resource-tuner}" | ||
| COMMON_DIR="$RT_CONFIG_DIR/common" | ||
| CUSTOM_DIR="$RT_CONFIG_DIR/custom" | ||
| TEST_NODES_DIR="$RT_CONFIG_DIR/tests/Configs/ResourceSysFsNodes" | ||
| # ---------- Config preflight (check both common/ and tests/) ---------- | ||
| URM_CONFIG_DIR="${URM_CONFIG_DIR:-/etc/urm}" | ||
| COMMON_DIR="$URM_CONFIG_DIR/common" | ||
| TEST_CONFIGS_DIR="$URM_CONFIG_DIR/tests/configs" | ||
| TEST_NODES_DIR="$URM_CONFIG_DIR/tests/nodes" | ||
|
|
||
| COMMON_OK=1 | ||
| CUSTOM_OK=1 | ||
| NODES_OK=1 | ||
| COMMON_CONFIGS_OK=1 | ||
| TEST_CONFIGS_OK=1 | ||
| TEST_NODES_OK=1 | ||
|
|
||
| REQ_COMMON_FILES="${RT_REQUIRE_COMMON_FILES:-InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml}" | ||
| REQ_CUSTOM_FILES="${RT_REQUIRE_CUSTOM_FILES:-InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml TargetConfig.yaml ExtFeaturesConfig.yaml}" | ||
| REQ_TEST_FILES="${RT_REQUIRE_TEST_FILES:-InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml TargetConfig.yaml ExtFeaturesConfig.yaml Baseline.yaml}" | ||
|
|
||
| # common/ | ||
| if [ ! -d "$COMMON_DIR" ]; then | ||
| log_warn "[CFG] Missing dir: $COMMON_DIR" | ||
| COMMON_OK=0 | ||
| COMMON_CONFIGS_OK=0 | ||
| else | ||
| for f in $REQ_COMMON_FILES; do | ||
| if [ ! -f "$COMMON_DIR/$f" ]; then | ||
| log_warn "[CFG] Missing file: $COMMON_DIR/$f" | ||
| COMMON_OK=0 | ||
| COMMON_CONFIGS_OK=0 | ||
| fi | ||
| done | ||
| fi | ||
|
|
||
| # custom/ | ||
| if [ ! -d "$CUSTOM_DIR" ]; then | ||
| log_warn "[CFG] Missing dir: $CUSTOM_DIR" | ||
| CUSTOM_OK=0 | ||
| # tests/configs | ||
| if [ ! -d "$TEST_CONFIGS_DIR" ]; then | ||
| log_warn "[CFG] Missing dir: $TEST_CONFIGS_DIR" | ||
| TEST_CONFIGS_OK=0 | ||
| else | ||
| for f in $REQ_CUSTOM_FILES; do | ||
| if [ ! -f "$CUSTOM_DIR/$f" ]; then | ||
| log_warn "[CFG] Missing file: $CUSTOM_DIR/$f" | ||
| CUSTOM_OK=0 | ||
| for f in $REQ_TEST_FILES; do | ||
| if [ ! -f "$TEST_CONFIGS_DIR/$f" ]; then | ||
| log_warn "[CFG] Missing file: $TEST_CONFIGS_DIR/$f" | ||
| TEST_CONFIGS_OK=0 | ||
| fi | ||
| done | ||
| cn="$( | ||
| find "$CUSTOM_DIR/ResourceSysFsNodes" -mindepth 1 -maxdepth 1 -type f -print 2>/dev/null \ | ||
| | wc -l | awk '{print $1}' | ||
| )" | ||
| if [ -n "$cn" ]; then | ||
| log_info "[CFG] custom/ResourceSysFsNodes entries: $cn" | ||
| fi | ||
| fi | ||
|
|
||
| # tests nodes (hard requirement for resource_tuner_tests) | ||
| # tests/nodes (hard requirement for UrmIntegrationTests and UrmComponentTests) | ||
| if [ ! -d "$TEST_NODES_DIR" ]; then | ||
| log_warn "[CFG] Missing dir: $TEST_NODES_DIR" | ||
| NODES_OK=0 | ||
| TEST_NODES_OK=0 | ||
| else | ||
| count_nodes="$( | ||
| find "$TEST_NODES_DIR" -mindepth 1 -maxdepth 1 -type f -print 2>/dev/null \ | ||
| | wc -l | awk '{print $1}' | ||
| )" | ||
| if [ "${count_nodes:-0}" -le 0 ]; then | ||
| log_warn "[CFG] $TEST_NODES_DIR is empty" | ||
| NODES_OK=0 | ||
| TEST_NODES_OK=0 | ||
| fi | ||
| fi | ||
|
|
||
|
|
@@ -399,26 +370,16 @@ run_one() { | |
| return 2 | ||
| fi | ||
|
|
||
| # base config requirement: accept common OR custom; skip only if BOTH missing | ||
| # base config requirement: accept common OR tests; skip only if BOTH missing | ||
| if suite_requires_base_cfgs "$name"; then | ||
| if [ $COMMON_OK -eq 0 ] && [ $CUSTOM_OK -eq 0 ]; then | ||
| if [ $COMMON_CONFIGS_OK -eq 0 ] && [ $TEST_CONFIGS_OK -eq 0 ] && [ $TEST_NODES_OK -eq 0 ]; then | ||
| log_skip "[CFG] Base configs missing (common/ AND custom/) — skipping $name" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still says custom/, but the new path is tests/configs. Please update the message so runtime logs match the new layout. |
||
| echo "SKIP" >"$tres" | ||
| echo "[SKIP] $name – base configs missing" >>"$LOGDIR/summary.txt" | ||
| return 2 | ||
| fi | ||
| fi | ||
|
|
||
| # resource_tuner_tests also needs test nodes | ||
| if [ "$name" = "resource_tuner_tests" ]; then | ||
| if [ $NODES_OK -eq 0 ]; then | ||
| log_skip "[CFG] Test ResourceSysFsNodes missing/empty — skipping $name" | ||
| echo "SKIP" >"$tres" | ||
| echo "[SKIP] $name – test nodes missing" >>"$LOGDIR/summary.txt" | ||
| return 2 | ||
| fi | ||
| fi | ||
|
|
||
| # resolve binary | ||
| if [ ! -x "$bin" ] && command -v "$bin" >/dev/null 2>&1; then | ||
| bin="$(command -v "$bin")" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this changes the gating semantics in a risky way. tests/nodes looks like a required input for the URM suites, but with this condition the suite will still run when configs are present and tests/nodes is missing. Should the nodes check remain a separate per-suite skip, instead of being folded into the “all three missing” condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the update test suites, both tests/nodes and tests/configs are required input, in addition to common configs.
The goal is since, running test case with tests/nodes present but tests/configs (or the other way around) does not make sense, hence a more exhaustive check needs to be added to see if all 3 requirements are satisfied. I'll make the code level checks, and change the comments as appropriate.