Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions Runner/suites/Kernel/DEBUG/TPDM-Enable-Disable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This test acts as a stress test for the Coresight Trace Port Debug Module (TPDM)
## Test Goals

- Validate the stability of the TPDM drivers under repeated enable/disable cycles.
- Ensure all TPDM sources can be successfully toggled without causing system hangs or crashes.
- Ensure all TPDM sources can be successfully toggled with ETF/ETR sinks enabled without causing system hangs or crashes.
- Verify that sysfs states correctly reflect the enabled/disabled status across multiple rapid transitions.
- Ensure 100% success rate across 50 iterations for pass criteria.

Expand Down Expand Up @@ -50,18 +50,29 @@ Run the script directly via the framework:
## Example Output

```
[INFO] 2026-03-23 05:42:18 - -----------------------------------------------------------------------------------------
[INFO] 2026-03-23 05:42:18 - -------------------Starting TPDM-Enable-Disable Testcase----------------------------
[INFO] 2026-03-23 05:42:18 - Iteration: 0 - PASS
[INFO] 2026-03-23 05:42:19 - Iteration: 1 - PASS
[INFO] 2026-03-23 05:42:19 - Iteration: 2 - PASS
[INFO] 2026-03-23 05:42:20 - Iteration: 3 - PASS
[INFO] 2026-03-23 05:42:20 - Iteration: 4 - PASS
.....
[INFO] 2026-03-23 05:42:38 - Iteration: 49 - PASS
[INFO] 2026-03-23 05:42:39 - Iteration: 50 - PASS
[PASS] 2026-03-23 05:42:39 - -------------enable/disable TPDMs Test PASS-------------
[INFO] 2026-03-23 05:42:39 - -------------------TPDM-Enable-Disable Testcase Finished----------------------------
[INFO] 2025-06-03 20:49:13 - -----------------------------------------------------------------------------------------
[INFO] 2025-06-03 20:49:13 - -------------------Starting TPDM-Enable-Disable Testcase----------------------------
[INFO] 2025-06-03 20:49:13 - Running with ETF sink
[INFO] 2025-06-03 20:49:14 - Iteration: 0 - PASS
[INFO] 2025-06-03 20:49:15 - Iteration: 1 - PASS
[INFO] 2025-06-03 20:49:15 - Iteration: 2 - PASS
[INFO] 2025-06-03 20:49:16 - Iteration: 3 - PASS
[INFO] 2025-06-03 20:49:17 - Iteration: 4 - PASS

[INFO] 2025-06-03 20:49:47 - Iteration: 49 - PASS
[INFO] 2025-06-03 20:49:48 - Iteration: 50 - PASS

[INFO] 2025-06-03 20:49:48 - Running with ETR sink
[INFO] 2025-06-03 20:49:48 - Iteration: 0 - PASS
[INFO] 2025-06-03 20:49:49 - Iteration: 1 - PASS
[INFO] 2025-06-03 20:49:49 - Iteration: 2 - PASS
[INFO] 2025-06-03 20:49:50 - Iteration: 3 - PASS
[INFO] 2025-06-03 20:49:50 - Iteration: 4 - PASS

[INFO] 2025-06-03 20:50:12 - Iteration: 49 - PASS
[INFO] 2025-06-03 20:50:12 - Iteration: 50 - PASS
[PASS] 2025-06-03 20:50:12 - -------------enable/disable TPDMs Test PASS-------------
[INFO] 2025-06-03 20:50:12 - -------------------TPDM-Enable-Disable Testcase Finished----------------------------
```

## Return Code
Expand Down
110 changes: 62 additions & 48 deletions Runner/suites/Kernel/DEBUG/TPDM-Enable-Disable/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ log_info "-------------------Starting $TESTNAME Testcase------------------------
cs_base="/sys/bus/coresight/devices"

etf_path=$(find_path "tmc_etf0" "tmc_etf" "tmc_etf1" "coresight-tmc_etf" "coresight-tmc_etf0")
if [ -z "$etf_path" ]; then
log_fail "TMC-ETF sink not found. Cannot proceed."
etr_path=$(find_path "tmc_etr0" "tmc_etr" "tmc_etr1" "coresight-tmc_etr" "coresight-tmc_etr0")
if [ -z "$etf_path" ] || [ -z "$etr_path" ]; 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.

[P2] Preserve ETF-only coverage when adding ETR

This now requires both sink types before running any source checks. A configuration with usable TPDM/ETF devices but no registered ETR previously reached the ETF test and now immediately reports FAIL, even though its existing ETF path can still be tested. A focused comparison of the old and new discovery gates confirms that change.

