Repository navigation
test: characterize callback/decl.c before port (Refs #1438) - #1442
Merged
Merged
Conversation
test/cmocka/test_decl.c pins what parse_decl_string does today, as the Tier 2 test for the port in obs-rust#1438 (meta obs-rust#1437). There was no C test for libobs/callback/. - Parameters without a specifier are input parameters; `in out` sets both flags. - A non-void return type is appended as an output parameter "return", after the declared parameters. - All five parameter types; `void` only as the return type. - `void f()` has no parameters; `ptr get()` only "return". - Each error fails the parse: unknown type, void parameter, unknown return type, duplicate name, reserved name ("return", "int") for a parameter or the function, a repeated in/out specifier, a missing ")" and an empty string. A failed parse frees and zeroes the whole decl_info, decl_string included. - No allocation is left behind (bnum_allocs) in any case. Checked against the C: 5/5 against the C libobs.so on Linux (each failure logs the expected error, for example "'in' specifier already exists"). Co-Authored-By: Claude Opus 5.5 <[email protected]>
zackees
approved these changes
Oct 18, 2026
zackees
left a comment
Member
There was a problem hiding this comment.
Coordinator review: LGTM. A characterization test that pins today's behavior, with a bnum_allocs leak check on every case, is exactly what should come before the port.
Fixup pushed (280533f): test_decl is now registered in test/cmocka/tests.d/test_decl.cmake instead of being appended to CMakeLists.txt. The comment at CMakeLists.txt:686 asks new tests to go there so that concurrent PRs adding tests don't conflict. Nothing else changed.
zackees
enabled auto-merge
October 18, 2026 21:12
This was referenced Oct 19, 2026
This was referenced Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1438 (meta #1437). Characterization PR before the port, like #788 for obs-data.
test/cmocka/test_decl.c(Tier 2) pins whatparse_decl_stringdoes today. There was no C test forlibobs/callback/.void f(int a)f,decl_stringpoints to the input,aisINTwithCALL_PARAM_IN(no specifier = input)int get(in ptr src, out string s, in out float x)IN,OUT,IN | OUT; the return type is appended last as an output parameter"return"bool f(int, float, bool, ptr, string)"return"asBOOLvoid destroy(),ptr get()"return"voidparameter, unknown return type, duplicate name, reserved names (return,int) for a parameter or the function,in in,out out, missing), empty string. A failed parse frees and zeroes the wholedecl_info,decl_stringincluded.Every case checks
bnum_allocs()before and after: nothing is left behind.Checked against the C: 5/5 against the C
libobs.soon Linux. Each failure logs the expected error (for example'in' specifier already exists).No change outside
test/cmocka/. The port (new craterust/obs-callback) follows in its own PR.🤖 Generated with Claude Code