Skip to content

Phase 3: characterize leaf utilities and port crc32 (#6) - #34

Merged
zackees merged 4 commits into
grind/meta-4-9b41from
grind/6-phase3-leaf-utils
Oct 9, 2026
Merged

zackees merged 4 commits into
grind/meta-4-9b41from
grind/6-phase3-leaf-utils

Conversation

@zackees

@zackees zackees commented Oct 9, 2026

Copy link
Copy Markdown
Member

Refs #6

Phase 3 (pure leaf utilities): cmocka characterization tests, then the first port, calc_crc32.

Commits (policy order)

  1. test: add cmocka characterization tests ...: 8 new cmocka tests (test_crc32, test_utf8, test_dstr, test_lexer, test_cf_lexer, test_text_lookup, test_base, test_bmem), their CMake registration, and the testing-policy.md sections for characterization tests and the Phase 3 port order. No Rust. These pin the current C behavior.
  2. test(obs-util): RED crc32 port with todo!() core: the shim, oracle, ENABLE_RUST_LIBOBS guard, rust-exports.txt entry and Tier 1/3 tests, with the safe core body set to todo!(). soldr cargo test -p obs-util --test crc32 fails all 6 tests.
  3. feat(obs-util): port calc_crc32 to Rust: GREEN.

Verification (local, Linux)

  • Focused: soldr cargo test -p obs-util --test crc32 --test crc32_parity --test export_list passes 6, 3 and 1 tests.
  • Mutation check: I changed POLY to 0xEDB8_8321 in rust/obs-util/src/crc32.rs. crc32_parity::matches_c_oracle FAILED. I restored the value and the test passes again.
  • ./lint passes. clang-format fixes were applied to the new C tests.
  • ./unittest passes: rust-test lane ok. Tier 2 Linux ctest passes 14/14 with ENABLE_RUST_LIBOBS OFF and 14/14 with it ON, and the libobs exported symbols are IDENTICAL OFF vs ON (1752).

Not verified locally

  • Windows/macOS Tier 2 was not run, because no host for them was available. By inspection: _CRT_SECURE_NO_WARNINGS is defined globally in cmake/windows/compilerconfig.cmake, so the strcpy/fopen calls in test_dstr and test_text_lookup should not trip /WX. test_utf8 is inside if(NOT MSVC). No native CI label was added: this is not a platform implementation change.

Pin current C behavior of crc32, utf8, dstr, lexer, cf-lexer/cf-parser,
text-lookup, base and bmem before porting, and document the
characterization-test rule and Phase 3 port order in testing-policy.md.

Refs #6
Adds the calc_crc32 shim, oracle wrapper, ENABLE_RUST_LIBOBS guard,
rust-exports.txt entry and Tier 1/Tier 3 tests. The safe core body is
todo!(), so soldr cargo test -p obs-util --test crc32 fails 0/6.

Refs #6
Table-driven reflected CRC-32 with a const fn table, matching
libobs/util/crc32.c. GREEN for the Tier 1 and Tier 3 crc32 tests.

Refs #6
… link (#6)

fail_msg() expands to cm_print_error(), which the Windows cmocka
library does not export (LNK2019). Report via fprintf and call fail().
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.

1 participant