From a95870628186d973625c36705807de68c7602731 Mon Sep 17 00:00:00 2001 From: Kartik Nema Date: Tue, 17 Mar 2026 11:44:40 +0530 Subject: [PATCH] Modify test runner for URM Signed-off-by: Kartik Nema --- .../README.md | 65 ++++------ .../run.sh | 113 ++++++------------ .../userspace-resource-manager.yaml} | 8 +- 3 files changed, 64 insertions(+), 122 deletions(-) rename Runner/suites/Performance/{resource-tuner => userspace-resource-manager}/README.md (60%) rename Runner/suites/Performance/{resource-tuner => userspace-resource-manager}/run.sh (78%) rename Runner/suites/Performance/{resource-tuner/resource-tuner.yaml => userspace-resource-manager/userspace-resource-manager.yaml} (50%) diff --git a/Runner/suites/Performance/resource-tuner/README.md b/Runner/suites/Performance/userspace-resource-manager/README.md similarity index 60% rename from Runner/suites/Performance/resource-tuner/README.md rename to Runner/suites/Performance/userspace-resource-manager/README.md index 026a625d..d1cf2b0f 100644 --- a/Runner/suites/Performance/resource-tuner/README.md +++ b/Runner/suites/Performance/userspace-resource-manager/README.md @@ -1,6 +1,6 @@ -# `resource-tuner` Test Runner (`run.sh`) +# `userspace-resource-manager` Test Runner (`run.sh`) -A pinned **whitelist** test runner for `resource-tuner` that produces per-suite logs and an overall gating result for CI. +A pinned **whitelist** test runner for `userspace-resource-manager` that produces per-suite logs and an overall gating result for CI. --- @@ -8,38 +8,19 @@ A pinned **whitelist** test runner for `resource-tuner` that produces per-suite Only these binaries are executed, in this order (anything else is ignored): ``` -/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 ``` --- ## Gating policy -* **Service check (early gate):** If `resource-tuner.service` is **not active**, the test **SKIPs overall** and exits. +* **Service check (early gate):** If `urm.service` is **not active**, the test **SKIPs overall** and exits. * **Per‑suite SKIP conditions (neutral):** * Missing binary → **SKIP that suite**, continue. * Missing base configs → **SKIP that suite**, continue. - * Missing test nodes for `resource_tuner_tests` → **SKIP that suite**, continue. + * Missing test nodes for `UrmIntegrationTests` → **SKIP that suite**, continue. * **Final result:** * If **any** suite **FAILS** → **overall FAIL**. * Else if **≥1** suite **PASS** → **overall PASS**. @@ -52,7 +33,7 @@ Only these binaries are executed, in this order (anything else is ignored): ## Pre‑checks ### 1) Service -The runner uses the repo helper `check_systemd_services()` to verify **`resource-tuner.service`** is active. +The runner uses the repo helper `check_systemd_services()` to verify **`urm.service`** is active. - On failure: overall **SKIP** (ends early). - Override service name: `SERVICE_NAME=your.service ./run.sh` @@ -62,7 +43,7 @@ Suites that parse configs require **at least one** of these base config trees: - `common/` (required files): - `InitConfig.yaml`, `PropertiesConfig.yaml`, `ResourcesConfig.yaml`, `SignalsConfig.yaml` -- `custom/` (required files): +- `tests/configs/` (required files): - `InitConfig.yaml`, `PropertiesConfig.yaml`, `ResourcesConfig.yaml`, `SignalsConfig.yaml`, `TargetConfig.yaml`, `ExtFeaturesConfig.yaml` If **both** trees are missing required files/dirs, config‑parsing suites are **SKIP** only (neutral). @@ -70,11 +51,11 @@ If **both** trees are missing required files/dirs, config‑parsing suites are * > Override required file lists without editing the script: ```bash export RT_REQUIRE_COMMON_FILES="InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml" -export RT_REQUIRE_CUSTOM_FILES="InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml TargetConfig.yaml ExtFeaturesConfig.yaml" +export RT_REQUIRE_TEST_FILES="InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml TargetConfig.yaml ExtFeaturesConfig.yaml Baseline.yaml" ``` -### 3) Test ResourceSysFsNodes -`/etc/resource-tuner/tests/Configs/ResourceSysFsNodes` must exist and be non‑empty for **`/usr/bin/resource_tuner_tests`**. If missing/empty → **SKIP only that suite**. +### 3) Test test nodes +`/etc/urm/tests/nodes` must exist and be non‑empty for **`/usr/bin/UrmIntegrationTests`** and **`/usr/bin/UrmComponentTests`**. If missing/empty → **SKIP only that suite**. ### 4) Base tools Requires: `awk`, `grep`, `date`, `printf`. If missing → **overall SKIP**. @@ -93,21 +74,21 @@ Usage: ./run.sh [--all] [--bin ] [--list] [--timeout SECS] - `--timeout SECS`: default per‑binary timeout **if** `run_with_timeout()` helper exists (else ignored). Per‑suite default timeouts (if helper is present): -- `ThreadPoolTests`, `RateLimiterTests`: **1800s** -- `resource_tuner_tests`: **2400s** +- `UrmComponentTests`: **1800s** +- `UrmIntegrationTests`: **2400s** - others: **1200s** (default) --- ## Output layout -- **Overall status file:** `./resource-tuner.res` → `PASS` / `FAIL` / `SKIP` -- **Logs directory:** `./logs/resource-tuner-YYYYMMDD-HHMMSS/` +- **Overall status file:** `./userspace-resource-manager.res` → `PASS` / `FAIL` / `SKIP` +- **Logs directory:** `./logs/userspace-resource-manager-YYYYMMDD-HHMMSS/` - Per‑suite logs: `SUITE.log` - Per‑suite result markers: `SUITE.res` (`PASS`/`FAIL`/`SKIP`) - Coverage summaries: `coverage.txt`, `missing_bins.txt`, `coverage_counts.env` - System snapshot: `dmesg_snapshot.log` -- **Symlink to latest:** `./logs/resource-tuner-latest` +- **Symlink to latest:** `./logs/userspace-resource-manager-latest` **Parsing heuristics:** a suite is considered PASS if the binary exits 0 **or** its log contains `Run Successful`, `executed successfully`, or `Ran Successfully`. Strings like `Assertion failed`, `Terminating Suite`, `Segmentation fault`, `Backtrace`, or `fail/failed` mark **FAIL**. @@ -116,9 +97,9 @@ Per‑suite default timeouts (if helper is present): ## Environment overrides -- `SERVICE_NAME`: systemd unit to check (default: `resource-tuner.service`) -- `RT_CONFIG_DIR`: root of config tree (default: `/etc/resource-tuner`) -- `RT_REQUIRE_COMMON_FILES`, `RT_REQUIRE_CUSTOM_FILES`: *space‑separated* filenames that must exist in `common/` / `custom/` respectively to treat that tree as present. +- `SERVICE_NAME`: systemd unit to check (default: `urm.service`) +- `RT_CONFIG_DIR`: root of config tree (default: `/etc/urm`) +- `RT_REQUIRE_COMMON_FILES`, `RT_REQUIRE_CUSTOM_FILES`: *space‑separated* filenames that must exist in `common/` / `tests/` respectively to treat that tree as present. --- @@ -131,7 +112,7 @@ Run all (normal CI mode): Run a single suite by basename: ```bash -./run.sh --bin ResourceParsingTests +./run.sh --bin UrmComponentTests ``` List suites and presence coverage: @@ -148,14 +129,14 @@ RT_CONFIG_DIR=/opt/rt/etc ./run.sh ## Exit status -The script writes the overall result to `resource-tuner.res`. The **process exit code is 0** in all cases in the current version (soft gating). If you want hard CI gating via non‑zero exit on FAIL, that can be added easily on request. +The script writes the overall result to `userspace-resource-manager.res`. The **process exit code is 0** in all cases in the current version (soft gating). If you want hard CI gating via non‑zero exit on FAIL, that can be added easily on request. --- ## Troubleshooting -- **Overall SKIP immediately** → service inactive. Check `systemctl status resource-tuner.service`. -- **Suite SKIP (config)** → confirm required files exist under `common/` or `custom/` (see lists above). +- **Overall SKIP immediately** → service inactive. Check `systemctl status urm.service`. +- **Suite SKIP (config)** → confirm required files exist under `common/` or `tests/` (see lists above). - **Suite SKIP (missing bin)** → verify the binary is installed and executable under `/usr/bin`. - **Suite FAIL** → inspect `logs/.../SUITE.log` for the first failure pattern or assertion. - **Very long runs** → a `run_with_timeout` helper (if available in your repo toolchain) will be used automatically. diff --git a/Runner/suites/Performance/resource-tuner/run.sh b/Runner/suites/Performance/userspace-resource-manager/run.sh similarity index 78% rename from Runner/suites/Performance/resource-tuner/run.sh rename to Runner/suites/Performance/userspace-resource-manager/run.sh index 207cb775..e7cdc6ee 100755 --- a/Runner/suites/Performance/resource-tuner/run.sh +++ b/Runner/suites/Performance/userspace-resource-manager/run.sh @@ -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,33 +62,12 @@ 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() { @@ -96,8 +75,7 @@ print_usage() { Usage: $0 [--all] [--bin ] [--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,7 +203,7 @@ 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" @@ -233,10 +211,10 @@ 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,56 +228,49 @@ 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 \ @@ -307,7 +278,7 @@ else )" 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,9 +370,9 @@ 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" echo "SKIP" >"$tres" echo "[SKIP] $name – base configs missing" >>"$LOGDIR/summary.txt" @@ -409,16 +380,6 @@ run_one() { 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")" diff --git a/Runner/suites/Performance/resource-tuner/resource-tuner.yaml b/Runner/suites/Performance/userspace-resource-manager/userspace-resource-manager.yaml similarity index 50% rename from Runner/suites/Performance/resource-tuner/resource-tuner.yaml rename to Runner/suites/Performance/userspace-resource-manager/userspace-resource-manager.yaml index 93ea92ca..5f2a2555 100644 --- a/Runner/suites/Performance/resource-tuner/resource-tuner.yaml +++ b/Runner/suites/Performance/userspace-resource-manager/userspace-resource-manager.yaml @@ -1,7 +1,7 @@ metadata: - name: resource-tuner + name: userspace-resource-manager format: "Lava-Test Test Definition 1.0" - description: "A pinned **whitelist** test runner for `resource-tuner` that produces per-suite logs and an overall gating result for CI." + description: "A pinned **whitelist** test runner for `userspace-resource-manager` that produces per-suite logs and an overall gating result for CI." os: - linux scope: @@ -14,8 +14,8 @@ params: run: steps: - REPO_PATH=$PWD - - cd Runner/suites/Performance/resource-tuner + - cd Runner/suites/Performance/userspace-resource-manager - RUN_OPTIONS="--all" - if [ -n "${BIN_NAME}" ]; then RUN_OPTIONS="--bin ${BIN_NAME}"; fi - ./run.sh --timeout "${TIMEOUT}" ${RUN_OPTIONS} || true - - $REPO_PATH/Runner/utils/send-to-lava.sh resource-tuner.res || true + - $REPO_PATH/Runner/utils/send-to-lava.sh userspace-resource-manager.res || true