Skip to content

test/cmocka: Fix master's Windows and macOS Rust Tier 2 lanes - #2534

Merged
zackees merged 3 commits into
masterfrom
fix/state-stacks-msvc-link
Oct 26, 2026
Merged

zackees merged 3 commits into
masterfrom
fix/state-stacks-msvc-link

Conversation

@zackees

@zackees zackees commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Master fails two Rust Tier 2 lanes, so every PR that selects them is red (seen on #2514 and #2531, run 40402547358).

  1. Windows, LNK2005. test_graphics_state_stacks_rust (added by obs-graphics: Port the graphics state stacks (#2517, fixes #2519) #2528) fails to link with matrix4_mul already defined in obs.lib(obs.dll) and five other matrix4_* symbols. The target is now guarded with AND NOT MSVC. The C variant still runs on Windows and the Rust variant on Linux and macOS. test/cmocka: Run test_graphics_state_stacks_rust on Windows again (LNK2005 on matrix4_*) #2533 tracks restoring the Windows run.
  2. macOS, test_find_data_file (added by test/cmocka: Batch six characterization tests before their ports #2508) fails at test_obs_core_info_characterization.c:154 with 0xc5ac59ca0 != 0x0. On macOS, find_libobs_data_file (libobs/obs-cocoa.m.h:26) returns the libobs framework's Resources path without checking that the file exists, so obs_find_data_file never returns NULL there. The case now records that ("characterized, not endorsed": the returned path does not exist) and skips the data-path checks when it happens. The check runs at runtime, with no platform #ifdef, so Linux and Windows keep every assertion.

Edits to obs-rust-authored characterization tests follow the precedent of #2289, #2495 and #2507. No upstream C test is touched.

RED: the failing lanes above. GREEN: this PR's macOS and Windows lanes. It is a CI fix, so RED and GREEN are pushed together, per AGENTS.md.

@vpacher

vpacher commented Oct 26, 2026

Copy link
Copy Markdown
Member

The ci/ self-test failure is test_cmocka_rust_static_guard.py. Its guard pattern accepts only a line that is exactly if(TARGET libobs_rust-static), so if(TARGET libobs_rust-static AND NOT MSVC) counts as unguarded. A nested condition passes (the checker's own self-test shows this form):

if(TARGET libobs_rust-static)
  if(NOT MSVC)
    # test_graphics_state_stacks_rust ...
  endif()
endif()

The cause of the LNK2005 is in my reply on #2528: the test calls the six exported matrix4_* functions for its expected values through obs.lib, and the libobs_rust.lib member with the gs_matrix_stack_* shims defines them too. I will take #2533.

The macOS Rust Tier 2 lane on master is red too, from #2508's test_find_data_file: find_libobs_data_file in libobs/obs-cocoa.m.h returns a path into the framework's Resources without checking that the file exists, so obs_find_data_file never returns NULL on macOS. I will open an issue and a test-only PR for it.

… path

#2508's test_find_data_file expected NULL for a missing file. On macOS,
find_libobs_data_file (libobs/obs-cocoa.m.h) returns the framework's
Resources path without checking it, so the case failed on macos-26
(test_obs_core_info_characterization.c:154). Record that and skip the
data-path checks there.
@zackees zackees changed the title test/cmocka: Skip test_graphics_state_stacks_rust on MSVC (LNK2005) test/cmocka: Fix master's Windows and macOS Rust Tier 2 lanes Oct 26, 2026
@vpacher

vpacher commented Oct 26, 2026

Copy link
Copy Markdown
Member

Two notes on the current head (1c87c1f):

  1. The ci/ self-test still fails on test_cmocka_rust_static_guard.py (test/cmocka/tests.d/test_graphics_state_stacks.cmake, the target_link_libraries(... libobs_rust-static) line). The guard accepts only if(TARGET libobs_rust-static) on its own, so the AND NOT MSVC needs to be a nested if(NOT MSVC) (see my comment above).
  2. This PR's CI does not select the Windows or macOS Rust Tier 2 lanes, so neither fix runs on the platform it is for before the merge queue. obs-graphics: Port the libnsgif state machine and public API (#2510) #2514 failed the same way in the queue earlier tonight. Can you add those lanes to this run, or run them by hand, before it is queued?

ci/test_cmocka_rust_static_guard.py recognizes only that form.
@zackees
zackees added this pull request to the merge queue Oct 26, 2026
@zackees

zackees commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

Note: for these paths, this PR's CI skips Rust Tier 2 on Windows and macOS (ci_scope selects only Linux), so this run doesn't verify the GREEN. The check will be the re-runs of #2514 and #2531 after this lands, since both select those jobs. I'll re-run them then.

Merged via the queue into master with commit 1a90124 Oct 26, 2026
36 checks passed
@zackees
zackees deleted the fix/state-stacks-msvc-link branch October 26, 2026 22:06
zackees added a commit that referenced this pull request Oct 26, 2026
The runtime check from #2534 calls obs_find_data_file first, and on
macos-26 that segfaults (run 40410629662): find_libobs_data_file uses the
libobs framework bundle, which a cmocka binary does not have.
zackees added a commit that referenced this pull request Oct 26, 2026
…#2533)

Drops the NOT MSVC guard from #2534. windows-2025-vs2026 fails to link
with LNK2005 on matrix4_* (run 40401995234).
zackees added a commit that referenced this pull request Oct 27, 2026
…#2533)

Drops the NOT MSVC guard from #2534. windows-2025-vs2026 fails to link
with LNK2005 on matrix4_* (run 40401995234).
zackees added a commit that referenced this pull request Oct 27, 2026
…#2533)

Drops the NOT MSVC guard from #2534. windows-2025-vs2026 fails to link
with LNK2005 on matrix4_* (run 40401995234).
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…s-rust#2533) (obs-rust#2537)

* test/cmocka: Build test_graphics_state_stacks_rust on MSVC again (RED, obs-rust#2533)

Drops the NOT MSVC guard from obs-rust#2534. windows-2025-vs2026 fails to link
with LNK2005 on matrix4_* (run 40401995234).

* test/cmocka: Link the Rust staticlib ahead of libobs in test_graphics_state_stacks_rust (GREEN, obs-rust#2533)

link.exe resolves references library by library in command-line order.
The staticlib's codegen unit with the gs_*_stack_* shims also defines
matrix4_*, so listing it first resolves the test's matrix4 calls there
and keeps obs.lib's copies out (LNK2005).

* test/cmocka: Keep the Linux link order of test_graphics_state_stacks_rust (obs-rust#2533)

GNU ld failed with 'libuuid.so.1: DSO missing from command line' when the
staticlib came before libobs; only link.exe needs the staticlib first.

* test/cmocka: Allow the duplicate matrix4_* in test_graphics_state_stacks_rust on MSVC (obs-rust#2533)

Linking the staticlib first (run 40416968486) removed the LNK2005 but pulled
obs_util objects that need rpcrt4, winmm and libobs' unexported base_log
functions (LNK2019). Keep the original order and let link.exe take the first
of the duplicate matrix4_* definitions instead.

* test/cmocka: Link test_graphics_state_stacks_rust without /INCREMENTAL on MSVC (obs-rust#2533)

/FORCE makes link.exe drop /INCREMENTAL with LNK4075, which /WX turns into
LNK1218 (run 40420479363).

* test/cmocka: Link test_graphics_state_stacks_rust without /WX on MSVC (obs-rust#2533)

LNK4088 from /FORCE cannot be ignored, so /WX turned it into LNK1218
(run 40423760010).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants