Skip to content

test: characterize callback/calldata.c before port (Refs #1439) - #1447

Merged
zackees merged 1 commit into
obs-rust:masterfrom
nathan-v:port/calldata
Oct 19, 2026
Merged

zackees merged 1 commit into
obs-rust:masterfrom
nathan-v:port/calldata

Conversation

@nathan-v

@nathan-v nathan-v commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Refs #1439 (meta #1437). Characterization PR before the port, like #1442 for decl.

test/cmocka/test_calldata.c pins what calldata_get_data, calldata_set_data, and calldata_get_string do today. callback/ had no cmocka test for this file. The port may not edit this test.

What and why

The public struct calldata and the inline helpers in calldata.h stay as they are. This test records the stack they sit on: name length, name, data length, data, and a terminating 0. The first allocation is 128 bytes when the used size is smaller. A later parameter stays readable when an earlier one grows or shrinks.

A few results are odd. They are pinned on purpose, with a comment that says characterized, not endorsed:

  • cd_ensure_capacity grows when the needed size is equal to the capacity. A fixed buffer with one spare byte still refuses a one-byte grow, and logs Tried to go above fixed calldata stack size!.
  • calldata_clear zeroes the first size_t only.
  • A null string is stored as a zero-size parameter. calldata_get_string returns true and a null pointer. An empty string returns a pointer to "".
  • The header says get checks the type. The stack stores a size. long long and double are both 8 bytes, so calldata_get_float succeeds on an int.

RED → GREEN

  • This PR is the characterization. It contains no Rust, so there is no RED or GREEN commit yet.
  • Local run: 11/11 passed against the C libobs on macOS (arm64). The function bodies in calldata.c.h match the libobs that binary was built from.
  • The port PR (rust/obs-callback) follows, RED then GREEN. Tier 1 mirrors this test. Tier 3 compares against the C oracle.

Checklist

  • Base is master
  • I claimed the issue (rust: Port callback/calldata.c to obs-callback #1439)
  • Characterization test. RED and GREEN are the next PR
  • User-visible change: not applicable (no user-visible change)
  • Local gate stamped. PR CI runs the full suite
  • No warning or flag changes
  • Intentional differences: not this PR. The port PR lists them if any

Pin the stack layout and the get/set behavior of
libobs/callback/calldata.c.h before the obs-callback port.
Odd cases are marked characterized, not endorsed.

Refs obs-rust#1439

@zackees zackees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review: LGTM. A test-only characterization of calldata.c.h before the port, registered in tests.d/. It pins the wire layout byte by byte (name length, name, data length, data, terminating 0), the 128-byte first allocation, the NULL/empty guards that leave outputs untouched, unaligned round-trips, and a bnum_allocs balance on every case. Marking odd behaviour as "characterized, not endorsed" is a good way to keep it pinned without blessing it. 11/11 against the C libobs.

@zackees
zackees added this pull request to the merge queue Oct 19, 2026
Merged via the queue into obs-rust:master with commit c6862c6 Oct 19, 2026
23 checks passed
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