Discover the sink types independently and run the available, reachable sink subcases. Report an unavailable optional ETR subcase as SKIP without dropping ETF coverage. If ETR is meant to be mandatory for a particular target, make that requirement explicit rather than imposing it on every invocation. Update the README applicability accordingly.

log_fail "TMC-ETF or TMC-ETR sink not found. Cannot proceed."
echo "$TESTNAME FAIL" > "$res_file"
exit 0
fi
Expand All @@ -56,55 +57,68 @@ if [ "$tpdm_count" -eq 0 ]; then
fi

fail=0
i=0

reset_devices

[ -f "$etf_path/enable_sink" ] && echo 1 > "$etf_path/enable_sink" 2>/dev/null

while [ "$i" -le 50 ]; do
iter_fail=0

for node_path in "$cs_base"/tpdm* "$cs_base"/coresight-tpdm*; do
[ ! -d "$node_path" ] && continue

node_name=$(basename "$node_path")

if echo "$node_name" | grep -q "tpdm-turing-llm"; then
continue
fi

if [ ! -f "$node_path/enable_source" ]; then
continue
fi

echo 1 > "$node_path/enable_source" 2>/dev/null
if [ "$(cat "$node_path/enable_source" 2>/dev/null)" != "1" ]; then
iter_fail=1
log_fail "Iter $i: Failed to enable $node_name"
echo "$TESTNAME FAIL" > "$res_file"
fi

echo 0 > "$node_path/enable_source" 2>/dev/null
if [ "$(cat "$node_path/enable_source" 2>/dev/null)" = "1" ]; then
iter_fail=1
log_fail "Iter $i: Failed to disable $node_name"
echo "$TESTNAME FAIL" > "$res_file"
fi
done

if [ "$iter_fail" -eq 0 ]; then
log_info "Iteration: $i - PASS"

for sink_path in "$etf_path" "$etr_path"; do
if [ "$sink_path" = "$etf_path" ]; then
sink_name="ETF"
else
log_fail "Iteration: $i - FAIL"
fail=1
sink_name="ETR"
fi

i=$((i+1))
done

[ -f "$etf_path/enable_sink" ] && echo 0 > "$etf_path/enable_sink" 2>/dev/null
reset_devices
log_info "Running with $sink_name sink"

reset_devices

[ -f "$sink_path/enable_sink" ] && echo 1 > "$sink_path/enable_sink" 2>/dev/null

i=0

while [ "$i" -le 50 ]; do
iter_fail=0

for node_path in "$cs_base"/tpdm* "$cs_base"/coresight-tpdm*; do
[ ! -d "$node_path" ] && continue

node_name=$(basename "$node_path")

if echo "$node_name" | grep -q "tpdm-turing-llm"; then
continue
fi

if [ ! -f "$node_path/enable_source" ]; then
continue
fi

echo 1 > "$node_path/enable_source" 2>/dev/null

if [ "$(cat "$node_path/enable_source" 2>/dev/null)" != "1" ]; then
iter_fail=1
log_fail "Iter $i: Failed to enable $node_name with $sink_name sink"
echo "$TESTNAME FAIL" > "$res_file"
fi

echo 0 > "$node_path/enable_source" 2>/dev/null

if [ "$(cat "$node_path/enable_source" 2>/dev/null)" = "1" ]; then
iter_fail=1
log_fail "Iter $i: Failed to disable $node_name with $sink_name sink"
echo "$TESTNAME FAIL" > "$res_file"
fi
done

if [ "$iter_fail" -eq 0 ]; then
log_info "Iteration: $i - PASS"
else
log_fail "Iteration: $i - FAIL"
fail=1
fi

i=$((i + 1))
done

[ -f "$sink_path/enable_sink" ] && echo 0 > "$sink_path/enable_sink" 2>/dev/null
reset_devices
Comment on lines +119 to +120

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.

[P2] Include ETR cleanup failures in the final result

The new ETR phase ignores both the sink-clear status and the reset outcome. If source toggling succeeds but clearing ETR fails and reset does not recover it, fail remains zero and the suite reports PASS while ETR is still selected for subsequent source operations. Fault-injecting rejected cleanup operations into the extracted teardown/final-result path reproduces that PASS.

Check the sink write and verify the final enable_sink readback, then include an unrecovered cleanup failure in the aggregate result. Use the same checked sink-state handling before each phase as well. The current reset_devices helper has no reliable aggregate success contract, so simply checking its last command's return code is not sufficient.

done

if [ "$fail" -eq 0 ]; then
log_pass "-------------enable/disable TPDMs Test PASS-------------"
Expand Down
Loading