Repository navigation
test: characterize callback/signal.c before port (Refs #1441) - #1457
Merged
zackees merged 1 commit intoOct 19, 2026
Merged
Conversation
Add test/cmocka/test_signal.c, registered in tests.d. It pins the current C behavior of signal.c.h: add (duplicates, invalid declarations, add_array), connect and disconnect, a null handler, an unknown signal, a disconnect and a connect while signalling, signal_handler_remove_current (also after a nested signal), keep_ref refcounting, and global callbacks. Every case checks bnum_allocs. Global connect and disconnect matching is not pinned: da_find compares the struct padding too. Refs obs-rust#1441 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 signal.c.h, registered in tests.d/. It's good judgment to leave the global connect/disconnect matching unpinned: da_find memcmps global_callback_info padding included, so pinning it would pin uninitialized bytes. Pinning the nested-signal case, where signal_handler_remove_current removes nothing because the inner signal reset the thread-local, as "characterized, not endorsed" is exactly the kind of quirk the port has to decide on deliberately. A cmocka test runs in its own process, so its log capture can't race other tests.
This was referenced Oct 19, 2026
5 tasks done
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 #1441 (meta #1437). This is the characterization PR before the port, like #1442 for decl and #1454 for proc.
test/cmocka/test_signal.c(Tier 2) pins whatsignal.c.hdoes today. It is registered intest/cmocka/tests.d/test_signal.cmake.create_destroy_testsignal_handler_destroy(NULL)does nothingadd_testLOG_WARNING"Signal declaration 'ev' exists"). An invalid declaration is refused: decl logs its warning, then signal logsLOG_ERROR"Signal declaration invalid: ...".signal_handler_add_arrayadds every string and returns false if one failed; the strings after a failure are still added.connect_signal_testconnect_unknown_testLOG_WARNING"signal_handler_connect: signal 'nope' not found"disconnect_testdisconnect_during_signal_testremove_current_testconnect_during_signal_testnested_signal_testsignal_handler_remove_current()removes nothing (the thread-local current callback is reset to NULL)keep_ref_testconnect_refadds the same pair again, and each one keeps the handler alive aftersignal_handler_destroy; each disconnect drops one reference, and the last one destroys the handlerkeep_ref_remove_current_testkeep_refcallback removed while signalling gives its reference back after the passglobal_testglobal_remove_testsignal_handler_remove_current()removes a global callback; characterized, not endorsed: a global callback that disconnects itself stays connected (da_findcompares the whole entry, and itssignalingcount is 1)Every test checks
bnum_allocs()before and after.Not pinned, on purpose:
signal_handler_connect_globalandsignal_handler_disconnect_globalfind entries withda_find, amemcmpof the wholestruct global_callback_info, including its padding. Whether a second connect or a disconnect matches depends on bytes that the C does not set. The port compares the fields.Checked against the C: 13/13 on Linux x86_64, against
libobsandlibobs-with-rust(signal is still C in both), and against an AddressSanitizer build of libobs.No change outside
test/cmocka/. The port follows in its own PR.🤖 Generated with Claude Code