Skip to content

Commit 1991e58

Browse files
authored
Merge pull request #352 from kartnema/main
userspace-resource-manager: Modify test runner for URM
2 parents 1b35419 + abf61e0 commit 1991e58

3 files changed

Lines changed: 79 additions & 133 deletions

File tree

Runner/suites/Performance/resource-tuner/README.md renamed to Runner/suites/Performance/userspace-resource-manager/README.md

Lines changed: 30 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,26 @@
1-
# `resource-tuner` Test Runner (`run.sh`)
1+
# `userspace-resource-manager` Test Runner (`run.sh`)
22

3-
A pinned **whitelist** test runner for `resource-tuner` that produces per-suite logs and an overall gating result for CI.
3+
A pinned **whitelist** test runner for `userspace-resource-manager` that produces per-suite logs and an overall gating result for CI.
44

55
---
66

77
## What this runs
88

99
Only these binaries are executed, in this order (anything else is ignored):
1010
```
11-
/usr/bin/ClientDataManagerTests
12-
/usr/bin/ResourceProcessorTests
13-
/usr/bin/MemoryPoolTests
14-
/usr/bin/SignalConfigProcessorTests
15-
/usr/bin/DeviceInfoTests
16-
/usr/bin/ThreadPoolTests
17-
/usr/bin/MiscTests
18-
/usr/bin/SignalParsingTests
19-
/usr/bin/SafeOpsTests
20-
/usr/bin/ExtensionIntfTests
21-
/usr/bin/RateLimiterTests
22-
/usr/bin/SysConfigAPITests
23-
/usr/bin/ExtFeaturesParsingTests
24-
/usr/bin/RequestMapTests
25-
/usr/bin/TargetConfigProcessorTests
26-
/usr/bin/InitConfigParsingTests
27-
/usr/bin/RequestQueueTests
28-
/usr/bin/CocoTableTests
29-
/usr/bin/ResourceParsingTests
30-
/usr/bin/TimerTests
31-
/usr/bin/resource_tuner_tests
11+
/usr/bin/UrmComponentTests
12+
/usr/bin/UrmIntegrationTests
3213
```
3314

3415
---
3516

3617
## Gating policy
3718

38-
* **Service check (early gate):** If `resource-tuner.service` is **not active**, the test **SKIPs overall** and exits.
19+
* **Service check (early gate):** If `urm.service` is **not active**, the test **SKIPs overall** and exits.
3920
* **Per‑suite SKIP conditions (neutral):**
4021
* Missing binary → **SKIP that suite**, continue.
4122
* Missing base configs → **SKIP that suite**, continue.
42-
* Missing test nodes for `resource_tuner_tests` **SKIP that suite**, continue.
23+
* Missing test nodes → **SKIP that suite**, continue.
4324
* **Final result:**
4425
* If **any** suite **FAILS****overall FAIL**.
4526
* Else if **≥1** suite **PASS****overall PASS**.
@@ -52,29 +33,31 @@ Only these binaries are executed, in this order (anything else is ignored):
5233
## Pre‑checks
5334

5435
### 1) Service
55-
The runner uses the repo helper `check_systemd_services()` to verify **`resource-tuner.service`** is active.
36+
The runner uses the repo helper `check_systemd_services()` to verify **`urm.service`** is active.
5637
- On failure: overall **SKIP** (ends early).
5738
- Override service name: `SERVICE_NAME=your.service ./run.sh`
5839

5940
### 2) Config presence
60-
Suites that parse configs require **at least one** of these base config trees:
41+
Suites that parse configs require **all** of these base config trees:
6142

6243
- `common/` (required files):
6344
- `InitConfig.yaml`, `PropertiesConfig.yaml`, `ResourcesConfig.yaml`, `SignalsConfig.yaml`
6445

65-
- `custom/` (required files):
66-
- `InitConfig.yaml`, `PropertiesConfig.yaml`, `ResourcesConfig.yaml`, `SignalsConfig.yaml`, `TargetConfig.yaml`, `ExtFeaturesConfig.yaml`
46+
- `tests/configs/` (required files):
47+
- `InitConfig.yaml`, `PropertiesConfig.yaml`, `ResourcesConfig.yaml`, `SignalsConfig.yaml`, `TargetConfig.yaml`, `ExtFeaturesConfig.yaml`, `Baseline.yaml`
6748

68-
If **both** trees are missing required files/dirs, config‑parsing suites are **SKIP** only (neutral).
49+
- `tests/nodes/` (must exist and be non-empty):
50+
51+
If **any** of these trees are missing required files/dirs, config‑parsing suites are **SKIP** only (neutral).
6952

