Skip to content

CI: Add Address Sanitizer (ASan) and Undefined Behavior Sanitizer (UBSan) tests. - #6

Merged
fjtrujy merged 3 commits into
ps2dev:masterfrom
glampert:ci/sanitizers
Oct 21, 2026
Merged

fjtrujy merged 3 commits into
ps2dev:masterfrom
glampert:ci/sanitizers

Conversation

@glampert

Copy link
Copy Markdown

Adds a sanitizers job to the CI workflow. It builds openvcl and the tests in Debug with -fsanitize=address,undefined, runs ctest, then compiles the 12 ps2gl programs in test/fixtures. No test compiles those today, and they take the whole openvcl, software pipeliner included, through real programs. The job needs no PS2 toolchain, so it runs on ubuntu-latest without the ps2sdk container. It takes about 3 minutes (183 s on the last run), next to about 2.5 for the ps2 job.

  • Any sanitizer report fails the job. Reports are written to files (log_path) and printed at the end of the step. The integration tests run openvcl as a child process, so a test that expects it to fail would otherwise pass even with a report on its stderr.
  • Leaks are not checked (detect_leaks=0). openvcl doesn't free its register allocation data before it exits. With LeakSanitizer on, 132 of the 444 tests would fail on leak reports.
  • The fixtures compile in parallel, at -O0. With the sanitizers, the slowest takes over a minute. The second commit tried -O1 instead: on the runner, the build itself then took 4 minutes instead of half a minute, and the job over 7. The third commit goes back to -O0, the fastest run of the two.

On master the job passes with no reports. To check that it catches bugs, I added an off-by-one read past the end of a std::vector in the register allocator and tested locally. The step failed with 13 heap-buffer-overflow reports: one from the test binary and one from each fixture.

glampert and others added 3 commits October 21, 2026 15:48
Add a job to the CI workflow that builds openvcl and the tests in Debug
with -fsanitize=address,undefined and runs them. It needs no PS2
toolchain, so it runs on ubuntu-latest without the ps2sdk container.

The integration tests run openvcl as a child process, and a test that
expects openvcl to fail would pass over a sanitizer report on its
stderr. Reports go to files instead, and any report fails the job.

openvcl does not free its register allocation data before it exits, and
LeakSanitizer would fail 132 of the 444 tests on that, so leaks are not
checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No test compiles the ps2gl programs in test/fixtures, so the sanitizer
job never ran them through openvcl. Compile each one after the tests,
with the same handling of reports. They take the whole compiler,
software pipeliner included, through real programs.

Build at -O1, as ASan's documentation suggests for speed: at -O0 the
fixtures alone take several minutes to compile, and -O1 cuts that to
about a third.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the CI runner -O1 made the sanitized build take four minutes instead
of half a minute, more than it saved on the fixtures, and the job took
over seven minutes. Build at -O0 again and compile the twelve fixtures
at the same time: the slowest alone takes over a minute, and together
they need under 5 GB of memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fjtrujy
fjtrujy merged commit 5b01611 into ps2dev:master Oct 21, 2026
6 checks passed
@glampert
glampert deleted the ci/sanitizers branch October 22, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants