Repository navigation
test/cmocka: Run test_graphics_state_stacks_rust on Windows again (#2533) - #2537
Conversation
|
The new link order breaks the test on Linux. I built this head (2766aa5) on Linux x86_64 (Debian 13): With the staticlib first, GNU ld also takes the test's own Putting the staticlib first only on MSVC works on Linux: build OK and if(MSVC)
target_link_libraries(
test_graphics_state_stacks_rust
PRIVATE libobs_rust-static OBS::libobs OBS::caption ${CMOCKA_LIBRARIES}
)
else()
target_link_libraries(
test_graphics_state_stacks_rust
PRIVATE OBS::libobs OBS::caption ${CMOCKA_LIBRARIES} libobs_rust-static
)
endif()On MSVC the static-first order is still not tested. The same obs-util pull happens there, so the link can need more Windows system libraries, or show the clash that the note in |
7a08a42 to
3e9f3ed
Compare
|
Status:
|
|
Reviewed. Putting the staticlib first on MSVC is a sound fix for the LNK2005, and Linux keeps its order (which avoids the libuuid problem). One coordination note: this re-adds |
|
Correction: this PR's CI doesn't run Rust Tier 2 on Windows, because |
3e9f3ed to
4ba0586
Compare
|
Windows result from run 40416968486: listing the staticlib first removed the LNK2005, but it made link.exe take |
|
The new full run (40420479363) still fails Windows Tier 2, now on a warning:
|
4ba0586 to
faca5a1
Compare
…_state_stacks_rust (GREEN, #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).
…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.
…cks_rust on MSVC (#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.
…L on MSVC (#2533) /FORCE makes link.exe drop /INCREMENTAL with LNK4075, which /WX turns into LNK1218 (run 40420479363).
…#2533) LNK4088 from /FORCE cannot be ignored, so /WX turned it into LNK1218 (run 40423760010).
faca5a1 to
ff4e613
Compare
…group #2528 added test_graphics_state_stacks_rust on master with libobs.nsgif+.h.c, which this PR moves into the Rust staticlib; #2537 then gave that file MSVC warning options. Drop the file and its MSVC block. Also drop the two MSVC set_source_files_properties blocks that no longer name a file (test_sprite_geometry_steps_rust, test_effect_parser_lifecycle_rust). Co-Authored-By: Zach Vorhies <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t#2510) (obs-rust#2514) * test: Characterize the libnsgif state machine and public API through nsgif.h (obs-rust#2510) Ten cases for gif.c before its port, on GIFs that a small writer in the test builds (header, screen descriptor, colour tables, graphic control and loop count extensions, images of one colour from the LZW emitter): the error and disposal strings; the nine bitmap formats and their byte orders, and the default black and white table; a whole scan (info, frame info, the default delay of a frame without a graphic control extension, local palettes, a second scan, a scan after nsgif_data_complete); scans in two parts and byte by byte; the screen size quirk with the first frame setting or growing the size; a GIF without frames, a cut one and not a GIF; nsgif_data_complete for a frame cut in its image data (also frame 0, which gets transparency); the frame order of nsgif_frame_prepare with the redraw area, the delay rules, play once, loop forever, data not complete and one frame; the disposal across frames (restore background with and without transparency, restore previous), a restart, a cached frame and a bad frame number; the bitmap callbacks and a row span wider than the image. 39/39 on the C. Kept, characterized, not endorsed: - When a scan stops at the end of the data inside a frame, nsgif_data_scan keeps the position where the frame's parse stopped, not the frame's start. The next scan reads image data or an extension's terminator as the next block: a bad frame from then on, also with all the data. A split inside the image data or on an extension's last byte breaks a scan in parts; OBS scans whole files. - With play once (no loop extension), one more nsgif_frame_prepare after the last frame (infinite delay) shows frame 0 again before NSGIF_ERR_ANIMATION_END. Refs obs-rust#2510 Co-Authored-By: Claude Opus 5.5 <[email protected]> * obs-graphics: RED for the libnsgif state machine and public API (todo!) The safe core of libobs/graphics/libnsgif/gif.c.h as obs_graphics::gif, with todo!() bodies: Gif<B: Bitmaps> with new, set_frame_delay_behaviour, data_scan, data_complete, reset, frame_prepare, frame_decode, info, frame_info, global_palette and local_palette, and strerror and str_disposal. Info and FrameInfo have the C layout of nsgif_info_t and nsgif_frame_info_t, which the API returns pointers to. Bitmaps is the client's nsgif_bitmap_cb_vt, with default methods for the optional callbacks. Every call that reads the GIF data takes it. gif_blocks' disposal constants get UNSPECIFIED and NONE. Tier 1 (render::gif in obs-tests-graphics): the ten cmocka cases one to one with the same GIF writer, edge cases (dropping a Gif destroys its bitmap; a bitmap that cannot be created is out of memory) and a proptest (random and mutated GIFs, scanned in parts, then random calls: no panic, the frame count never shrinks). RED: 0 of 13 pass. Refs obs-rust#2510 Co-Authored-By: Claude Opus 5.5 <[email protected]> * obs-graphics: Port the libnsgif state machine and public API (obs-rust#2510) GREEN for obs_graphics::gif: the safe core (the frame table and the scan positions of nsgif_data_scan with its frame parse on the gif_blocks parsers, nsgif_data_complete, the frame order, loop count and delay rules of nsgif_frame_prepare, nsgif_frame_decode with the disposal across frames, the saved frame and the bitmap callbacks on the gif_frame decode, the palettes and the strings; the C's uint32_t arithmetic as wrapping operations) and a thin hidden #[no_mangle] shim for the fourteen functions of nsgif.h. nsgif_t is NsgifCtx: the safe Gif plus the buffer of the last scan; Info and FrameInfo have the C layout, as the API returns pointers to them; nsgif_bitmap_cb_vt is BitmapCbVt, which implements the Bitmaps trait over the client's function pointers. gif.c.h, the last C file of libnsgif, moves from libobs.nsgif to the ported group libobs.ported-nsgif-gif (its PCH renamed with it), so the hybrid libobs has no libnsgif C left. The C oracle no longer builds libnsgif as a library: image-file.c.h in the oracle calls the Rust shims, as libobs does, and oracle/gif.c is gif.c.h renamed, calling the C oracles of the other three files, for the parity test. The _rust test executables (test_effect_parser_lifecycle_rust, test_sprite_geometry_steps_rust, test_nsgif_decode_rust) take libnsgif from the staticlib instead of compiling the group. Tier 1: 13/13. Tier 3 (render::gif_parity): the strings, and 3 000 random cases of generated GIFs (one to four frames, every disposal, delays, transparency, rectangles inside and past the screen, interlace, local tables, loop counts, the screen size quirk), mutated or cut, and random bytes; scanned whole or in two to four parts, with or without nsgif_data_complete, in all nine bitmap formats, with or without a row span wider than the image and the optional callbacks; then random prepares, decodes, resets and delay rules. After every call the result, the info, every frame info, both palettes, the prepare outputs, the decoded bitmap and the callback counts match the whole of libnsgif in C. 3/3 with the shim-only null pointer test. test_nsgif_decode_rust runs the thirty-nine cmocka cases against the shims without any libnsgif C. port_comparison (M1 Max, five 1920x1080 frames scanned and decoded through the API, Rust on Rust, C on C, three runs): 49.3 to 50.6 ms, C 53.0 to 54.4 ms. Refs obs-rust#2510 Co-Authored-By: Claude Opus 5.5 <[email protected]> * obs-build: Drop the Windows warning options of the ported libnsgif group The Windows Rust build of libobs (rust/obs-build) gave the C group libobs.nsgif /wd4244 /wd4267. obs-rust#2510 moves gif.c.h to the ported group libobs.ported-nsgif-gif, which is not in that build target (the hybrid takes libnsgif from Rust), and the build refuses options for sources outside its target ("compiler options refer to sources outside this target", native_libobs::windows_tests::core_builds_from_the_canonical_manifest in Rust Tier 2 windows). The other three ported libnsgif groups have no entry either. Refs obs-rust#2510 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fixup: the _rust cmocka tests no longer compile the removed libnsgif group obs-rust#2528 added test_graphics_state_stacks_rust on master with libobs.nsgif+.h.c, which this PR moves into the Rust staticlib; obs-rust#2537 then gave that file MSVC warning options. Drop the file and its MSVC block. Also drop the two MSVC set_source_files_properties blocks that no longer name a file (test_sprite_geometry_steps_rust, test_effect_parser_lifecycle_rust). Co-Authored-By: Zach Vorhies <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * obs-graphics: Bound the gif_parity bitmaps; exclude a C read past the data Two defects in render::gif_parity::api (obs-rust#2510), both from random seeds: - A mutated logical screen descriptor can ask the bitmap callback for up to 65535 x 65535 pixels. cb_create allocated and filled that (17 GB), for the C and the Rust decoder. This starved the 16 GB CI runners: all three Fast Gate exit-143 runner losses of this PR (runs 40380261405 attempts 1 and 2, merge queue run 40478704942). With a 6 GB limit, 3 of 10 runs were OOM-killed. cb_create now returns NULL above 4 M pixels (16 MiB), as an out-of-memory host does; both sides get the same callback. - After a scan that stops inside a frame's local colour table, nsgif_local_palette in C decodes the table from past the end of the data (buf_len); the Rust decodes only the bytes in the data. This is an intentional difference (OBS does not call nsgif_local_palette). The views now compare, for frames at or after frame_count, only whether there is a local palette and its size. The shrunk case is kept in proptest-regressions/gif_parity.txt; rust/README.md lists the difference. Verified: the saved case passes; 50 runs (150 000 random cases) pass, maximum resident size 154 MB; obs-tests-graphics 420/420; clippy clean. Refs obs-rust#2510 Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Zach Vorhies <[email protected]>
Fixes #2533.
#2534 skipped
test_graphics_state_stacks_ruston MSVC because link.exe failed with LNK2005 onmatrix4_*(run 40401995234): the staticlib codegen unit that holds thegs_*_stack_*shims also definesmatrix4_*, and obs.lib's copies were pulled first.NOT MSVCguard; this is the configuration that failed in run 40401995234. There's no MSVC here for a local reproduction, so RED and GREEN are pushed together, per the CI/configuration rule in AGENTS.md.libobs_rust-staticahead ofOBS::libobs. link.exe resolves in command-line order, so the test'smatrix4_*calls bind to the staticlib unit it pulls anyway, and obs.lib's members stay out.EXPORTisdllexport(nodllimporton the consumer side), so the test references plainmatrix4_*, not__imp_.No C test or public header changes. If the Windows lane still reports LNK2005, the fallback is moving the shims to their own codegen unit.