You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`rot_boot_preference(slot, action, use_transient, label)`: Sets or clears RoT preference. When clearing (`action = util::PREF_CLEAR`), uses the `component-active-slot -c` command if supported by the firmware, with automatic fallback to reset workaround for version compatibility.
94
96
-`reset_rot_and_get_rbi(desc, label)`: Resets RoT and gets RBI.
Copy file name to clipboardExpand all lines: scripts/TEST_PLAN.md
+40-22Lines changed: 40 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,28 @@
1
1
# Validation Test Plan
2
2
3
3
This document outlines a full set of tests to validate the `upgrade-rollback.rhai` test harness. It is split into two parts:
4
-
1.**Part 1**: Tests the current, real-world scenario where the new `baseline` firmware has features that the older `under-test` firmware lacks.
4
+
1.**Part 1**: Tests the current, real-world scenario where the new `under-test` firmware has features that the older `baseline` firmware lacks.
5
5
2.**Part 2**: Describes tests for a future state where both `baseline` and `under-test` firmware are fully compliant with the transient boot preference feature.
6
6
7
7
## Prerequisites and Setup
8
8
9
9
### 1. Environment Variables
10
10
11
-
Before running these tests, for convenience, set two environment variables to point to your local Hubris build repositories:
11
+
Before running these tests, for convenience, set environment variables to point to your local Hubris build repositories. For example:
12
12
```bash
13
13
export REPO_BL=/path/to/your/baseline/hubris
14
14
export REPO_UT=/path/to/your/under-test/hubris
15
+
export UT_WORKTREE=${REPO_UT}
15
16
```
16
17
17
18
These repositories must have SP and RoT Hubris build products in their
18
19
respective `target/` directories.
19
20
20
-
Examine and edit the `scripts/targets.json` file or make your own if you need
21
-
to use images from other locations.
21
+
**Note for other users**: The `scripts/targets.json` file uses these environment variables (e.g., `UT_WORKTREE`) to locate firmware images. If simple environment variable overrides are not convenient, then you will want your own configuration file like `scripts/targets.json` that reflects your local test environment.
22
22
23
23
### 2. The `FMR` Wrapper Script
24
24
25
-
The test commands use a helper script named `FMR`, which is a wrapper around the main `cargo run --bin faux-mgs` command. Its purpose is to simplify running tests by automatically including common arguments.
25
+
The test commands use a helper script named `FMR` (faux-mgs with Rhai scripting), which is a wrapper around the main `cargo run --bin faux-mgs` command. Its purpose is to simplify running tests by automatically including common arguments.
26
26
27
27
***Functionality**: The script automatically adds required arguments like `--features=rhaiscript`, `--json=pretty`, timeouts, and attempts to discover the correct network `--interface` setting.
28
28
***Log Levels**: The name used to call the script sets the log level for the test run. For example, `FMR-info` sets `--log-level=info`, while `FMR-trace` sets `--log-level=trace`.
@@ -37,8 +37,35 @@ Each numbered test case should be run from a known-clean state. Before starting
37
37
```bash
38
38
FMR-info reset-component rot
39
39
FMR-info reset-component rot
40
+
41
+
This ensures that any version of RoT firmware being used has no pending Hubris
42
+
image preferences in effect.
43
+
44
+
### 3. Copy and customize `scripts/targets.json` for your environment
45
+
46
+
```bash
47
+
TARGETS=targets-$(uname-n).json
48
+
cp scripts/targets.json $TARGETS
49
+
# Edit $TARGETS appropriately
40
50
```
41
51
52
+
Note that the `upgrade-rollback.rhai` script has a `-b` and `-u` options to
53
+
override the baseline and under-test paths in`scripts/targets.json`, so if that
54
+
is the only thing you want to change you can just use those CLI flags.
55
+
56
+
57
+
---
58
+
59
+
## Version Compatibility and Graceful Degradation
60
+
61
+
The test scripts include robust version compatibility handling for the `--cancel-pending` feature:
62
+
63
+
***Preferred Method**: When supported, the scripts use `faux-mgs component-active-slot -c` to directly clear pending persistent preferences.
64
+
***Fallback Method**: When the SP firmware doesn't support the command (indicated by a "WrongVersion" error), the scripts automatically fall back to the RoT reset workaround.
65
+
* **Seamless Operation**: This compatibility layer ensures tests work across different firmware versions without manual intervention.
66
+
67
+
During the transition period where some devices have updated firmware and others don't, the test suite will automatically use the appropriate method for each device.
68
+
42
69
---
43
70
44
71
## Part 1: Testing Asymmetric Feature Support (Current State)
@@ -50,8 +77,7 @@ FMR-info reset-component rot
50
77
***Purpose**: To verify that the primary upgrade and rollback functionality works correctly without using any of the new features.
51
78
***Command**:
52
79
```bash
53
-
FMR-info rhai scripts/upgrade-rollback.rhai -c scripts/targets.json \
54
-
-b $REPO_BL -u $REPO_UT
80
+
./FMR-info rhai scripts/upgrade-rollback.rhai -c $TARGETS
55
81
```
56
82
***Expected Outcome**: The script should complete successfully with an exit code of 0. It will upgrade to the `under-test` image and then roll back to the `baseline` image using persistent updates.
57
83
@@ -60,8 +86,7 @@ FMR-info reset-component rot
60
86
***Purpose**: To verify the script correctly handles the feature asymmetry when the transient update path is requested.
61
87
***Command**:
62
88
```bash
63
-
FMR-info rhai scripts/upgrade-rollback.rhai -c scripts/targets.json \
64
-
-b $REPO_BL -u $REPO_UT -t
89
+
./FMR-info rhai scripts/upgrade-rollback.rhai -c $TARGETS -t
65
90
```
66
91
***Expected Outcome**: The script should complete successfully with an exit code of 0. The log should show:
67
92
***Upgrade**: The active `baseline` firmware does not support the feature. The script will log a warning and use a persistent update.
@@ -72,8 +97,7 @@ FMR-info reset-component rot
72
97
***Purpose**: To verify the logic that runs (or skips) the `test_and_recover...` negative test based on feature support.
73
98
***Command**:
74
99
```bash
75
-
FMR-info rhai scripts/upgrade-rollback.rhai -c scripts/targets.json \
76
-
-b $REPO_BL -u $REPO_UT -N
100
+
./FMR-info rhai scripts/upgrade-rollback.rhai -c $TARGETS -N
77
101
```
78
102
***Expected Outcome**: The script will **fail with exit code 1**. This is the correct behavior.
79
103
***Upgrade**: The `baseline` firmware is active and does not support the transient feature. The script will detect this and, because the test is for the `ut` branch, it will log a `FATAL` error stating the `under-test` image must support the feature. This check is known to be flawed for this specific asymmetric case but correctly protects against regressions.
@@ -83,20 +107,16 @@ FMR-info reset-component rot
83
107
***Purpose**: To verify that the test harness can recover from a pre-existing `pending_persistent` preference fault.
84
108
***Command**:
85
109
```bash
86
-
FMR-info rhai scripts/upgrade-rollback.rhai -c scripts/targets.json \
87
-
-b $REPO_BL -u $REPO_UT \
88
-
--inject-fault=pending --hubris-2093
110
+
./FMR-info rhai scripts/upgrade-rollback.rhai -c $TARGETS --inject-fault=pending
89
111
```
90
-
***Expected Outcome**: The script should run the "pending" fault injection test and exit with code 0. The log will show the sanitizer detecting the fault and using the reset-based workaround to clear it before the main test flow runs successfully.
112
+
***Expected Outcome**: The script should run the "pending" fault injection test and exit with code 0. The log will show the sanitizer detecting the fault and attempting to use the `faux-mgs component-active-slot -c`commandto clear it. If the firmware supports the command, it will clear the fault directly. If there's a version mismatch (e.g., "WrongVersion { sp: 19, request: 20 }"), the system will fall back to the RoT reset workaround and still complete successfully.
91
113
92
114
### Test 1.5: Fault Injection - Conflicting `transient` Preference
93
115
94
116
* **Purpose**: To verify the test harness correctly handles the inability to inject a fault into non-compliant firmware.
95
117
* **Command**:
96
118
```bash
97
-
FMR-info rhai scripts/upgrade-rollback.rhai -c scripts/targets.json \
98
-
-b $REPO_BL -u $REPO_UT \
99
-
--inject-fault=transient
119
+
./FMR-info rhai scripts/upgrade-rollback.rhai -c $TARGETS --inject-fault=transient
100
120
```
101
121
* **Expected Outcome**: The script is **expected to fail with exit code 1**. This is the correct outcome. The log will show:
102
122
1. The script first installs the `baseline` (`master`) firmware.
@@ -115,8 +135,7 @@ FMR-info reset-component rot
115
135
* **Purpose**: To verify that when both images are compliant, the script uses the transient update path for both the upgrade and the rollback.
116
136
* **Command**:
117
137
```bash
118
-
FMR-info rhai scripts/upgrade-rollback.rhai -c scripts/targets.json \
119
-
-b $REPO_BL -u $REPO_UT -t
138
+
./FMR-info rhai scripts/upgrade-rollback.rhai -c $TARGETS -t
120
139
```
121
140
* **Expected Outcome**: The script should complete successfully with an exit code of 0. The log should show a transient update is used for **both** the upgrade to `ut` and the subsequent rollback to `base`.
122
141
@@ -125,7 +144,6 @@ FMR-info reset-component rot
125
144
* **Purpose**: To verify that the negative test runs successfully in both directions when all firmware is compliant.
126
145
* **Command**:
127
146
```bash
128
-
FMR-info rhai scripts/upgrade-rollback.rhai -c scripts/targets.json \
129
-
-b $REPO_BL -u $REPO_UT -N
147
+
./FMR-info rhai scripts/upgrade-rollback.rhai -c $TARGETS -N
130
148
```
131
149
* **Expected Outcome**: The script should complete successfully with an exit code of 0. The `test_and_recover_from_preferred_slot_update_failure` function should be executed and pass for the `ut` branch during the upgrade, and then be executed and pass **again** for the `base` branch during the rollback.
Copy file name to clipboardExpand all lines: scripts/TODO.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,9 @@ This document tracks known issues, planned features, and refactoring opportuniti
4
4
5
5
## High Priority / Bugs & Workarounds
6
6
7
-
***Remove `--hubris-2093` Workaround**
8
-
***Issue**: The `lpc55-update-server` firmware has a bug where setting a persistent preference does not correctly clear a pre-existing pending preference. This is tracked as "Hubris issue #2093".
9
-
***Workaround**: The `sanitize_boot_preferences` function in `update-helper.rhai` uses a reset to reliably clear a pending preference when the `--hubris-2093` flag is active.
10
-
***Action**: Once the firmware bug is fixed, the workaround logic should be removed from `sanitize_boot_preferences` and the `--hubris-2093` flag should be removed from `upgrade-rollback.rhai`. The "ideal" logic path should become the only path.
7
+
***Hubris #2093 Workaround Status**
8
+
***Issue**: The `lpc55-update-server` firmware had a bug where setting a persistent preference did not correctly clear a pre-existing pending preference. This was tracked as "Hubris issue #2093".
9
+
***Current Status**: The `faux-mgs component-active-slot -c` command is now implemented and provides the preferred solution. However, the workaround logic is retained in `sanitize_boot_preferences` to handle version compatibility - when the SP firmware doesn't support the new `-c` command (version mismatch), the system gracefully falls back to the RoT reset workaround. This ensures compatibility across firmware versions during the transition period.
11
10
12
11
***Fix `faux-mgs` Error Reporting for `reset-component`**
13
12
***Issue**: When the SP debugger is attached, the `reset-component sp` command fails. However, the `faux-mgs` Rust code does not gracefully package the detailed error message (`watchdog: RoT error: the SP programming dongle is connected`) into the JSON passed to Rhai. It returns a generic error.
// After setting persistent preference, the device should boot into the target slot.
794
+
// We perform one reset and check if the preference took effect.
795
+
if (rbi.active != target_slot) {
796
+
debug(`error|Validation FAILED: Persistent preference for slot ${target_slot} did not take effect after first reset. Active slot is ${rbi.active}. This indicates a firmware issue.`);
797
+
if (conf?.rot_hubris_power_cycle_on_failure == true) {
798
+
power_cycle_dut(conf, "RoT persistent preference not applied after reset");
799
+
}
800
+
return false;
801
+
}
802
+
777
803
if (!rot_validate_direct_persistent_boot_state(
778
-
rbi, target_slot, target_label
804
+
rbi, target_slot, target_label, images
779
805
)) {
780
-
// No specific error type from this local helper yet to condition power cycle
781
806
if (conf?.rot_hubris_power_cycle_on_failure == true) {
782
807
power_cycle_dut(conf, "RoT direct persistent boot validation failed");
0 commit comments