7053
> Override required file lists without editing the script:
7154
```bash
72-
export RT_REQUIRE_COMMON_FILES="InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml"
73-
export RT_REQUIRE_CUSTOM_FILES="InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml TargetConfig.yaml ExtFeaturesConfig.yaml"
55+
export URM_REQUIRE_COMMON_FILES="InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml"
56+
export URM_REQUIRE_TEST_FILES="InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml TargetConfig.yaml ExtFeaturesConfig.yaml Baseline.yaml"
7457
```
7558

76-
### 3) Test ResourceSysFsNodes
77-
`/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**.
59+
### 3) Test test nodes
60+
`/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**.
7861

7962
### 4) Base tools
8063
Requires: `awk`, `grep`, `date`, `printf`. If missing → **overall SKIP**.
@@ -93,21 +76,21 @@ Usage: ./run.sh [--all] [--bin <name|absolute>] [--list] [--timeout SECS]
9376
- `--timeout SECS`: default per‑binary timeout **if** `run_with_timeout()` helper exists (else ignored).
9477

9578
Per‑suite default timeouts (if helper is present):
96-
- `ThreadPoolTests`, `RateLimiterTests`: **1800s**
97-
- `resource_tuner_tests`: **2400s**
79+
- `UrmComponentTests`: **1800s**
80+
- `UrmIntegrationTests`: **2400s**
9881
- others: **1200s** (default)
9982

10083
---
10184

10285
## Output layout
10386

104-
- **Overall status file:** `./resource-tuner.res``PASS` / `FAIL` / `SKIP`
105-
- **Logs directory:** `./logs/resource-tuner-YYYYMMDD-HHMMSS/`
87+
- **Overall status file:** `./userspace-resource-manager.res``PASS` / `FAIL` / `SKIP`
88+
- **Logs directory:** `./logs/userspace-resource-manager-YYYYMMDD-HHMMSS/`
10689
- Per‑suite logs: `SUITE.log`
10790
- Per‑suite result markers: `SUITE.res` (`PASS`/`FAIL`/`SKIP`)
10891
- Coverage summaries: `coverage.txt`, `missing_bins.txt`, `coverage_counts.env`
10992
- System snapshot: `dmesg_snapshot.log`
110-
- **Symlink to latest:** `./logs/resource-tuner-latest`
93+
- **Symlink to latest:** `./logs/userspace-resource-manager-latest`
11194

11295
**Parsing heuristics:** a suite is considered PASS if the binary exits 0 **or** its log contains
11396
`Run Successful`, `executed successfully`, or `Ran Successfully`. Strings like `Assertion failed`, `Terminating Suite`, `Segmentation fault`, `Backtrace`, or `fail/failed` mark **FAIL**.
@@ -116,9 +99,9 @@ Per‑suite default timeouts (if helper is present):
11699

117100
## Environment overrides
118101

119-
- `SERVICE_NAME`: systemd unit to check (default: `resource-tuner.service`)
120-
- `RT_CONFIG_DIR`: root of config tree (default: `/etc/resource-tuner`)
121-
- `RT_REQUIRE_COMMON_FILES`, `RT_REQUIRE_CUSTOM_FILES`: *space‑separated* filenames that must exist in `common/` / `custom/` respectively to treat that tree as present.
102+
- `SERVICE_NAME`: systemd unit to check (default: `urm.service`)
103+
- `URM_CONFIG_DIR`: root of config tree (default: `/etc/urm`)
104+
- `URM_REQUIRE_COMMON_FILES`, `URM_REQUIRE_TEST_FILES`: *space‑separated* filenames that must exist in `common/` / `tests/` respectively to treat that tree as present.
122105

123106
---
124107

@@ -131,7 +114,7 @@ Run all (normal CI mode):
131114

132115
Run a single suite by basename:
133116
```bash
134-
./run.sh --bin ResourceParsingTests
117+
./run.sh --bin UrmComponentTests
135118
```
136119

137120
List suites and presence coverage:
@@ -141,21 +124,21 @@ List suites and presence coverage:
141124

142125
Use a different config root:
143126
```bash
144-
RT_CONFIG_DIR=/opt/rt/etc ./run.sh
127+
URM_CONFIG_DIR=/opt/rt/etc ./run.sh
145128
```
146129

147130
---
148131

149132
## Exit status
150133

