|
| 1 | +# Weston_Runtime_Preflight |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +`Weston_Runtime_Preflight` validates Weston and Wayland runtime health before any Weston client-level display or graphics tests are executed. |
| 6 | + |
| 7 | +This testcase is a **runtime gate only**. It does **not** launch `weston-simple-shm`, `weston-simple-egl`, or any other Weston client application. |
| 8 | + |
| 9 | +The goal is to catch real Weston bring-up issues early, such as: |
| 10 | + |
| 11 | +- `weston.service` in failed state |
| 12 | +- `weston.socket` active but compositor process not running |
| 13 | +- missing or inconsistent Wayland runtime state |
| 14 | +- broken systemd-managed Weston recovery on target |
| 15 | +- runtime directory / socket issues for the configured Weston service user |
| 16 | + |
| 17 | +Client-level validation must be handled separately: |
| 18 | + |
| 19 | +- `weston-simple-shm` should be the first client-level blocker |
| 20 | +- `weston-simple-egl` should be the EGL-specific blocker after that |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Behavior |
| 25 | + |
| 26 | +### Default mode |
| 27 | + |
| 28 | +```sh |
| 29 | +./run.sh |
| 30 | + |
| 31 | +This is the strict runtime health check. |
| 32 | + |
| 33 | +In this mode, the testcase: |
| 34 | + |
| 35 | +checks DRM/display connectivity |
| 36 | + |
| 37 | +captures display snapshot and modetest diagnostics |
| 38 | + |
| 39 | +checks weston.service and weston.socket state |
| 40 | + |
| 41 | +inspects Weston service runtime context |
| 42 | + |
| 43 | +checks whether a Weston compositor process is actually running |
| 44 | + |
| 45 | +validates discovered Wayland runtime information |
| 46 | + |
| 47 | +optionally collects EGL pipeline diagnostics |
| 48 | + |
| 49 | + |
| 50 | +This mode does not attempt to restart or recover Weston. |
| 51 | + |
| 52 | +If Weston runtime is unhealthy, the testcase reports FAIL. |
| 53 | + |
| 54 | +Typical examples that cause FAIL in default mode: |
| 55 | + |
| 56 | +weston.service is failed |
| 57 | + |
| 58 | +no Weston process is running |
| 59 | + |
| 60 | +runtime state is inconsistent |
| 61 | + |
| 62 | +Wayland runtime cannot be validated |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +Relaunch mode |
| 69 | + |
| 70 | +./run.sh --allow-relaunch |
| 71 | + |
| 72 | +This mode enables an explicit recovery attempt for a broken systemd-managed Weston runtime. |
| 73 | + |
| 74 | +In this mode, if Weston runtime is unhealthy, the testcase may: |
| 75 | + |
| 76 | +stop weston.socket |
| 77 | + |
| 78 | +stop weston.service |
| 79 | + |
| 80 | +reset failed systemd state |
| 81 | + |
| 82 | +restart the systemd-managed Weston runtime |
| 83 | + |
| 84 | +re-check Weston service state, runtime directory, Wayland socket, and compositor process |
| 85 | + |
| 86 | + |
| 87 | +If Weston is already healthy, relaunch is not performed and the test logs: |
| 88 | + |
| 89 | +Relaunch not required, Weston already running |
| 90 | + |
| 91 | + |
| 92 | +If recovery succeeds, the testcase reports PASS. |
| 93 | + |
| 94 | +If recovery does not restore a healthy Weston runtime, the testcase reports FAIL. |
| 95 | + |
| 96 | + |
| 97 | +--- |
| 98 | + |
| 99 | +PASS / FAIL / SKIP semantics |
| 100 | + |
| 101 | +PASS |
| 102 | + |
| 103 | +Reported when: |
| 104 | + |
| 105 | +a connected display is available |
| 106 | + |
| 107 | +Weston runtime is healthy |
| 108 | + |
| 109 | +Wayland runtime discovery succeeds |
| 110 | + |
| 111 | +optional EGL diagnostics do not block runtime success |
| 112 | + |
| 113 | + |
| 114 | +FAIL |
| 115 | + |
| 116 | +Reported when: |
| 117 | + |
| 118 | +weston.service is failed or unhealthy in strict mode |
| 119 | + |
| 120 | +no Weston compositor process is running |
| 121 | + |
| 122 | +systemd-managed relaunch fails to recover Weston |
| 123 | + |
| 124 | +runtime validation fails after cleanup/restart attempt |
| 125 | + |
| 126 | +runtime remains inconsistent after recovery |
| 127 | + |
| 128 | + |
| 129 | +SKIP |
| 130 | + |
| 131 | +Reported when: |
| 132 | + |
| 133 | +no usable connected display is present for the test |
| 134 | + |
| 135 | + |
| 136 | +This testcase should not hide runtime issues behind SKIP when a display is present and Weston is expected to work. |
| 137 | + |
| 138 | + |
| 139 | +--- |
| 140 | + |
| 141 | +What this test validates |
| 142 | + |
| 143 | +connected display presence |
| 144 | + |
| 145 | +DRM / connector snapshot |
| 146 | + |
| 147 | +modetest capture for debug |
| 148 | + |
| 149 | +weston.service state |
| 150 | + |
| 151 | +weston.socket state |
| 152 | + |
| 153 | +Weston service user / UID context |
| 154 | + |
| 155 | +preferred runtime directory for Weston service user |
| 156 | + |
| 157 | +existence of Wayland runtime directory |
| 158 | + |
| 159 | +existence of Wayland socket when applicable |
| 160 | + |
| 161 | +actual Weston compositor process presence |
| 162 | + |
| 163 | +adopted Wayland environment used for reproduction |
| 164 | + |
| 165 | +optional EGL pipeline diagnostics for debug visibility |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | +--- |
| 170 | + |
| 171 | +What this test does not validate |
| 172 | + |
| 173 | +This testcase does not validate: |
| 174 | + |
| 175 | +Weston client rendering correctness |
| 176 | + |
| 177 | +shared-memory client rendering |
| 178 | + |
| 179 | +EGL window rendering |
| 180 | + |
| 181 | +repeated client launch / kill lifecycle |
| 182 | + |
| 183 | +graphics functional behavior beyond runtime diagnostics |
| 184 | + |
| 185 | + |
| 186 | +Those must be covered by separate tests such as: |
| 187 | + |
| 188 | +weston-simple-shm |
| 189 | + |
| 190 | +weston-simple-egl |
| 191 | + |
| 192 | + |
| 193 | + |
| 194 | +--- |
| 195 | + |
| 196 | +Runtime model notes |
| 197 | + |
| 198 | +This test performs dynamic runtime inspection and does not hardcode a single runtime path. |
| 199 | + |
| 200 | +It can log context such as: |
| 201 | + |
| 202 | +Weston service user |
| 203 | + |
| 204 | +Weston service UID |
| 205 | + |
| 206 | +preferred runtime directory, for example /run/user/1000 |
| 207 | + |
| 208 | +discovered runtime socket |
| 209 | + |
| 210 | +current XDG_RUNTIME_DIR |
| 211 | + |
| 212 | +current WAYLAND_DISPLAY |
| 213 | + |
| 214 | + |
| 215 | +This helps distinguish between: |
| 216 | + |
| 217 | +service-level failure |
| 218 | + |
| 219 | +runtime directory creation failure |
| 220 | + |
| 221 | +socket creation failure |
| 222 | + |
| 223 | +compositor process failure |
| 224 | + |
| 225 | +environment mismatch |
| 226 | + |
| 227 | + |
| 228 | + |
| 229 | +--- |
| 230 | + |
| 231 | +Parameters |
| 232 | + |
| 233 | +The testcase supports the following controls through environment variables and CLI. |
| 234 | + |
| 235 | +Environment variables |
| 236 | + |
| 237 | +WAIT_SECS |
| 238 | + |
| 239 | +default: 10 |
| 240 | + |
| 241 | +time to wait for runtime readiness checks |
| 242 | + |
| 243 | + |
| 244 | +VALIDATE_EGLINFO |
| 245 | + |
| 246 | +default: 1 |
| 247 | + |
| 248 | +when enabled, collects EGL pipeline diagnostics for debugging |
| 249 | + |
| 250 | +this is diagnostic and not intended to be the primary runtime gate |
| 251 | + |
| 252 | + |
| 253 | + |
| 254 | +CLI option |
| 255 | + |
| 256 | +--allow-relaunch |
| 257 | + |
| 258 | +default: disabled |
| 259 | + |
| 260 | +enables cleanup and restart attempt for systemd-managed Weston runtime |
| 261 | + |
| 262 | + |
| 263 | + |
| 264 | + |
| 265 | +--- |
| 266 | + |
| 267 | +Example usage |
| 268 | + |
| 269 | +Strict mode: |
| 270 | + |
| 271 | +./run.sh |
| 272 | + |
| 273 | +Recovery mode: |
| 274 | + |
| 275 | +./run.sh --allow-relaunch |
| 276 | + |
| 277 | +With custom wait time: |
| 278 | + |
| 279 | +WAIT_SECS=15 ./run.sh |
| 280 | + |
| 281 | +With EGL diagnostics disabled: |
| 282 | + |
| 283 | +VALIDATE_EGLINFO=0 ./run.sh |
| 284 | + |
| 285 | +Strict mode with diagnostics disabled: |
| 286 | + |
| 287 | +WAIT_SECS=15 VALIDATE_EGLINFO=0 ./run.sh |
| 288 | + |
| 289 | +Recovery mode with custom wait: |
| 290 | + |
| 291 | +WAIT_SECS=15 ./run.sh --allow-relaunch |
| 292 | + |
| 293 | + |
| 294 | +--- |
| 295 | + |
| 296 | +Result files |
| 297 | + |
| 298 | +The testcase writes: |
| 299 | + |
| 300 | +Weston_Runtime_Preflight.res |
| 301 | + |
| 302 | +Weston_Runtime_Preflight_run.log |
| 303 | + |
| 304 | + |
| 305 | +Possible result values: |
| 306 | + |
| 307 | +Weston_Runtime_Preflight PASS |
| 308 | + |
| 309 | +Weston_Runtime_Preflight FAIL |
| 310 | + |
| 311 | +Weston_Runtime_Preflight SKIP |
| 312 | + |
| 313 | +--- |
| 314 | + |
| 315 | +Recommended execution order |
| 316 | + |
| 317 | +Recommended gate order: |
| 318 | +1. Weston_Runtime_Preflight |
| 319 | + |
| 320 | +2. weston-simple-shm |
| 321 | + |
| 322 | +3. weston-simple-egl |
| 323 | + |
| 324 | +This ordering ensures runtime failures are caught before client-level failures are investigated. |
0 commit comments