Commit 45aeee4
committed
CI: extend ASan+UBSan workflow with imageviewer headless smoke
Follow-up to b9777c8 (the original ASan+UBSan workflow) and
70f24be (v8: flip to halt-on-error after a clean baseline).
Adds a third smoke tier that actually loads a libretro core and
runs it through ~5 seconds of real frame dispatch + clean
shutdown, covering everything --help and --features can't reach:
dlopen of a core, retro_load_game, the stb_image-driven decode
path, the X11 + XVideo color-conversion + shared-memory image-
transfer pipeline, the runloop, and full cleanup-on-shutdown.
The new step:
1. Builds cores/libretro-imageviewer/image_core.so with the same
SANITIZER=address,undefined the main retroarch binary uses
-- ensures stb_image's stack-buffer-overflow / use-after-
return surface is fully instrumented (the global ASan
allocator interceptor catches heap bugs across module
boundaries regardless, but stack instrumentation requires
per-TU compilation). This works because v9 (efae310) made
the standalone Makefile sanitizer-aware.
2. Generates an 8x8 solid-red test PNG via a Python heredoc
using only struct + zlib -- 75 bytes, no apt dependency on
imagemagick or similar (Python ships on every ubuntu-latest).
3. Spins up Xvfb on display :99 with a 320x240x24 screen (small
to minimise X server memory footprint), waits for the XVideo
extension to be available, writes a minimal retroarch.cfg
that pins the video driver to "xvideo" and the audio driver
to "null" (no PulseAudio / ALSA dependency on the runner),
and runs:
DISPLAY=:99 ./retroarch \
-c /tmp/asan-cfg/retroarch.cfg \
-L cores/libretro-imageviewer/image_core.so \
/tmp/test.png \
--max-frames=300 \
--verbose
--max-frames=300 = ~5s nominal at 60fps, ~15-25s under
sanitizer overhead. Crucially, --max-frames triggers a
clean exit through the normal runloop teardown -- not a
SIGTERM mid-execution -- so cleanup paths are sanitizer-
instrumented too. Wall-clock timeout(1) at 60s as a safety
backstop.
4. Surfaces sanitizer findings (AddressSanitizer: / runtime
error:) in the step output as informational text only. The
step is soft-fail (continue-on-error: true) on this first
iteration because lots of things can fire here that aren't
RetroArch bugs (Xvfb quirks, libGL / Mesa software-rasterizer
leaks at shutdown, X11 driver init noise) and forcing strict
enforcement before measuring a baseline would block merges
on noise. Once the baseline is characterised the same way
the --help step's was, this step can be flipped to strict.
Why xvideo specifically: it's the smallest self-contained X11
video driver in the tree (1163 LOC adapted from bSNES / MPlayer),
no GL dependency, real YUV color conversion + XShm transfer, and
Xvfb exposes the XVideo extension by default. null video would
be simpler but skips the entire pixel-data path, which is exactly
the surface most likely to fire under sanitizer.
* .github/workflows/Linux-asan-ubsan.yml
- Install dependencies: add xvfb, x11-utils, libxv-dev,
libxext-dev, libxxf86vm-dev. No new compiler/runtime
dependencies; the X11 transitive dev headers are needed for
xvideo build, xvfb + x11-utils for the runtime invocation.
- Configure: add --enable-xvideo to make xvideo a hard build
requirement -- silent fall-back to a different driver would
skew the smoke's coverage without warning.
- New steps appended after --features:
* Build imageviewer core under ASan + UBSan
* Generate test PNG for imageviewer
* Smoke run imageviewer headless under Xvfb (soft-fail)
- Header comment + --help comment updated to describe the
three-tier coverage structure (--help, --features, imageviewer).
Verified locally on efae310:
- YAML parses with 9 steps, soft-fail correctly scoped to only
the new imageviewer step.
- Imageviewer core builds clean with SANITIZER=address,undefined
(build step minus apt installs reproduced verbatim locally).
- Test PNG generation runs clean, produces a valid 75-byte 8x8
PNG (verified by `file` and stb_image acceptance).
- Xvfb on a fresh ubuntu-latest equivalent exposes the XVideo
and MIT-SHM extensions out-of-the-box.
- xdpyinfo -queryExtensions emits extension names with leading
whitespace, hence the ^[[:space:]]+ in the detection regex
(a naive ^XVideo / ^MIT-SHM regex would silently fail to
match -- caught and fixed during pre-flight).
Cannot verify locally: the actual end-to-end run, which would
require building a sanitizer-instrumented retroarch binary against
a full apt set. The first CI run is the experiment, the same way
the original workflow's was.1 parent efae310 commit 45aeee4
1 file changed
Lines changed: 212 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
7 | 22 | | |
8 | 23 | | |
9 | 24 | | |
| |||
43 | 58 | | |
44 | 59 | | |
45 | 60 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
49 | 71 | | |
50 | 72 | | |
51 | 73 | | |
52 | 74 | | |
53 | 75 | | |
| 76 | + | |
| 77 | + | |
54 | 78 | | |
55 | 79 | | |
56 | 80 | | |
| |||
60 | 84 | | |
61 | 85 | | |
62 | 86 | | |
63 | | - | |
| 87 | + | |
64 | 88 | | |
65 | 89 | | |
66 | 90 | | |
67 | 91 | | |
68 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
69 | 97 | | |
70 | 98 | | |
71 | 99 | | |
72 | 100 | | |
73 | 101 | | |
74 | | - | |
| 102 | + | |
| 103 | + | |
75 | 104 | | |
76 | 105 | | |
77 | 106 | | |
| |||
91 | 120 | | |
92 | 121 | | |
93 | 122 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
101 | 129 | | |
102 | 130 | | |
103 | 131 | | |
| |||
164 | 192 | | |
165 | 193 | | |
166 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
0 commit comments