151-
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.
134+
The script writes the overall result to `userspace-resource-manager.res`. The **process exit code is 0** in case of SUCCESS, while the **exit code is 1** in case of overall FAILURE.
152135

153136
---
154137

155138
## Troubleshooting
156139

157-
- **Overall SKIP immediately** → service inactive. Check `systemctl status resource-tuner.service`.
158-
- **Suite SKIP (config)** → confirm required files exist under `common/` or `custom/` (see lists above).
140+
- **Overall SKIP immediately** → service inactive. Check `systemctl status urm.service`.
141+
- **Suite SKIP (config)** → confirm required files exist under `common/`, `tests/configs` and `tests/nodes` (see lists above).
159142
- **Suite SKIP (missing bin)** → verify the binary is installed and executable under `/usr/bin`.
160143
- **Suite FAIL** → inspect `logs/.../SUITE.log` for the first failure pattern or assertion.
161144
- **Very long runs** → a `run_with_timeout` helper (if available in your repo toolchain) will be used automatically.

Runner/suites/Performance/resource-tuner/run.sh renamed to Runner/suites/Performance/userspace-resource-manager/run.sh

Lines changed: 45 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/sh
22
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
3-
# SPDX-License-Identifier: BSD-3-Clause# resource-tuner test runner (pinned whitelist)
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
# userspace-resource-manager test runner (pinned whitelist)
45

56
# ---------- Repo env + helpers ----------
67
SCRIPT_DIR="$(
@@ -37,7 +38,7 @@ export PATH="/usr/sbin:/sbin:/usr/bin:/bin:${PATH}"
3738
# shellcheck disable=SC3045
3839
( ulimit -c unlimited ) >/dev/null 2>&1 || true
3940

40-
TESTNAME="resource-tuner"
41+
TESTNAME="userspace-resource-manager"
4142
test_path="$(find_test_case_by_name "$TESTNAME")"
4243
cd "$test_path" || exit 1
4344
RES_FILE="./${TESTNAME}.res"
@@ -62,42 +63,20 @@ fi
6263

6364
# ---------- Approved list (pinned whitelist) ----------
6465
APPROVED_TESTS="
65-
/usr/bin/ClientDataManagerTests
66-
/usr/bin/ResourceProcessorTests
67-
/usr/bin/MemoryPoolTests
68-
/usr/bin/SignalConfigProcessorTests
69-
/usr/bin/DeviceInfoTests
70-
/usr/bin/ThreadPoolTests
71-
/usr/bin/MiscTests
72-
/usr/bin/SignalParsingTests
73-
/usr/bin/SafeOpsTests
74-
/usr/bin/ExtensionIntfTests
75-
/usr/bin/RateLimiterTests
76-
/usr/bin/SysConfigAPITests
77-
/usr/bin/ExtFeaturesParsingTests
78-
/usr/bin/RequestMapTests
79-
/usr/bin/TargetConfigProcessorTests
80-
/usr/bin/InitConfigParsingTests
81-
/usr/bin/RequestQueueTests
82-
/usr/bin/CocoTableTests
83-
/usr/bin/ResourceParsingTests
84-
/usr/bin/TimerTests
85-
/usr/bin/resource_tuner_tests
66+
/usr/bin/UrmComponentTests
67+
/usr/bin/UrmIntegrationTests
8668
"
8769

88-
# Suites that need base configs (accept either common/ OR custom/)
89-
SUITES_REQUIRE_BASE_CFGS="ResourceProcessorTests SignalConfigProcessorTests SysConfigAPITests \
90-
ExtFeaturesParsingTests TargetConfigProcessorTests InitConfigParsingTests \
91-
ResourceParsingTests ExtensionIntfTests resource_tuner_tests"
70+
# Suites that need base configs (all of common/, tests/configs and tests/nodes are needed)
71+
SUITES_REQUIRE_BASE_CFGS="UrmComponentTests UrmIntegrationTests"
9272

