Skip to content

ci: Catch fail_msg() in cmocka tests that Windows builds - #1743

Merged
zackees merged 2 commits into
obs-rust:masterfrom
rdoupe:fix/video-plan-test-windows-link
Oct 22, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
rdoupe:fix/video-plan-test-windows-link

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #1713

What and why

#1741, #1745 and #1762 fixed test_video_output_plan on Windows (the fail_msg() link error, then CRLF in techniques_exist_in_the_effect). This PR keeps it from coming back. It adds a check that fails when any cmocka test Windows builds calls fail_msg(), and converts the last such test, test_settings_track_rows.

On Windows, fail_msg() expands to the private cm_print_error(), which the Windows cmocka doesn't export, so such a test stops the Windows Tier 2 build with LNK2019 before CTest runs.

RED → GREEN

  • RED: fe3f12d adds ci/test_cmocka_windows_diagnostics.py, a generalization of test: make output-delay failure diagnostics link on Windows #1591's single-file check. It reads every add_executable() in test/cmocka/CMakeLists.txt and tests.d/*.cmake, and skips the ones an enclosing if() keeps off Windows (OS_LINUX, UNIX, NOT WIN32, or a plugin target that plugins/CMakeLists.txt only adds elsewhere). An else() or a condition it can't read counts as built on Windows. Comments that only mention fail_msg() don't count. It also compiles test_video_output_plan's diagnostic helpers against a model of the Windows link contract (cm_print_error declared, never defined) and expects each forced failure to print and fail. On master it fails: {'test/cmocka/test_settings_track_rows.cpp': 3} != {}.
  • GREEN: 1a04526 converts the three calls in test_settings_track_rows the test: make output-delay failure diagnostics link on Windows #1591 way: fprintf(stderr, ...) with the same format and arguments, a newline, then fail(), under the same condition. No condition, loop, case or assertion changes. The test is Qt6::Widgets-only, so Windows builds it, and it links there today. The check passes.
  • Validation: test_settings_track_rows passes against C libobs, hybrid Rust libobs and libobs-c-reference. uv run ci/local_gate.py --lane lint is ok (it runs all ci/test_*.py). Native Windows Tier 2 on an earlier head of this PR passed 177/177, including test_settings_track_rows (run 39738710776, job 119692871959).

Checklist

  • Base is master
  • I claimed the issue, or no one else has an open PR for it (rust: Port the video output conversion plan in obs.c to obs-core #1713, ours)
  • Characterization test (if the unit had none), then RED, then GREEN commits
  • User-visible change: its line in docs/features.md is added or updated (not applicable: test/CI check only)
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes (-W..., ratchets): none
  • Intentional differences from C listed in the parity test header and rust/README.md (ports): not a port

AI note: Claude Code (Claude Opus 5.5) wrote the check, the test change, the commit messages and this text under the submitter's direction, and ran the tests above on the submitter's machines.

@rdoupe
rdoupe requested a review from zackees as a code owner October 22, 2026 06:48
@rdoupe rdoupe added the ci-full Run every CI job on this PR, including the release-gating OBS app builds and Flatpak label Oct 22, 2026
@rdoupe
rdoupe force-pushed the fix/video-plan-test-windows-link branch 2 times, most recently from 975ad36 to b6832e9 Compare October 22, 2026 07:10
@zackees
zackees enabled auto-merge October 22, 2026 07:11
@zackees
zackees added this pull request to the merge queue Oct 22, 2026
@zackees
zackees removed this pull request from the merge queue due to a manual request Oct 22, 2026
@zackees

zackees commented Oct 22, 2026

Copy link
Copy Markdown
Member

Coordinator: I took this out of the merge queue. Its merge-group run would fail on master's Windows Tier 2, because techniques_exist_in_the_effect breaks on CRLF line endings, and #1762, which fixes that, conflicts with this PR in test_video_output_plan.c. Once #1762 lands I'll rebase this onto it, keeping your guard and diagnostics, and queue it again.

The Windows Tier 2 build stops before CTest with LNK2019, unresolved
cm_print_error in check_plan: test_video_output_plan (from obs-rust#1714) calls
fail_msg(), which expands to that private cmocka printer, and the Windows
cmocka does not export it. obs-rust#1580 was the same failure in
test_output_delay_e2e; obs-rust#1591 fixed it with fprintf(stderr, ...) and plain
fail(), and added a check for that one file.

ci/test_cmocka_windows_diagnostics.py generalizes that check. It reads
every add_executable() in test/cmocka/CMakeLists.txt and tests.d/*.cmake,
skips the ones an enclosing if() keeps off Windows (OS_LINUX, UNIX,
NOT WIN32, or a plugin target that plugins/CMakeLists.txt only adds on
other platforms; else() counts as Windows), and fails if any of their
sources calls fail_msg(). Comments that mention fail_msg() do not count.
As in obs-rust#1591, it also compiles the actual diagnostic helpers of
test_video_output_plan (check_plan, techniques_exist_in_the_effect,
size_check_edges, output_size_check_edges) against a model of the
Windows link contract, a cm_print_error declaration with no definition,
and expects each forced failure to print its diagnostic and fail.

On master it fails twice: the scan finds four fail_msg() calls in
test_video_output_plan.c and three in test_settings_track_rows.cpp (a
Qt6::Widgets test that Windows builds), and the probe does not link
(undefined reference to cm_print_error in all four helpers).

Refs obs-rust#1713
@zackees
zackees force-pushed the fix/video-plan-test-windows-link branch from b6832e9 to f28c9e1 Compare October 22, 2026 08:36
@zackees
zackees enabled auto-merge October 22, 2026 08:36
The Windows cmocka does not export cm_print_error(), which fail_msg()
expands to there, so a Windows-built test that calls it stops the
Windows Tier 2 build with LNK2019 before CTest runs (obs-rust#1713: obs-rust#1741,
obs-rust#1745 and obs-rust#1762 fixed test_video_output_plan).

test_settings_track_rows (Qt6::Widgets only, so Windows builds it too)
still had three such calls. It links on Windows today, but it is the
only Windows-built test left that calls fail_msg(), and the new check
holds every such test to the same rule. Each becomes fprintf(stderr,
...) with the same format and arguments and a terminating newline, then
a plain fail(), under the same condition. No condition, loop, case or
assertion changes.

Refs obs-rust#1713
@rdoupe
rdoupe force-pushed the fix/video-plan-test-windows-link branch from f28c9e1 to 1a04526 Compare October 22, 2026 08:40
@rdoupe rdoupe changed the title test: Report cmocka failures without fail_msg() where Windows builds them ci: Catch fail_msg() in cmocka tests that Windows builds Oct 22, 2026
@rdoupe

rdoupe commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

The rebase onto #1762 kept both CR-stripping blocks in techniques_exist_in_the_effect (a redefinition of w, which the probe caught in Format / checks). I pushed 1a04526 on top of your rebase: test_video_output_plan.c is now identical to master, and the PR is just the guard plus the test_settings_track_rows conversion. Title and body are updated to match.

@zackees
zackees added this pull request to the merge queue Oct 22, 2026
Merged via the queue into obs-rust:master with commit 8c59b2c Oct 22, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run every CI job on this PR, including the release-gating OBS app builds and Flatpak

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants