Repository navigation
test: characterize callback/proc.c before port (Refs #1440) - #1454
Merged
Merged
Conversation
Pin proc_handler_create, destroy, add, and call against the current C. No Rust in this change. The port may not edit this test. Invalid declarations are logged and not stored. A duplicate name keeps the first callback. The call drops the mutex before the callback, so the callback can add, call, or destroy the same handler. Refs obs-rust#1440
zackees
approved these changes
Oct 19, 2026
zackees
left a comment
Member
There was a problem hiding this comment.
Coordinator review: LGTM. A test-only characterization of proc.c.h before the port, registered in tests.d/.
I checked the trickiest case, destroy_from_call, against the C. proc_handler_call copies the proc_info and unlocks before invoking the callback, and doesn't touch the handler afterwards, so destroying the handler from inside its own call is defined behavior. That makes it a guarantee worth pinning for the Rust port, which must not hold a borrow or lock across the callback. The re-entrant add/call case and the NULL-callback case ("characterized, not endorsed") are likewise good to have pinned.
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 #1440 (meta #1437). Characterization PR before the port, like #1442 for decl and #1447 for calldata.
test/cmocka/test_proc.cpins whatproc_handler_create,proc_handler_destroy,proc_handler_add, andproc_handler_calldo today.callback/had no cmocka test for this file. The port may not edit this test.What and why
The handler stays opaque.
proc_handler_addparses the declaration withparse_decl_stringand stores the callback under that name.proc_handler_calllooks the name up withstrcmp, copies the callback, drops the mutex, then calls it. The calldata pointer is passed through. The declaration is not checked against the calldata.A few results are odd. They are pinned on purpose, with a comment that says characterized, not endorsed:
LOG_ERROR(Function declaration invalid: ...) and not stored. A NULL declaration string logs(null). An empty string logs a blank name. The parser may also log a warning before that error line.Procedure '<name>' already existsatLOG_WARNINGand keeps the first callback, even when the second declaration has a different signature.strcmponce any proc is registered. With an empty handler it returns false.RED → GREEN
build_rust_OFFRelWithDebInfo,ENABLE_UNIT_TESTS=ON.rust/obs-callback) follows, RED then GREEN. It calls the existingparse_decl_string, so it does not wait on the Rust decl port (rust: Port callback/decl.c to obs-callback #1438). Tier 1 mirrors this test. Tier 3 compares against the C oracle.Checklist
master