9373
# ---------- CLI ----------
9474
print_usage() {
9575
cat <<EOF
9676
Usage: $0 [--all] [--bin <name|absolute>] [--list] [--timeout SECS]
9777
Policy:
9878
- Service INACTIVE => overall SKIP (end early)
99-
- Base configs: suites require common/ OR custom/ (skip only if BOTH missing)
100-
- resource_tuner_tests additionally needs tests/Configs/ResourceSysFsNodes
79+
- Base configs: suites require common/, tests/configs and tests/nodes (skip if any of them are missing)
10180
- Any test FAIL => overall FAIL
10281
- No FAIL & PASS>0 => overall PASS
10382
- No FAIL & PASS=0 => overall SKIP (everything skipped)
@@ -180,10 +159,10 @@ parse_and_score_log() {
180159
}
181160
per_suite_timeout() {
182161
case "$1" in
183-
ThreadPoolTests|RateLimiterTests)
162+
UrmComponentTests)
184163
echo 1800
185164
;;
186-
resource_tuner_tests)
165+
UrmIntegrationTests)
187166
echo 2400
188167
;;
189168
*)
@@ -225,18 +204,18 @@ if command -v log_soc_info >/dev/null 2>&1; then
225204
fi
226205

227206
# ---------- Service gate (use repo helper) ----------
228-
SERVICE_NAME="${SERVICE_NAME:-resource-tuner.service}"
207+
SERVICE_NAME="${SERVICE_NAME:-urm.service}"
229208
log_info "[SERVICE] Checking $SERVICE_NAME via check_systemd_services()"
230209
if check_systemd_services "$SERVICE_NAME"; then
231210
log_pass "[SERVICE] $SERVICE_NAME is active"
232211
else
233212
log_warn "[SERVICE] $SERVICE_NAME not active — attempting enable/start"
234213

235214
if command -v systemctl >/dev/null 2>&1; then
236-
systemctl enable resource-tuner >/dev/null 2>&1 || true
215+
systemctl enable urm >/dev/null 2>&1 || true
237216
systemctl daemon-reload >/dev/null 2>&1 || true
238-
systemctl start resource-tuner >/dev/null 2>&1 || true
239-
systemctl status resource-tuner --no-pager -l >/dev/null 2>&1 || true
217+
systemctl start urm >/dev/null 2>&1 || true
218+
systemctl status urm --no-pager -l >/dev/null 2>&1 || true
240219
else
241220
log_warn "[SERVICE] systemctl not available; cannot auto-start $SERVICE_NAME"
242221
fi
@@ -250,64 +229,57 @@ else
250229
fi
251230
fi
252231

253-
# ---------- Config preflight (check both common/ and custom/) ----------
254-
RT_CONFIG_DIR="${RT_CONFIG_DIR:-/etc/resource-tuner}"
255-
COMMON_DIR="$RT_CONFIG_DIR/common"
256-
CUSTOM_DIR="$RT_CONFIG_DIR/custom"
257-
TEST_NODES_DIR="$RT_CONFIG_DIR/tests/Configs/ResourceSysFsNodes"
232+
# ---------- Config preflight (check both common/ and tests/) ----------
233+
URM_CONFIG_DIR="${URM_CONFIG_DIR:-/etc/urm}"
234+
COMMON_CONFIGS_DIR="$URM_CONFIG_DIR/common"
235+
TEST_CONFIGS_DIR="$URM_CONFIG_DIR/tests/configs"
236+
TEST_NODES_DIR="$URM_CONFIG_DIR/tests/nodes"
258237

259-
COMMON_OK=1
260-
CUSTOM_OK=1
261-
NODES_OK=1
238+
COMMON_CONFIGS_OK=1
239+
TEST_CONFIGS_OK=1
240+
TEST_NODES_OK=1
262241

263-
REQ_COMMON_FILES="${RT_REQUIRE_COMMON_FILES:-InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml}"
264-
REQ_CUSTOM_FILES="${RT_REQUIRE_CUSTOM_FILES:-InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml TargetConfig.yaml ExtFeaturesConfig.yaml}"
242+
REQ_COMMON_FILES="${URM_REQUIRE_COMMON_FILES:-InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml}"
243+
REQ_TEST_CONFIGS="${URM_REQUIRE_TEST_FILES:-InitConfig.yaml PropertiesConfig.yaml ResourcesConfig.yaml SignalsConfig.yaml TargetConfig.yaml ExtFeaturesConfig.yaml Baseline.yaml}"
265244

266245
# common/
267-
if [ ! -d "$COMMON_DIR" ]; then
268-
log_warn "[CFG] Missing dir: $COMMON_DIR"
269-
COMMON_OK=0
246+
if [ ! -d "$COMMON_CONFIGS_DIR" ]; then
247+
log_warn "[CFG] Missing dir: $COMMON_CONFIGS_DIR"
248+
COMMON_CONFIGS_OK=0
270249
else
271250
for f in $REQ_COMMON_FILES; do
272-
if [ ! -f "$COMMON_DIR/$f" ]; then
273-
log_warn "[CFG] Missing file: $COMMON_DIR/$f"
274-
COMMON_OK=0
251+
if [ ! -f "$COMMON_CONFIGS_DIR/$f" ]; then
252+
log_warn "[CFG] Missing file: $COMMON_CONFIGS_DIR/$f"
253+
COMMON_CONFIGS_OK=0
275254
fi
276255
done
277256
fi
278257

279-
# custom/
280-
if [ ! -d "$CUSTOM_DIR" ]; then
281-
log_warn "[CFG] Missing dir: $CUSTOM_DIR"
282-
CUSTOM_OK=0
258+
# tests/configs
259+
if [ ! -d "$TEST_CONFIGS_DIR" ]; then
260+
log_warn "[CFG] Missing dir: $TEST_CONFIGS_DIR"
261+
TEST_CONFIGS_OK=0
283262
else
284-
for f in $REQ_CUSTOM_FILES; do
285-
if [ ! -f "$CUSTOM_DIR/$f" ]; then
286-
log_warn "[CFG] Missing file: $CUSTOM_DIR/$f"
287-
CUSTOM_OK=0
263+
for f in $REQ_TEST_CONFIGS; do
264+
if [ ! -f "$TEST_CONFIGS_DIR/$f" ]; then
265+
log_warn "[CFG] Missing file: $TEST_CONFIGS_DIR/$f"
266+
TEST_CONFIGS_OK=0
288267
fi
289268
done
290-
cn="$(
291-
find "$CUSTOM_DIR/ResourceSysFsNodes" -mindepth 1 -maxdepth 1 -type f -print 2>/dev/null \
292-
| wc -l | awk '{print $1}'
293-
)"
294-
if [ -n "$cn" ]; then
295-
log_info "[CFG] custom/ResourceSysFsNodes entries: $cn"
296-
fi
297269
fi
298270

299-
# tests nodes (hard requirement for resource_tuner_tests)
271+
# tests/nodes (hard requirement for UrmIntegrationTests and UrmComponentTests)
300272
if [ ! -d "$TEST_NODES_DIR" ]; then
301273
log_warn "[CFG] Missing dir: $TEST_NODES_DIR"
302-
NODES_OK=0
274+
TEST_NODES_OK=0
303275
else
304276
count_nodes="$(
305277
find "$TEST_NODES_DIR" -mindepth 1 -maxdepth 1 -type f -print 2>/dev/null \
306278
| wc -l | awk '{print $1}'
307279
)"
308280
if [ "${count_nodes:-0}" -le 0 ]; then
309281
log_warn "[CFG] $TEST_NODES_DIR is empty"
310-
NODES_OK=0
282+
TEST_NODES_OK=0
311283
fi
312284
fi
313285

@@ -399,26 +371,17 @@ run_one() {
399371
return 2
400372
fi
401373

402-
# base config requirement: accept common OR custom; skip only if BOTH missing
374+
# base config requirement: common configs, tests/configs as well as tests/nodes
375+
# If any of them are missing, skip.
403376
if suite_requires_base_cfgs "$name"; then
404-
if [ $COMMON_OK -eq 0 ] && [ $CUSTOM_OK -eq 0 ]; then
405-
log_skip "[CFG] Base configs missing (common/ AND custom/) — skipping $name"
377+
if [ $COMMON_CONFIGS_OK -eq 0 ] || [ $TEST_CONFIGS_OK -eq 0 ] || [ $TEST_NODES_OK -eq 0 ]; then
378+
log_skip "[CFG] Base configs missing (one or more of common/, tests/configs or tests/nodes not found) — skipping $name"
406379
echo "SKIP" >"$tres"
407380
echo "[SKIP] $name – base configs missing" >>"$LOGDIR/summary.txt"
408381
return 2
409382
fi
410383
fi
411384

412-
# resource_tuner_tests also needs test nodes
413-
if [ "$name" = "resource_tuner_tests" ]; then
414-
if [ $NODES_OK -eq 0 ]; then
415-
log_skip "[CFG] Test ResourceSysFsNodes missing/empty — skipping $name"
416-
echo "SKIP" >"$tres"
417-
echo "[SKIP] $name – test nodes missing" >>"$LOGDIR/summary.txt"
418-
return 2
419-
fi
420-
fi
421-
422385
# resolve binary
423386
if [ ! -x "$bin" ] && command -v "$bin" >/dev/null 2>&1; then
424387
bin="$(command -v "$bin")"

0 commit comments

Comments
 (0)